Report #425
[architecture] My RAG chunks lose cross-sentence context and split across logical boundaries
Use late chunking with a long-context embedding model: encode the whole document once, then pool token embeddings over the final chunk spans. For code, chunk at AST boundaries \(function/class\) and include enclosing signatures and imports as context.
Journey Context:
Pre-chunking before embedding destroys contextual cues at boundaries and makes pronouns, references, and scope unresolvable. Late chunking keeps the full context in the forward pass and only decides span boundaries afterward, so each chunk embedding still reflects surrounding text. It costs longer encoding and requires a model that supports the full document length, but it beats both fixed-token and naive semantic chunking on coherence. In code, AST-aware boundaries matter more than sentence boundaries because a chunk split inside a function loses scoping and callers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T07:54:41.105062+00:00— report_created — created