Use groundedness to test whether a finding survives patching, identifier renaming, and safe look-alikes, but do not treat that as a substitute for recall. A grounded system can still miss most defects, so teams need separate measurements for reasoning quality and vulnerability coverage.
What groundedness is actually testing in AI-assisted code review
Groundedness is a consistency check, not a quality guarantee. In code review, it asks whether the model’s finding still holds after you perturb the surface form of the code, for example by renaming identifiers, changing formatting, or replacing an exact match with a safe look-alike. That helps distinguish a real defect signal from a brittle pattern match.
The practical value is that groundedness probes whether the reviewer is anchored to semantics, control flow, data flow, or insecure behaviour rather than to memorised names or superficial cues. A grounded finding should survive harmless rewrites; if it disappears when the code is renumbered or renamed, the finding may be more about lexical similarity than actual risk.
For teams building review workflows, this means groundedness is best treated as an internal robustness check on a single finding, not as a statement about the overall review system. A reviewer can be well grounded on one issue and still be blind to another defect that never entered the candidate set.
Why groundedness and recall must be measured separately
Groundedness and recall answer different questions. Groundedness asks whether an individual finding is stable under benign changes. Recall asks how many real defects the system finds in the first place. If you only measure groundedness, you can end up preferring a model that is confidently consistent but consistently incomplete.
That distinction matters because code review failures are often asymmetric. A tool can produce few false alarms and still miss the defect class that matters most, especially when the bug requires broader context, cross-file reasoning, or domain knowledge. Good-looking stability scores can therefore hide a weak detection ceiling.
Security teams should evaluate both dimensions with separate test sets and separate pass criteria. Use groundedness to assess brittleness and susceptibility to superficial perturbation, then use defect coverage or recall-oriented review benchmarks to determine whether the system is actually finding enough issues to be operationally useful.
How to evaluate groundedness without confusing it with precision
A useful groundedness evaluation starts with a seed finding, then applies controlled transformations that should not change the conclusion. Typical checks include variable renaming, harmless refactoring, formatting changes, and substitution with semantically equivalent constructs. The question is whether the model still identifies the same vulnerability mechanism after those changes.
Teams should also include safe look-alikes, because they reveal whether the system is overfitting to a visual cue. If the model flags a benign variant just because it resembles a known bad pattern, that is a sign of shallow pattern association rather than durable reasoning.
It helps to score groundedness against evidence quality, not just verdict stability. A finding that persists across variations but cannot point to the actual risky behaviour is not very useful operationally. AI Coding Agents Security Guide is useful here because it frames code-focused AI security around secrets in context, over-scoped tokens, and safe sandboxing, which are the kinds of mechanisms grounded evaluations should be able to recognize consistently.
Risk and Threat Considerations
Groundedness failures create two different kinds of exposure: false confidence in brittle findings and false confidence in an incomplete review surface. In a security workflow, that can let a model appear reliable while still missing defects that matter most, especially when the defect is not obvious from surface syntax alone.
Failure mechanism: The reviewer overweights lexical similarity or superficial code shape, so the finding survives harmless rewrites but does not generalize to semantically equivalent vulnerable code, or the reverse, where it misses the same defect expressed differently.
Impact: Teams may ship with an inflated sense of review quality, under-invest in manual escalation for hard cases, and miss vulnerabilities that only appear after refactoring, abstraction, or identifier changes.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP ASVS and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V15 — Secure Coding and Architecture | AI-assisted code review evaluates whether code defects are real and structurally grounded. |
| Recommendation — Review findings against secure design and code-structure expectations, not just pattern matches. | ||
| NIST SP 800-53 Rev 5 | RA-5 — Vulnerability Monitoring and Scanning | Groundedness evaluation supports defect detection quality and coverage in review pipelines. |
| AU-6 — Audit Review, Analysis, and Reporting | Separate measurement of groundedness and recall supports trustworthy analysis of review outputs. | |
| Recommendation — Validate that scanners and reviewers detect real defects across variant code forms. Analyze review results for signal quality and missed defects before trusting conclusions. | ||
Practitioner Guidance
What to measure: Track groundedness as a stability score on paired or perturbed examples, and track recall separately on a labelled defect set. Do not collapse them into a single “review quality” metric, because that hides whether the system is reasoning well or simply casting a wide net.
What good looks like: A grounded finding remains anchored to the same vulnerability mechanism across benign rewrites, while recall stays high enough that the system is still useful as a detector rather than only a consistency checker. If either side is weak, treat the model as decision support, not as a reviewer of record.
Practitioner takeaway: Groundedness tells you whether the model is stable under harmless variation; recall tells you whether it is covering enough defects to matter. Evaluate both, or you will confuse consistency with security value.
Related resources from NHI Mgmt Group
- How should security teams evaluate whether an AI-assisted code review workflow is actually improving review quality?
- How should security teams use AI-assisted code review safely?
- How do security teams evaluate whether an AI code review benchmark is actually useful?
- How should security teams evaluate AI-assisted code security when business logic flaws matter more than syntax matches?