feat(loop): groundedness spot-check for output validation - #217
Open
raymondginger2018-sudo wants to merge 1 commit into
Open
feat(loop): groundedness spot-check for output validation#217raymondginger2018-sudo wants to merge 1 commit into
raymondginger2018-sudo wants to merge 1 commit into
Conversation
Contributor
Author
设计说明问题:agent 输出容易"幻觉"——在冗长的 response 中,只有部分句子有代码执行/工具结果支撑,但整个输出看起来都很自信。现有的 LLM-as-Judge 自评不可靠。 解法:句子级别的 groundedness 抽查——从输出中逐句提取,每个句子检查是否有关联的 tool call 结果或代码引用作为证据。提供 关键设计决策:
边界情况:
测试建议:构造一组已知 grounded/ungrounded 的混合输出做端到端验证 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.