You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a pure-mechanism groundedness spot-check — verifies that a model's final answer follows from the supplied evidence, without needing an LLM judge by default.
This addresses two GenAI lessons:
Lesson 13: output validation is one of the four security-testing methods
Lesson 14: Honesty/groundedness metric — "does the answer follow from the supplied evidence?"
How it works
Split the final answer into sentences
For each sentence that makes an evidential claim, verify it is supported by the retrieved/injected evidence text
Scoring (no LLM): a sentence is supported when a substantial fraction of its content tokens appear in the evidence
Optional judge_fn hook allows an LLM-as-judge for paraphrase-tolerant judgement — but the module stays mechanism-only by default
Design
Spot-check, not always-on: run on a sample or critical decisions, never on every turn (cost control)
Pure mechanism: stdlib only, no I/O, no network, no model calls
Composable: judge_fn is an optional callable, making it testable and deployment-adaptable
File
core/loop/groundedness.py (new, 218 lines)
Part of the GenAI lessons security/quality module family.
Thank you for the submission, @raymondginger2018-sudo. Closing because the mechanism does not fit how this agent verifies its work: core/verification.py and the goal runtime establish groundedness by running commands and tests, and a lexical token-overlap score gives no signal on code-shaped output — a paraphrase is judged unsupported while a correct numeric claim is only accepted by coincidence. There is also no caller for the module. If you want to pursue output validation here, the place with real leverage is the verification runner (evidence = command output), and we would be glad to review a change there with tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a pure-mechanism groundedness spot-check — verifies that a model's final answer follows from the supplied evidence, without needing an LLM judge by default.
This addresses two GenAI lessons:
How it works
supportedwhen a substantial fraction of its content tokens appear in the evidencejudge_fnhook allows an LLM-as-judge for paraphrase-tolerant judgement — but the module stays mechanism-only by defaultDesign
judge_fnis an optional callable, making it testable and deployment-adaptableFile
core/loop/groundedness.py(new, 218 lines)Part of the GenAI lessons security/quality module family.