lenatriestounderstand

Section 7 of 9

Embeddings and Retrieval

Embeddings, similarity and nearest-neighbor search, ANN indexes and vector databases, sparse and hybrid retrieval, chunking, reranking, and the search lineage from BoW to modern embedding models.

9 items in this section.

Long reads

Shorts

Shorts

Chunking Strategies, on One Page

RAG's quietest failure mode isn't the model or the embedding — it's where you cut the text. Chunk too big and retrieval goes fuzzy; too small and you sever an answer from the condition that qualifies it.

  • rag
  • chunking
  • retrieval
  • embeddings
  • +1
Read
Oct 27, 2026
Shorts

In-Batch Negatives: Where a Retrieval Model Gets Its Contrast

A contrastive model learns from pairs it is given and from the far larger number of pairs it is not: every other example in the batch becomes a negative. That trick is why batch size is a quality knob, and why the temperature next to it is doing real work.

  • embeddings
  • retrieval
  • contrastive-learning
  • training
Read
Oct 27, 2026
Shorts

HNSW: How Vector Search Stays Logarithmic

The graph that turned vector search from O(N) into O(log N). A hierarchy of small-world graphs, three tunable parameters, and the recall/latency trade-off underneath every production vector database.

  • embeddings
  • hnsw
  • ann
  • vector-databases
Read
Jun 7, 2026
Shorts

BM25 vs Dense Embeddings: Why Hybrid Retrieval Wins

Two retrieval philosophies — lexical evidence vs learned geometry — fail in exactly opposite ways. That's why production retrieval is rarely pure dense, and why Reciprocal Rank Fusion ended up everywhere.

  • embeddings
  • retrieval
  • bm25
  • hybrid
Read
Jun 7, 2026
Shorts

Bi-encoder vs Cross-encoder: Why Retrieval Is Two-Stage

A bi-encoder encodes query and document independently; a cross-encoder reads them together. One is cheap and slightly dumb, the other is expensive and much sharper. Modern retrieval uses both — and the two-stage cascade is the whole point.

  • embeddings
  • retrieval
  • reranking
Read
Jun 7, 2026
Shorts

Cosine, Dot Product, Euclidean: When Are They the Same Thing?

Three different similarity measures that, on normalized embeddings, all rank the same. Why cosine is the convention, why dot is the implementation, and when the choice actually matters.

  • embeddings
  • similarity
  • retrieval
Read
May 28, 2026