Abstract
Retrieval-Augmented Generation (RAG) is the standard technique for enabling Large Language Models (LLMs) to process documents exceeding their native context windows. However, traditional RAG relies on heuristic text chunking, which often destroys semantic coherence and splits critical information across boundaries. We introduce Landmark Embedding (LE), a chunking-free approach that maintains context continuity by using special <LMK> tokens to mark sentence boundaries within a unified encoding. By employing a position-aware training objective, LE significantly improves retrieval accuracy and downstream performance. Our results on the LongBench benchmark show that LE outperforms state-of-the-art retrievers like E5-Mistral, providing substantial gains for models such as LLaMA-2 and ChatGPT-3.5-Turbo while enhancing inference efficiency.
Introduction
Processing long-context documents typically involves slicing text into smaller, overlapping chunks (e.g., 200-word blocks). This "chunking strategy" is a fragile heuristic with two major flaws: it ignores surrounding context during encoding, leading to poor semantic representations, and it frequently splits critical information across boundaries. If a retriever only selects one partial chunk, the LLM receives an incomplete picture, limiting the potential of RAG for complex long-context modeling.
Methodology
Landmark Embedding moves away from isolated chunks toward a unified, context-aware encoding system.
Chunking-Free Architecture
Instead of physical slicing, LE inserts a special landmark token (<LMK>) at the end of every sentence. The entire document (or a large sliding window) is fed into an LLM-based encoder, such as LLaMA-2-7B. The embedding for each sentence is derived from its corresponding <LMK> token. This architecture ensures that every sentence embedding "sees" the preceding context, capturing nuances lost in traditional chunking.
Position-Aware Objective
Information in long documents is often spread across consecutive sentences. LE utilizes a novel loss function with exponential weighting to prioritize the "ultimate boundary"—the final sentence of a relevant information span. This trains the retriever to identify the exact point where a complete piece of information concludes, ensuring the retrieval of the entire necessary context.
Evaluation and Results
LE was evaluated using the LongBench benchmark, focusing on single-doc and multi-doc QA tasks.
- Performance: LE improved LLaMA-2-7B's average score across LongBench tasks by +8.8 points compared to no retrieval.
- State-of-the-Art Comparison: It consistently outperformed top-tier retrievers like E5-Mistral and BGE-v1.5-large.
- Efficiency: The method achieved these gains using significantly fewer input tokens (approx. 2,190) compared to the 15,500 tokens required for full-context processing in ChatGPT-3.5-Turbo, leading to higher inference efficiency.
- Needle in a Haystack: In tests hiding specific facts within 30K tokens, LE maintained high retrieval accuracy, whereas full-attention models often suffered performance degradation as the target information moved deeper into the document.
Discussion and Conclusion
Landmark Embedding demonstrates that contextualized embeddings are superior to isolated ones for long-document retrieval. By focusing on the "ultimate boundary" of information spans, the system reliably retrieves complete contexts. While the current study used a 7B parameter backbone, scaling to larger encoders and exploring multi-source environments remain promising avenues for future research. LE proves that even for models with large context windows, precise retrieval can offer better performance and efficiency than processing the entire context directly.
Summary updated