Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Databricks · Databricks Context Engineer Associate

Over- and Under-Retrieval of Memory, MLflow Runs

Databricks Context Engineer Associate · Lesson 12 of 18 · 1:23:18

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Databricks Certified Context Engineer Associate exam. In this lesson: over-retrieval (context pollution) and under-retrieval (missing history), the settings that balance them, resolving user intent before retrieval, and comparing context configurations across MLflow 3 runs. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Remembering everything, finding nothing

Thistledown's tenant agent now remembers everything, and that has become the problem. A question about a leaking tap brings back years of complaints, while a tenant's allergy to a cleaning product, given last month, is nowhere to be found. This lesson covers over and under retrieval, the settings that balance them, resolving intent before retrieval, and comparing configurations in MLflow.

Too much or too little

A memory system can fail in two directions. Over retrieval pulls in too many entries, or loosely related ones, and pollutes the context: old complaints, outdated preferences, and facts about other tasks distract the model, and can contradict the current request. Under retrieval misses relevant history, so the agent asks again for what it was told, or repeats a mistake it already made. Over retrieval shows as long contexts, answers that mention unrelated past events, and lower groundedness, while under retrieval shows as repeated questions, and lower sufficiency. The traces show exactly which memories were loaded for each answer, so look at them before you change any setting.

Tuning memory retrieval

Several settings move the balance between too much and too little. The number of results, and a minimum relevance score, decide how many entries reach the context. Path prefixes and session filters narrow the search to the right kind of memory, like preferences or past repairs. And a clear description on each entry helps the search find the right one, so the agent can ask for fewer results with confidence.

Resolving intent first

Some agents give accurate answers that miss the point: every fact is right, but it answers a different question. The cause is often a pipeline that retrieves with the raw user message, before it has understood what the user wants. Resolve the intent first: classify the request, rewrite it into a precise query, and pick out the entities it names, like the unit or the date. Only then retrieve, with the resolved intent choosing the source, the filters, and the query. Retrieval can only be as relevant as the question it is given.

Comparing configurations

To choose a context configuration, compare runs in an MLflow 3 experiment, all on the same evaluation dataset. Log each configuration as parameters, like the result limit, the filters, or static or dynamic loading, and let the same judges score every run. Prefer the configuration that scores well on every judge and stays stable across repeated runs, over one that wins a single metric, or a single run. Then open the traces of its failures, to check that the gain comes from better context, not from luck.

Recap

Let's recap. Over retrieval pollutes the context with unrelated memories, and under retrieval misses useful history. Traces show which memories were loaded, and judges show low groundedness or low sufficiency. Result limits, relevance thresholds, path filters, and clear descriptions set the balance. Resolve the user's intent before retrieval, so the right question drives it. And compare configurations in MLflow on the same dataset, preferring stable results across judges and runs.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. The tenant agent loads fifty memories for every question. Answers about a broken window now mention a noise complaint from two years ago and a parking request. What is happening, and what fits?

    • Under-retrieval: raise the result limit
    • Over-retrieval: lower the limit, add a relevance threshold
    • A model error: switch to a larger model
    • A stale store: resync the memory store
    Show the answer

    Over-retrieval: lower the limit, add a relevance threshold

    Fifty memories per question is over retrieval, so a lower limit and a relevance threshold keep only the entries that fit the question. “Under-retrieval: raise the result limit” is wrong, since a higher limit adds even more unrelated memories. “A model error: switch to a larger model” is wrong, since a larger model still receives the same polluted context. And “A stale store: resync the memory store” is wrong, since the memories are current, just irrelevant to the question.

  2. A tenant writes that the heating is out again, like last winter. The agent retrieves last winter’s repair, answers accurately about it, but books nothing. Where should the pipeline change?

    • After generation, with a longer answer
    • At indexing, with smaller chunks
    • Before retrieval, by resolving the intent
    • In the final formatting of the answer
    Show the answer

    Before retrieval, by resolving the intent

    Resolving the intent before retrieval would classify the message as a new repair request, and retrieve what a booking needs. “After generation, with a longer answer” is wrong, since a longer answer about the old repair still misses the request. “At indexing, with smaller chunks” is wrong, since chunk size does not change what the agent decided to look for. And “In the final formatting of the answer” is wrong, since formatting comes after the wrong context was already retrieved.

  3. Three memory configurations, three runs each, same dataset. First: best single run, sharp drops on the others. Second: good on every judge, every run. Third: best relevance, lowest groundedness. Which is the most reliable?

    • The second: good on every judge and every run
    • The first: it has the best single run
    • The third: relevance matters most
    • Whichever has the shortest contexts
    Show the answer

    The second: good on every judge and every run

    Consistent scores on every judge and in every run show a configuration you can trust in production. “The first: it has the best single run” is wrong, since one strong run followed by sharp drops shows instability. “The third: relevance matters most” is wrong, since high relevance with low groundedness still gives unsupported answers. And “Whichever has the shortest contexts” is wrong, since shorter contexts alone say nothing about the quality of the answers.