Topic 2 of 20 · Part I : Shaping Model Behaviour

Retrieval-Augmented Generation

RAG changes model behaviour by changing the evidence placed in the model's context at answer time, rather than changing the weights.

The control pattern

Data asset

Retrieved knowledge

Knobs

Source hierarchy, Chunk size and overlap, Metadata, Freshness rules, Top-k and reranking, Citation threshold

Outcome

Grounded answers tied to current evidence

Measurement

See how to measure this below

What it is

RAG changes model behaviour by changing the evidence placed in the model's context at answer time. The data asset here is the retrieved knowledge, not the model weights.

Its knobs include how documents are divided, how much neighbouring text is preserved, which metadata is indexed, how many results are retrieved, whether results are reranked, and how aggressively stale or low-authority material is excluded. In financial analysis, source hierarchy matters especially: a filed financial statement should outrank a news recap for reported numbers, a transcript may be the best source for management tone, and a market feed may be required for current price information.

Chunk size should vary by content. Narrative sections can use moderate text windows, while tables and footnotes should be preserved as coherent units. Retrieval can then return a small evidence bundle rather than flooding the model with loosely related passages.

The knobs in detail

Each row is one adjustable property of the data asset, and what moving it tends to do.

KnobWhat you adjustLikely effect
Source hierarchyWhich document types outrank whichDecides what wins when sources disagree
Chunk size and overlapHow documents are divided and stitchedPreserves or destroys table and footnote meaning
MetadataWhat is indexed alongside the textEnables filtering before similarity is considered
Freshness rulesHow aggressively stale material is excludedControls answers built on outdated evidence
Top-k and rerankingHow many candidates, in what orderTrades recall against context noise
Citation thresholdHow much support a claim requiresDetermines when the system should decline

Applied: Stocks Assistant

For Stocks Assistant, every chunk should carry ticker, company identifier, document type, filing date, fiscal year, fiscal quarter, section, currency, units, source URL and an information-available timestamp. Those properties become retrieval knobs. A question about the latest gross-margin guidance should filter to the correct company, period and source type before semantic similarity is considered at all.

How to measure it

Evidence that the knob produced the intended behaviour, rather than shifting the problem elsewhere.

  • Recall at k : did the needed evidence appear in the candidate set?
  • Citation precision : did the model use the evidence correctly?
  • Freshness compliance against the availability timestamp
  • Answer faithfulness to the retrieved bundle
  • Percentage of numeric claims traceable to a source

Common mistakes

Measuring only the answer. Retrieval and generation fail differently and need separate metrics.

Filling a retrieval gap from memory instead of saying that current evidence is unavailable.