Repository navigation
feat(novelty): prototype false-claims checks against documented atoms - #1130
Conversation
…t documented atoms (prototype) Offline prototype in dokimi/novelty/false_claims.py: pairs each answer sentence with atoms lexically, flags value/polarity conflicts, or uses an injected judge whose contradiction quote must be verbatim. Not wired into any command. Design note in docs/proposals/false-claims.md. Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
…es not pair with every sentence naming the product Found in self-review: the Windows-polarity atom paired with the driver sentence on the single shared word 'accelerator' and raised a false polarity flag. The test now asserts the exact claim set. Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1130 +/- ##
==========================================
+ Coverage 96.14% 96.18% +0.04%
==========================================
Files 498 500 +2
Lines 66028 66828 +800
Branches 11461 11619 +158
==========================================
+ Hits 63482 64281 +799
+ Misses 1574 1569 -5
- Partials 972 978 +6
🚀 New features to boost your workflow:
|
|
OpenCodeReview: Commit ff76711 was not reviewed. This PR has reached its review limit (6 reviews). CI at `ff76711`: 6 still running, 9 passing, 3 skipped
To review this commit: re-request review from exai-bot in the Reviewers list. Last review (1542126): 1 mediumOpen threads from the bot: 0 |
vchamarthi
left a comment
There was a problem hiding this comment.
@napetrov, could you fix the problem I found and the 3 small things I've marked fix before merge (in the line comments) and fix what the bot's thread on dokimi/dokimi/novelty/false_claims.py:139 and the bot's thread on dokimi/dokimi/novelty/false_claims.py:157 still point out? Then push and I'll take another look.
What I checked on 561b62e:
- Not passing: When I broke the changed code on purpose, the tests missed 2 of 12 breakages.
- The 6 changed tests pass, and fail on main as expected.
- The full test suite passes with main merged in (28,457 tests), apart from failures main has too.
- It merges cleanly onto main.
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
🟡 Changes needed · reviewed 561b62e
To fix: the design note should move out of the tree, as AGENTS.md asks (line comment). Also answer the @exai-bot and @vchamarthi threads below.
✅ make ci-local --offline: tests, mutation run and coverage (96% of changed lines) pass · schema_compat fails from the base (arms/matrix_rollup schemas), not from this PR · ✅ merges cleanly into main
A careful offline prototype: unpaired sentences stay unchecked and judge failures are counted, never read as clean.
Agreed with @exai-bot: a sentence-final identifier and a bare flag do not pair, so the sentence is left unchecked (both reproduced).
Agreed with @vchamarthi: -1 read as 1; the quote is the first number; v2.1 vs 2.1; and 1 more.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g867vRFe Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g867vRFj Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g867yblu Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g867ybl2 Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g867ybmG Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g867ybmL Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g8677vPt Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g8677vPh Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
|
Re: review by vlad-perevezentsev
|
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868FFzy Thread: PRRT_kwDOVBg7g868FFz2 Thread: PRRT_kwDOVBg7g868FFz9 Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868FFzy Thread: PRRT_kwDOVBg7g868FFz2 Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868FFzy Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868F5kA Thread: PRRT_kwDOVBg7g868F5kG Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868F5kA Thread: PRRT_kwDOVBg7g868F5kG Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868F5kA Thread: PRRT_kwDOVBg7g868F5kG Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
vchamarthi
left a comment
There was a problem hiding this comment.
@napetrov, could you fix the 6 small things I've marked fix before merge (in the line comments) and answer my question below? I'll approve once that's done.
I'll approve once that's done.
My question before I approve:
- The PR title starts with
docs(proposals):, but the diff now adds code, tests and a changelog fragment, and the design note has been moved out of the tree. Retitle the PR, or say in the description why thedocs(proposals)prefix stays.
What I checked on abd35f6:
- When I broke the changed code on purpose, the tests missed 1 of 12 breakages.
- The 26 changed tests pass, and fail on main as expected.
- The full test suite passes with main merged in (29,968 tests), apart from failures main has too.
- It merges cleanly onto main.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868OxLd Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868OxLj Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868OxLq Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868OxLy Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868OxL5 Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868OxL- Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRR_kwDOVBg7g88AAAABab4DoA Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
|
All six inline items are addressed, and the new title describes the library prototype. |
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868hZJA Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868hZJF Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
vchamarthi
left a comment
There was a problem hiding this comment.
@napetrov, could you fix the new problem I found (in the line comments)? Then push and I'll take another look.
What I checked on 1542126:
- When I changed the code on purpose, the tests still passed for 1 of 12 changes, and no test pins this one down yet (non-blocking):
dokimi/dokimi/novelty/false_claims.py:298(the handled error is raised again). - The 39 changed tests pass, and fail on main as expected.
- The full test suite passes with main merged in (30,673 tests), apart from failures main has too.
- It merges cleanly onto main.
| r"\b(not|never|no|cannot|can't|don't|doesn't|isn't|unsupported|deprecated|without)\b", re.I) | ||
| # Closing quotes belong to the sentence. Internal dots in versions and identifiers do not end it. | ||
| _SENTENCE = re.compile( | ||
| r"[^\r\n]+?(?:(?:(?<!(?i:e\.g|i\.e))\.|[!?])[\"'”’»›]*(?=\s|$)|(?=[\r\n]|$))", re.M, |
There was a problem hiding this comment.
Must fix (blocking): A sentence that ends in a period followed by closing bold markers is not split, so its claim and the next sentence's negation are lost.
Input: the answer **The accelerator is supported on Windows.** The accelerator is not supported on Linux. and the atom The accelerator is not supported on Windows. On the latest commit the answer is one sentence and there are no claims, because the period is followed by **, which is not whitespace or the end, so the boundary is not taken.
Got: The not in the second half then cancels the polarity conflict.
I tested this suggestion: it fixes the problem, and the tests still pass.
| r"[^\r\n]+?(?:(?:(?<!(?i:e\.g|i\.e))\.|[!?])[\"'”’»›]*(?=\s|$)|(?=[\r\n]|$))", re.M, | |
| r"[^\r\n]+?(?:(?:(?<!(?i:e\.g|i\.e))\.|[!?])[\"'”’»›*_]*(?=\s|$)|(?=[\r\n]|$))", re.M, |
Details
I'd expect two sentences and one claim quoting the bold sentence.
A bold or italic sentence (**...**, __...__, *...*) was merged with the next one, so its claim and the next sentence's negation cancelled out. Closing emphasis markers now belong to the sentence, as closing quotes already do. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
Each "1." of a numbered list was split off as its own sentence and counted in n_sentences and n_unchecked, so a numbered answer reported less coverage than the same answer as bullets. A fragment with no letter or underscore can never pair with an atom and is now skipped. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
A sentence that agrees with the documented version was flagged as a lexical value conflict when one side spelled trailing zero groups. Values now compare without them; the shape still follows the spelling, so 2.1 vs 3.0 and 2 vs 2.1 remain conflicts. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
The documented judge, LLMClient.json_object, was called without usable=, so
with DOKIMI_RESPONSE_CACHE set a reply such as {"verdict": "maybe"} was stored
and replayed on every rerun. client_judge(client) passes the same verdict set
_judged accepts, as the other novelty judges do.
Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
…ctions Without a judge any paired sentence where one side has a negation word is listed (--enable-accel does not need a restart.), so the changelog and the find_false_claims docstring now say what the lexical_conflict docstring says. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
…laim The only supports reply had an empty quote, so the quote check rejected it anyway and a verdict guard reading 'not unrelated' survived the test file. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
Only a final line that is just a numeric confidence is metadata; a prefix match dropped 'Confidence: 0.9 since ...' and its claim without failing a test. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
|
xaleryb
left a comment
There was a problem hiding this comment.
Approved on ff76711. The prototype stays behind its own command and leaves existing novelty output unchanged; our commits fix sentence ends before emphasis (the open thread at false_claims.py:78), list markers, 2.1 vs 2.1.0, and keep off-scale judge verdicts out of the cache. The PR body should still say client_judge(client) instead of LLMClient.json_object. Windows smoke had not started (the hosted Windows queue was stuck); every other check passed.
Problem
Lightsage-style tools report false claims agents make about a product. dokimi checks documents (atoms, faithfulness) and how well models answer atom probes, but it does not check a free-form agent answer against the documentation.
Change
dokimi/dokimi/novelty/false_claims.py: an offline research prototype that no command, score or gate uses yet. It splits an answer into sentences and pairs each sentence with atoms lexically. Then it either flags value or polarity conflicts lexically, or asks an injected judge callable, which must quote the conflicting words verbatim. Judge failures are counted,distorted/unsupportedatoms are skipped, and sentences no atom covers are reported asunchecked.Evidence
tests/test_novelty_false_claims.pycovers the stored fixture, compact units, flag case and digit-bearing dotted identifiers. The focused suite covers compact range endpoints, a lone number against a version, frequency and microsecond normalization, flag overlap, and sentence offsets across CR, LF and CRLF. No paid model calls were made.Local self-review (pr-review, L2: correctness, silent-failures, tests and comments lenses): it found one blocking pairing false positive, which is fixed with a test.
🤖 Generated with Claude Code
Research method, validity risks, and next steps
False claims: agent answers that contradict the product's documentation
Status: research prototype, not wired into any command, score or gate.
Code:
dokimi/dokimi/novelty/false_claims.py. Tests:dokimi/tests/test_novelty_false_claims.py.Why
Commercial "AI visibility" tools report the false claims assistants make about a product
("ChatGPT says X needs driver 3.0; the docs say 2.1"). dokimi already checks what a
document asserts (atoms, with span provenance and a faithfulness check) and how well a
model answers questions derived from the document (novelty
measure). It does not takean answer the agent gave to an arbitrary user question and list which documented facts the
answer contradicts. This note describes that check and a first offline prototype of it.
Method
Inputs are stored, so no model is called unless a judge is passed in:
load_atomsrecord: statement, span ids, faithfulness);Steps:
standalone numeric
confidence: xline is answer metadata. Decimal points(
3.0) and dotted names do not end a sentence.distinctive token (flag,
snake_case, dotted identifier), or at least 30%of the atom's content words and at least two of them (so a short atom does not pair with
every sentence that names the product). Flags and identifiers are split into parts, so
--use-acceland--enable-accelshareaccel. For a multiword atom, this overlapneeds another shared content word. Numbers do not contribute to the overlap. Atoms whose faithfulness check
came back
distortedorunsupportedare not ground truth and are skipped.lexical:value(both sides name aremaining value of the same kind after matching shared values, such as a version, a duration or a case-sensitive flag) or
lexical:polarity(exactly one side is negated). These are candidates.prompt -> {"verdict","quote"}, e.g.LLMClient.json_object):contradicts/supports/unrelatedplus a quote. Acontradictswhose quote isnot a verbatim substring of the sentence is counted as
n_unverified_quoteand notreported. A failed call or an off-scale verdict is
n_judge_errors, never "clean".rendered on the doc like other novelty output), the answer sentence and the quote,
plus counts: sentences,
n_unchecked(sentences no atom paired with), pairs, unverifiedquotes, judge errors.
How it differs from the existing judges
measure_gradeabstainedunchecked(no atom covers it)measureasks "does the model know this atom?"; this asks "of what the agent chose tosay, what does the documentation contradict?". It reuses atoms (and their faithfulness
labels and span provenance) unchanged; the judge prompt is new and narrower (direct
conflict only — omission and vagueness are not contradictions, unlike
wrong_other,which also covers "irrelevant").
Validity risks
report must show
n_unchecked / n_sentencesnext to any count of false claims; a lowfalse-claim count over a mostly-unchecked answer means nothing.
"requires driver version 2.1") and synonyms. An embedding pre-filter would raise recall;
measure it against a hand-labelled set before trusting any rate.
things (a port and a version); a negation can sit in another clause. Lexical hits are
triage for a judge or a human, never a published rate.
version_bound/temporalatoms need the answer's version context; until then flagthem for review instead of counting them.
supported/uncheckedatoms are used; a production version should require
supported.check_judge2'ssame_clientrule), and its agreement with a second judge on a sampleshould be reported, as
judge2does formeasure.not that they conflict.
Cost
Pairing is local. With a judge: one short call per (sentence, paired atom) pair —
roughly 150–250 input tokens and ~30 output tokens each. A 10-sentence answer against a
few hundred atoms typically yields 5–30 pairs, i.e. under 10k tokens per answer; a 200-answer
corpus is in the low millions of tokens, so a small model is affordable and a spend cap
(
SpendCap) should bound it. Batching all pairs of one sentence into one call would cutthe call count further. No paid calls were made for this prototype.
Next steps
pairing recall and judge precision/recall on them.
version_boundatoms.skill novelty false-claims --atoms … --answers …) writing afalse_claims.v1artifact, with the coverage figure beside every count.