AWS Certified Machine Learning Engineer - Associate (MLA-C02) free question 10 / 10 · Domain 4: Operating, Monitoring, and Securing ML and AI Solutions
A RAG application retrieves the passage "London is the capital of UK. Tokyo is the capital of Japan", and a user asks for the capital of Japan. The model answers "The capital of Japan is London". How does a contextual grounding check evaluate this response?
- It is filtered by the content filters, which check the answer for factual errors
- It gets a low grounding score, as the answer is not supported by the retrieved passage
- It passes the two scores, as the answer repeats a word from the passage
- It gets a low relevance score, as the answer is not related to the question of the user
Show the answer and explanation
Answer: B
Why this is correct
Contextual grounding checks detect hallucinations when a reference source and a user query are provided, and they produce two scores. Grounding checks whether the response is factually accurate based on the source, and any new information that the response introduces counts as ungrounded. Relevance checks whether the response is relevant to the user query. In the example, "The capital of Japan is London" contradicts the source, so it is ungrounded, while it still answers the question that was asked. A grounded but irrelevant response would be "The capital of UK is London".
Why the other options are wrong
"It gets a low relevance score, as the answer is not related to the question of the user" … The answer addresses the question, so it is relevant. The problem is the grounding, because the response is not supported by the source. A response such as "The capital of UK is London" would be grounded but irrelevant.
"It passes the two scores, as the answer repeats a word from the passage" … The grounding check asks whether the response is factually accurate based on the source, and any new or contradicting information is considered ungrounded. A matching word does not make the response grounded.
"It is filtered by the content filters, which check the answer for factual errors" … Content filters detect harmful content in categories such as Hate, Insults, Sexual, Violence, Misconduct, and Prompt Attack. Detecting hallucinations is the job of contextual grounding checks.
Key points
You set a threshold for grounding and one for relevance between 0 and 0.99, and a response with a score below a threshold is detected as a hallucination and blocked. A threshold of 1 is invalid because it would block all content. If you do not specify a tier, the guardrail uses the Classic tier.