Memory Architecture with Lakebase and MLflow · Topic 3 of 3

Intent Resolution and Comparing Configurations in MLflow 3

Databricks Context Engineer: resolve user intent before retrieval to stop mismatched answers, and pick the most reliable context setup from MLflow 3 runs.

  • 5 min
In a nutshell
  • Accurate but mismatched answers point to retrieval running on an unresolved query.
  • Resolve intent (references, scope, task) before retrieval, using session and long-term memory.
  • Generation and post-processing are too late to fix context chosen for the wrong scope.

What it is

An answer can be factually correct and still wrong for the user: true for another product, region, plan or version. That is a contextually mismatched response, and it almost always means the retriever fetched context for the literal words instead of what the user meant.

The fix is an intent resolution stage before retrieval. The second half of this page is how you prove a context configuration is better: compare MLflow 3 runs on every metric and across repeated runs.

User messageIntent resolutionreferences, scope, taskRetrievalfiltered by resolved scopeContext assemblyGenerationResponse

How it works

Where intent is resolved

Each stage of an agent pipeline has a job. Intent has to be settled before retrieval, because retrieval is where the wrong context gets chosen.

StageJobWhat goes wrong if intent is not resolved yet
InputReceive the message and session stateNothing yet
Intent resolutionRewrite the query, resolve "it" and "that one" from session history, fix the scope (product, region, version, user role)This is the stage that must do it
RetrievalFetch documents, memories or rows for the resolved queryFetches accurate content for the wrong scope
Context assemblyOrder and trim what goes into the windowCan only arrange what was fetched
GenerationWrite the answerFaithfully answers from mismatched context
Post-processingFormat, guardrailsToo late to change the source

Worked case: a user discussing their EU account asks, "What is the refund window?" Without intent resolution the retriever finds the US policy, which is correct and well grounded, but wrong for this user. An intent stage turns the query into "refund window, EU consumer accounts" using session history and profile, and retrieval filters on region.

Prompting the generator to "consider the user's region" does not fix this. The model can only use the passages it was given, and none of them were EU passages.

Typical intent work:

  • Resolve references to earlier turns ("the second option", "that table").
  • Pull scope from session or long-term memory (region, product, plan, role).
  • Classify the task (lookup, comparison, action) to choose the retriever or tool.
  • Ask a clarifying question when the scope cannot be determined.

Comparing context configurations in MLflow 3

To choose between context setups (chunk size, number of documents, memory loading, a summary in the system prompt), run each one against the same evaluation set with mlflow.genai.evaluate(), one MLflow run per configuration, in one experiment.

import mlflow
from mlflow.genai.scorers import Correctness, RetrievalGroundedness
for name, app in configs.items():
    with mlflow.start_run(run_name=name):
        mlflow.genai.evaluate(data=eval_set, predict_fn=app,
                              scorers=[Correctness(), RetrievalGroundedness()])

Then compare the runs in the MLflow UI. The parallel coordinates chart shows each run as a line across every metric axis, so a configuration that stays high on all axes stands out, and one with a single low metric shows a dip.

What "most reliable" means

Reliable means two things: good on every metric the task cares about, and stable across repeated runs. A single best number, or the best average, can hide a weak metric or a lucky run.

Worked numbers, three repeats each, scores as fractions:

ConfigCorrectnessGroundednessRetrieval relevanceSpread across repeats
A0.910.620.88small
B0.860.840.85small
C0.940.850.83large (0.71 to 0.94 correctness)
D0.800.790.90small

A has the highest correctness but weak groundedness, so it is answering from model knowledge, not the context. C has the highest single values but swings widely between runs. B is the most reliable: high on all three metrics with low variance.

LLM judges and agents are not deterministic, so run each configuration more than once before drawing a conclusion from a small gap.

How the exam asks about this

  • "Answers are accurate and grounded but often describe the wrong product line the user is asking about." Add intent resolution before retrieval, then filter retrieval by the resolved scope.
  • "Pick the configuration that scores well on correctness, faithfulness and recall with none lagging." Compare runs on all metrics, for example with the parallel coordinates chart, not by mean or top value.
  • "One configuration won a single run by two points." Repeat the runs and check variance before choosing it.

What to remember for the exam

  • Accurate but mismatched answers point to retrieval running on an unresolved query.
  • Resolve intent (references, scope, task) before retrieval, using session and long-term memory.
  • Generation and post-processing are too late to fix context chosen for the wrong scope.
  • Compare configurations on the same evaluation set, one MLflow run each.
  • Most reliable means high on every relevant metric and stable across repeats.
  • The parallel coordinates chart shows which run stays high on every metric axis.
Watch out

Do not pick the configuration with the highest mean. A mean can hide one lagging metric, such as low groundedness behind high correctness.

Common mistakes

Fixing mismatch in the prompt. Telling the generator to respect the user's context cannot add passages that were never retrieved. Move the fix upstream to intent resolution.

Comparing runs on different data. Two configurations scored on different evaluation sets cannot be ranked. Hold the evaluation set fixed and change one context setting at a time.

Trusting a single run. A one-off peak may be noise from nondeterministic generation or judging. Repeated runs show which result holds.

Check yourself

  • An agent gives correct policy text, but for the wrong country. Which stage should change?

    The intent resolution stage before retrieval, so the query carries the user's country and retrieval filters to the right policy.

  • Why is the highest single metric value a poor way to choose a configuration?

    It can come from one lucky run and can hide another metric that lags, so reliability needs every metric and stable results across repeats.

  • What does the MLflow parallel coordinates chart help you see?

    How each run scores across all metric axes at once, so you can find the configuration that stays high on every metric.

Topic 3 of 3 in Memory Architecture with Lakebase and MLflow

Test yourself on Memory Architecture with Lakebase and MLflow

The full Databricks Context Engineer Associate question bank has 600 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Databricks. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.