CertSafari
    Databricks Certified Context Engineer Associate· Lessons

    Domain 3 · Lesson 19/45

    Diagnosing retrieval failures with MLflow judges and Unity Catalog metadata

    Identify which retrieval failure mode is occurring by using MLflow eval logs and UC metadata, and select the Unity Catalog governance action that most directly resolves the failure.

    17 min read
    2.22% of exam
    13 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Decide from MLflow eval logs whether a bad answer is a retrieval failure or a generation failure
    • Map low RetrievalRelevance, RetrievalSufficiency and RetrievalGroundedness scores to the retrieval failure mode each one signals
    • Use Unity Catalog grants, row filters, column masks, tags and lineage to confirm or rule out a governance cause
    • Select the single action that most directly resolves a diagnosed retrieval failure, and reject actions aimed at the wrong failure mode

    Key concept

    Retrieval failure vs generation failure — A wrong answer from a RAG agent comes either from the context it was given (retrieval) or from what the model did with good context (generation). Decide which one it is before you change anything. Governance and index actions can only fix the first.

    1.Did retrieval fail, or generation?

    Every RAG quality problem falls on one side of a line. Retrieval quality asks whether the agent fetched the most relevant information for the query; generation quality asks whether the model, given that information, wrote an accurate answer. A legal agent that misquotes a clause it was handed has failed at generation. One that never received the clause has failed at retrieval. The user sees the same wrong answer either way, and the fixes are opposite.

    Most Unity Catalog levers act on retrieval only. A grant, a row filter, a certification tag or an index sync changes what reaches the context window; none of them changes how the model reasons over context it already has. When the right chunks arrived and the answer is still wrong, the fix belongs in the prompt or the chain.

    The line is not always clean, though. Retrieval quality depends on the data pipeline, through choices such as parsing, chunking and metadata, as well as on the query the chain sends. So a retrieval failure can come from governance (the agent can't reach the content), from freshness (the index doesn't hold it yet), or from the pipeline (the content is indexed in a form the search can't find). Telling these apart takes evidence, and the MLflow eval logs are where that evidence starts.

    mlflow.genai.evaluate() runs the agent on an evaluation dataset, applies scorers to each resulting trace and stores the results in the active experiment. Each scorer parses the trace, assesses one quality dimension and attaches its verdict to the trace as feedback. That per-trace feedback is what you read when you diagnose.

    Checkpoint 1 of 7· Check yourself

    An MLflow trace for a legal RAG agent shows that the retriever returned the correct contract clause. The agent's answer still misquotes that clause. Which diagnosis and fix fit this evidence?

    Sources123

    2.Reading MLflow retrieval judges as failure-mode signals

    Three built-in judges each look at a different relationship between query, retrieved context and answer. RetrievalRelevance asks whether the retrieved context is relevant to the request. RetrievalSufficiency asks whether that context holds everything needed to produce the ground-truth facts, so it needs expectations in the dataset. RetrievalGroundedness asks whether the response sticks to the context or hallucinates beyond it. The judges define only what each one asks. The failure modes in the last column below are diagnostic heuristics, so confirm them against the trace.

    What each built-in retrieval judge checks, and what a low score usually points to
    JudgeNeeds ground truthWhat it evaluatesA low score usually points to
    RetrievalRelevanceNoIs the retrieved context directly relevant to the user's request?Off-topic chunks: poor precision, missing filters, or an embedding model that matches on generic words
    RetrievalSufficiencyYesDoes the context provide all necessary information to generate a response that includes the ground truth facts?Under-retrieval: the needed fact is absent from the retrieved chunks
    RetrievalGroundednessNoIs the response grounded in the information provided in the context?Generation failure: the model is answering beyond its context

    High relevance with low sufficiency usually signals under-retrieval. The chunks are about the right contract, so relevance passes, but the one clause the answer depends on is missing from them. Two causes fit. A chunk boundary may have split the clause away from the heading or terms the query matches, or the index may lag its source and never have held the clause. An index that exists can still be stale, so check how it syncs before blaming chunking. Over-retrieval would more likely show up as lower relevance.

    Low relevance on narrow questions points at precision. If a question about parental leave returns Finance and Legal chunks next to the right HR chunk, the search space is too wide for the query. If the off-topic chunks share only generic words with the query, such as service or restart, suspect the embedding model. It is not capturing what the domain text means.

    Low groundedness with good relevance and sufficiency usually means the model went beyond context that held everything it needed. That sends you back to the first question, and a catalog change does not touch it.

    The ranking metrics from AI Search built-in retrieval quality evaluation sharpen this picture. That evaluation has an LLM judge grade each retrieved result from 0 to 3: a 3 is a direct answer, a 2 is useful, and a 0 or 1 is not useful. Averages can hide a split. A bimodal distribution, with many 3s and many 0s, suggests one query pattern is being retrieved badly. When that pattern is "anything published recently" or "anything a certain group asks", check freshness and access before you tune search settings.

    Checkpoint 2 of 7· Check yourself

    A retrieval quality evaluation gives a middling average relevance score. The distribution is split: many results score 3 and many score 0. Nearly all the 0s come from questions about policies published in the last month. What should you conclude, and what should you check first?

    Checkpoint 3 of 7· Exam question

    MLflow eval logs for a legal-research agent show high context relevance scores (retrieved chunks are on-topic) but low answer correctness, with the LLM judge repeatedly noting that a specific clause needed to answer the question is absent from any retrieved chunk even though it exists in the source contract. UC metadata confirms the contract document was indexed successfully. Which retrieval failure mode does this pattern indicate?

    Sources456

    3.Confirming a governance cause with UC metadata

    Eval scores tell you what failed. Unity Catalog metadata tells you whether governance caused it. The test is simple: governance causes can be fixed with a grant, a policy or a tag, and non-governance causes can't, however many grants you add. Four checks settle the question, and the first three read Unity Catalog metadata.

    Grants. Unity Catalog controls access by granting privileges on securable objects in the catalog.schema.table hierarchy. Every privilege must be granted explicitly, and reading data needs a full chain: USE CATALOG on the catalog, USE SCHEMA on the schema, and SELECT on the table or view. A retriever that errors or returns nothing for every query, while the same query works for an admin, is usually missing one link in that chain. Following UC privileges as the agent's retrieval boundary, find the missing link and grant exactly that.

    Row filters and column masks. ABAC policies, driven by governed tags, apply row filter and column mask policies to tables. A policy attached at a catalog, schema or table takes effect on every matching table beneath it. Holding READ METADATA on an object lets you see its permissions, row filters, column masks and ABAC policies without reading its data. That is exactly the view you need to check whether a policy is silently removing rows from one principal's results. If it is, edit the policy so the rows the agent needs pass its condition; row filter and column mask policies can be created, edited, viewed and deleted in Catalog Explorer, SQL or the REST API. The reverse problem has the same tool. If the retriever surfaces rows or fields a user should not see, the governance fix is an ABAC row filter or column mask, not a prompt instruction.

    Tags. The system.certification_status system tag marks assets certified or deprecated. When an agent's answers quote a superseded summary table, a deprecated tag on its source confirms that the retrieval space includes an asset nobody should rely on. The fix is to tag the authoritative table certified and the old one deprecated, then take the old table out of what the agent retrieves from: revoke the agent's access to it, or leave it out of the source table the index syncs from. Applying the tag takes the ASSIGN permission on the governed tag, plus APPLY TAG on the object and USE SCHEMA and USE CATALOG on its parents, and the status can be updated or removed at any time. Treat the tag as the signal and the grant or source change as the enforcement.

    Index sync mode. A Delta Sync index updates from its source table, but a Triggered index updates only when someone starts a sync through the Python SDK or REST API, while a Continuous index keeps up within seconds. If recent content is missing for every user while older content returns fine, check the sync mode of the index built by the RAG data pipeline from a UC corpus to an AI Search index. A Triggered index that nobody has synced since the source changed is a freshness problem, not an access problem. Starting a sync is the direct fix, and it is a pipeline action rather than a governance one. When access and freshness both check out, the cause sits in parsing, chunking or embeddings, and no governance action applies.

    Checkpoint 4 of 7· Match them up

    Each symptom below has been traced to retrieval. Match each one to the check that confirms or rules out a governance cause.

    Tap a term, then the definition that fits it.

    Sources789106

    4.Choosing the action that most directly resolves the failure

    After diagnosis, choose the action that acts on the failure mode itself. The first four rows below are governance actions: they change what the agent is allowed or told to reach. The last four change how the index is built or queried. Distractor answers are usually real techniques aimed at the wrong one of these.

    Failure mode, evidence and direct remediation
    Failure modeEvidence in eval logs and UC metadataMost direct actionGovernance action?
    Privilege chain gapRetrieval errors for the agent's principal only; a USE CATALOG, USE SCHEMA or SELECT grant missingGrant the missing privilegeYes
    Over-exposureRetrieved content includes rows or fields the user should not seeAdd a row filter or column mask policyYes
    Row filter hides needed rowsOne principal's results lack rows others get; READ METADATA shows a row filter policy excluding themEdit the policy so those rows pass its conditionYes
    Deprecated asset in the retrieval spaceAnswers quote a superseded table tagged deprecatedCertify the authoritative table, deprecate the old one, and remove it from what the agent retrieves fromYes
    Low precision across domainsUnrelated departments' chunks in top-k; a populated department column exists and is among the indexed columnsMetadata filter on that column at query timeNo
    Stale indexRecent content missing; Triggered index not synced since the source changedStart a sync of the indexNo
    Chunk-boundary under-retrievalHigh relevance, low sufficiency; document indexed and currentRe-chunk so the needed passage stays wholeNo
    Embedding model mismatchTop-k matches on generic words; a stronger model ranks the same chunks betterServe a better-suited embedding model and rebuild the indexNo

    Mixed-department results call for a metadata filter. When top-k results mix HR, Finance and Legal chunks, the search space is too wide, and a filter on a department column scopes it before ranking. The AI Search guide calls filtering the biggest lever for retrieval quality. It works only on columns that were indexed, because only indexed columns can be returned in results or used as filters; check the index's columns to index before relying on it. Storing metadata next to the embeddings in the same Delta table is what makes the filtering efficient. Four fixes compete for this symptom: a filter, raising num_results, larger chunks, and pure keyword search. Only the filter acts on the cause. Raising num_results adds more of the wrong departments. Larger chunks pull more unrelated text into each result. Pure keyword search drops the semantic matching that hybrid search adds.

    Scoping an AI Search query with a metadata filter before rankingpython
    # AI Search with metadata filtering
    results = index.similarity_search(
        query_text="brake system maintenance",
        filters='make = "Toyota" AND model = "Camry" AND year = 2023',
        num_results=10
    )

    Embedding mismatch is a pipeline fix, not an access-control one. When chunking and ingestion are sound but top-k matches only generic words, the model is not capturing the domain's language. For domain-specific language, fine-tune an embedding model on domain data, or serve a better-suited model through a model serving endpoint, then rebuild the index on it. Registered models are a type of function in Unity Catalog, so access to them is granted with privileges such as EXECUTE, but choosing a better model is not an access-control action. Lowering chunk overlap, cutting num_results or adding a row filter changes nothing about how the text is embedded.

    Checkpoint 5 of 7· Check yourself

    An agent's retrieval results for one principal consistently lack rows that other principals get for the same query. READ METADATA on the source table shows an ABAC row filter policy whose condition excludes that principal's region. Which action most directly resolves it?

    Checkpoint 6 of 7· Exam question

    An internal-policy chatbot uses AI Search over a single index containing HR, Finance, and Legal documents with no metadata columns. MLflow eval logs show low precision scores: for narrow questions like "What is the parental leave policy?" the top-k results mix in unrelated Finance and Legal chunks alongside the correct HR chunk, pushing relevant content lower in the ranking. UC metadata shows the source Delta table does have department populated for every row. Which action most directly resolves this failure mode?

    Checkpoint 7 of 7· Exam question

    A newly launched AI Search agent over engineering runbooks shows poor relevance scores in MLflow eval. Debugging the raw retrieval traces reveals that the top-ranked chunks for a query like "restart the ingestion service" include chunks about unrelated topics that happen to share generic words like "service" and "restart," while a side-by-side test with a stronger third-party embedding model on the same chunks returns noticeably more relevant top-k results for the same queries. UC lineage confirms chunking, ingestion, and metadata are all otherwise correctly configured. Which failure mode and Unity Catalog-governed remediation path best fits this evidence?

    Sources11612813

    Sources

    (13)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Retrieval quality: Are you retrieving the most relevant information for a given retrieval query?”
      ↩︎ Did retrieval fail, or generation?
      “Retrieval quality can be influenced by both the data pipeline (for example, parsing/chunking strategy, metadata”
      ↩︎ Did retrieval fail, or generation?
      “Given the retrieved information and the original user query, is the LLM generating the most accurate, coherent, and helpful response possible?”
      ↩︎ Key concept
    2. 2.
      “Stores results as traces with scorer feedback in the active MLflow experiment.”
      ↩︎ Did retrieval fail, or generation?
    3. 3.
      “Returns the quality assessment as Feedback to attach to the trace”
      ↩︎ Did retrieval fail, or generation?
    4. 4.
      “Is the retrieved context directly relevant to the user's request?”
      ↩︎ Reading MLflow retrieval judges as failure-mode signals
      “Is the response grounded in the information provided in the context? Is the agent hallucinating?”
      ↩︎ Reading MLflow retrieval judges as failure-mode signals
      “Does the context provide all necessary information to generate a response that includes the ground truth facts?”
      ↩︎ Exam trap 1
    5. 5.
      “a bimodal distribution (many 3s and many 0s) might suggest that a query pattern isn't being retrieved well and needs attention.”
      ↩︎ Reading MLflow retrieval judges as failure-mode signals
      “Highly Relevant %: Results scoring 3 (direct answers).”
      ↩︎ Reading MLflow retrieval judges as failure-mode signals
    6. 6.
      “With Triggered sync mode, you use the Python SDK or the REST API to start the sync.”
      ↩︎ Reading MLflow retrieval judges as failure-mode signals
      “With Triggered sync mode, you use the Python SDK or the REST API to start the sync.”
      ↩︎ Confirming a governance cause with UC metadata
      “Only indexed columns can be returned in search results or used as filters.”
      ↩︎ Choosing the action that most directly resolves the failure
      “create a model serving endpoint to serve the embedding model of your choice”
      ↩︎ Choosing the action that most directly resolves the failure
    7. 7.
      “A user or group must be explicitly granted a privilege to perform an action.”
      ↩︎ Confirming a governance cause with UC metadata
      “Access control in Unity Catalog works by granting privileges, such as SELECT, MODIFY, or USE SCHEMA, on these securable objects.”
      ↩︎ Confirming a governance cause with UC metadata
      “Having only the SELECT privilege on a table is not sufficient to read it if you lack USE CATALOG or USE SCHEMA”
      ↩︎ Exam trap 2
      “Access control in Unity Catalog works by granting privileges, such as SELECT, MODIFY, or USE SCHEMA, on these securable objects.”
      ↩︎ Checkpoint
    8. 8.
      “View all owner-visible metadata for an object, including permissions, row filters, column masks, and ABAC policies”
      ↩︎ Confirming a governance cause with UC metadata
      “Registered models are a type of function.”
      ↩︎ Choosing the action that most directly resolves the failure
      “Invoke a function or load a registered model for inference.”
      ↩︎ Choosing the action that most directly resolves the failure
      “Insert, update, and delete data in a table.”
      ↩︎ Exam trap 4
      “including permissions, row filters, column masks, and ABAC policies, without the ability to modify it or read its data”
      ↩︎ Checkpoint
    9. 9.
      “ABAC supports row and column-level security through row filter policies and column mask policies on tables.”
      ↩︎ Confirming a governance cause with UC metadata
      “How to create, edit, view, and delete row filter and column mask policies using Catalog Explorer, SQL, and REST APIs.”
      ↩︎ Confirming a governance cause with UC metadata
      “How to create, edit, view, and delete row filter and column mask policies using Catalog Explorer, SQL, and REST APIs.”
      ↩︎ Checkpoint
    10. 10.
      “deprecated: Warns that a data asset is outdated, no longer reliable, or should not be used in new workflows.”
      ↩︎ Confirming a governance cause with UC metadata
      “You can update or remove the status at any time.”
      ↩︎ Confirming a governance cause with UC metadata
      “deprecated: Warns that a data asset is outdated, no longer reliable, or should not be used in new workflows.”
      ↩︎ Prediction
    11. 11.
      “Dramatically improves precision by eliminating irrelevant results.”
      ↩︎ Choosing the action that most directly resolves the failure
      “This is your biggest lever for retrieval quality.”
      ↩︎ Choosing the action that most directly resolves the failure
      “Improves recall by catching both semantic and keyword matches.”
      ↩︎ Choosing the action that most directly resolves the failure
      “Filtering dramatically reduces search space and improves both precision and recall.”
      ↩︎ Exam trap 3
    12. 12.
      “Storing metadata alongside embeddings in the same Delta table enables efficient filtering during retrieval.”
      ↩︎ Choosing the action that most directly resolves the failure
      “consider fine-tuning the embedding model on domain-specific data”
      ↩︎ Choosing the action that most directly resolves the failure

    Ready to test yourself?

    Practise Databricks Certified Context Engineer Associate in quiz mode.

    Spotted a mistake, or was something unclear? Tell us.