Document embeddings represent larger text — paragraphs, sections, or whole documents — as a single vector. They capture the overall topic and gist of content, trading granularity for breadth compared to sentence embeddings.
Most embedding models accept 512–8192 tokens. A research paper may be 10,000 tokens. A book chapter may be 50,000. Content exceeding the model's limit cannot be embedded in a single pass — it must be chunked first.
Preserve surrounding context. A claim or detail retains its surrounding sentences for meaning.
Dilute relevance — a chunk covering multiple topics produces a vector that is average across all of them and may not score highly for any specific query.
More precise — each vector corresponds to a narrow, specific piece of information. Better for retrieval tasks.
Lose context — a standalone sentence may be ambiguous without the surrounding paragraph.
Mean pooling creates a document-level embedding by averaging the vectors of all its chunks. The result represents the overall topic distribution of the document.
Mean pooling is useful for document-level similarity tasks (which document is most relevant?) but less useful for precise retrieval tasks (which specific passage answers this question?).
Document-level pass — Use mean-pooled document embeddings to identify the top N most relevant documents to the query.
Chunk-level pass — Within those top N documents, search at the chunk level to find the specific passage that answers the query.
This two-stage approach combines the efficiency of document filtering with the precision of chunk-level retrieval.
Ask the AI assistant about document embeddings, chunking strategies, or hierarchical retrieval.