Skip to content
AI Engineer Guide.
seniorReportedcurated

Page 1 of a financial report says "all amounts in thousands". How do you stop chunks from losing that document-wide context?

30-second answer

Likely follow-ups

Open a question to rehearse the answer.

Do you embed the contextual header, prepend it only to the chunk body, or both, and why?
  • Embed the header with the chunk text so document-level terms can retrieve it, and keep the original text for citation.
  • Prepending only to the body changes what the model reads but not what the vector represents, which leaves retrieval unchanged.
  • If you do both, check that the header does not dominate the vector and turn every chunk of a document into a near-duplicate.
When every chunk in a document shares the same boilerplate header, how do you stop it hurting discrimination?
  • Measure pairwise similarity within one document before and after contextualisation, which collapses when the frame outweighs the text.
  • Keep the header to one sentence naming the specific entity or section, not a generic restatement of the document title.
  • Apply context where chunks are short and ambiguous, which is where it earns its ingest cost.
How do you propagate a mid-document unit change, like an appendix that switches to millions?
  • Extract units per section at parse time and attach them to the chunk, so an appendix in millions carries its own scale.
  • Where the unit is only stated in prose, have the contextual summary quote the sentence that changes it.
  • Test with a question whose answer spans the change, since that is the case a document-level default silently gets wrong.

Red flags

  • bigger chunks
  • units only in prompt template

Concepts this tests

Tags

Source: adilshamim8.medium.com

More in Data & storage