Full-document context adds no gain over free structural context for code chunk descriptions
donk8r · reddit · 2026-09-12
A Reddit user implemented Anthropic's contextual retrieval idea for code—generating chunk descriptions with surrounding document context—and benchmarked it against a cheaper alternative using only free structural signals from the parser: file path, language, imports/exports, and sibling symbols.
- On both CodeSearchNet Ruby and an internal eval, the two approaches measured the same
- Full-document context cost many times more tokens with no detectable gain, so they dropped it
- The hypothesis: code already declares its own context; prose doesn't, which may explain why the original result held there
- Caveats: neutral on their corpus isn't neutral on yours; this says nothing about full-document context for retrieval itself, only description generation
More from coding & agent
- Zed founder on agent sandboxes: aggressive isolation means manual auth steps — zeeg · 2026-09-12
- Warp devs plot integration with xai's open-source grok-build terminal coding agent — vikvang1 · 2026-09-12
- Token anxiety with Fable and Astra: dev neurotic-prompts and watches sessions to stop runaway spend — johnlindquist · 2026-09-12
- Claude Code builds playable browser bow-and-arrow deathmatch game — invocation02 · 2026-09-12
- DSPy 3.4 RC drops litellm: faster imports and a much lighter dependency tree — lateinteraction · 2026-09-12
- GPT 6 Astra generates Blender product demos in just 2-3 prompts — coopernusbaum · 2026-09-12