Skip to content

fix(extraction): keep validation-emptied batches out of the noise bank - #959

Merged
rwmjhb merged 1 commit into
CortexReach:masterfrom
gorkem2020:fix/noise-learning-validation-gate
Aug 29, 2026
Merged

fix(extraction): keep validation-emptied batches out of the noise bank#959
rwmjhb merged 1 commit into
CortexReach:masterfrom
gorkem2020:fix/noise-learning-validation-gate

Conversation

@gorkem2020

Copy link
Copy Markdown
Contributor

What Problem This Solves

Two side effects of the extraction validation layer:

  1. extractAndPersist trains the embedding noise bank whenever extraction returns ok with zero candidates. A batch can reach zero candidates through validation drops (constructed grounding, fiction register, the batch contradiction demotion) rather than genuine emptiness. In that shape the model DID emit candidates; feeding the conversation to the noise bank as a noise exemplar teaches "content like this is noise" and risks pre-filtering similar real content away from future extractions. Observed live: a mixed-register conversation containing a real durable fact was fed to the noise bank after the contradiction check demoted the whole batch.

  2. The batch contradiction check logs its demotions at debug only, so a fully demoted batch is indistinguishable from "model found nothing" at the standard log level. That ambiguity cost a live investigation.

Why This Change Was Made

  • extractCandidates now reports rawCandidateCount (items the model emitted before validation) on the ok result. Noise learning fires only when that raw count is zero; validation-emptied batches log a standard-level skip line instead.
  • When the contradiction check demotes one or more candidates, one standard-level line reports the count and batch register, mirroring the admission rejection lines.

The demotion policy itself is unchanged; this only fixes its side effects.

User Impact

Deployments stop committing wrong "this is noise" beliefs to the learning store when validation empties a batch, and operators can see demotions without enabling debug logging.

Evidence

  • Flipped the regression test that pinned the old behavior ("learns noise when every parsed candidate is dropped by local validation") and added demotion-emptied and log-line cases; red first, then green (7/7).
  • Grounding/register suite unchanged (23/23).
  • Full test chain green locally; dist rebuilt.

Note: this branch is cut from the grounding PR's head (#927) because the demotion machinery lives there; it stays a draft until #927 settles and merges.

@gorkem2020
gorkem2020 force-pushed the fix/noise-learning-validation-gate branch from 3a9648d to 5fe4075 Compare August 25, 2026 19:27
@gorkem2020
gorkem2020 marked this pull request as ready for review August 25, 2026 19:27
@gorkem2020

Copy link
Copy Markdown
Contributor Author

Recomposed against current master (post-#988) as a single commit carrying only this family's delta; full suite green locally. Ready for review.

@rwmjhb rwmjhb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 5fe4075. The new rawCandidateCount gate correctly distinguishes genuinely empty model output from non-empty batches removed by validation, preventing those conversations from training the noise bank. The focused noise-gating suite passes 7/7, the full suite and required GitHub checks are green, npm run build succeeds, and the generated tree remains clean.

Approved. Two non-blocking cleanup items: the new demotion log always says “constructed siblings present” even for failure-closed cells with no constructed sibling, and the nearby return-path comment still describes the superseded quality-drop learning behavior.

@rwmjhb
rwmjhb merged commit 1a683cf into CortexReach:master Aug 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants