Skip to content

P5: opt-in near-duplicate guard (train vs val, train vs holdout) - #22

Merged
scrimshawlife-ctrl merged 7 commits into
mainfrom
feat/neardup-guard
Oct 17, 2026
Merged

scrimshawlife-ctrl merged 7 commits into
mainfrom
feat/neardup-guard

Conversation

@scrimshawlife-ctrl

@scrimshawlife-ctrl scrimshawlife-ctrl commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Harness-learning batch, item P5. Stacked on #20, because it imports heldout_census.normalize_group_text from that port. Retarget to main after #20 lands.

  • New scripts/shadow/hyperlexical/neardup_guard.py: character 3-5-gram Jaccard over the normalized text, with an inverted 5-gram index so it stays fast at about 15k x 1k rows.
  • Off by default. Set HLX_NEARDUP_GUARD=1 to enable. When enabled it fails closed: a missing holdout file, a bad threshold, or any pair at or above the threshold refuses with ADMISSION FAIL. HLX_NEARDUP_MODE=drop drops the offending train rows instead and writes a receipt.
  • Threshold HLX_NEARDUP_THRESHOLD (default 0.7). CLI: python -m scripts.shadow.hyperlexical.neardup_guard --train T --val V [--holdout-texts H] [--threshold X] (exits 2 if any pairs are found).
  • Not wired into train.py. This is meant as a future prereg item. In-flight training and prereg are untouched.
  • Known limit: texts shorter than 5 normalized characters are compared only with other short texts.
  • Tests: tests/shadow/test_neardup_guard.py (10 pass locally).

Code by deepseek/deepseek-v4.1-flash (high reasoning) through the Jev router, reviewed by Grok Bot. Do not merge without review.

Harness-learning batch, item P5. Stacked on #20, because it imports heldout_census.normalize_group_text from that port. The PR base is main; the branch also contains the holdout-guard commits.

  • New scripts/shadow/hyperlexical/neardup_guard.py: character 3-5-gram Jaccard over the normalized text. The inverted index stores 3-grams, 4-grams, and 5-grams, so a pair that shares only a lower-order gram is still scored.
  • Off by default. Set HLX_NEARDUP_GUARD=1 to enable. When enabled it fails closed: a missing holdout file, a bad threshold, or any pair at or above the threshold refuses with ADMISSION FAIL. HLX_NEARDUP_MODE=drop drops the offending train rows instead and writes a receipt.
  • Threshold HLX_NEARDUP_THRESHOLD (default 0.7). Shadow checker, not a SKILL.md command, documented in scripts/shadow/hyperlexical/README.md: python -m scripts.shadow.hyperlexical.neardup_guard --train T --val V [--holdout-texts H] [--threshold X] (exits 2 if any pairs are found).
  • Not wired into train.py. This is meant as a future prereg item. In-flight training and prereg are untouched.
  • Texts shorter than 3 normalized characters have an empty gram set (Jaccard 0). A text of length 3 or 4 is compared with longer texts when they share a 3-gram or a 4-gram.
  • Intent: intent/2026-10-12-neardup-guard.md (accepted with the 2026-10-12 harness-learning yes).
  • Tests: tests/shadow/test_neardup_guard.py.

Code by deepseek/deepseek-v4.1-flash (high reasoning) through the Jev router, reviewed by Grok Bot. Do not merge without review.

Open in Web Open in Cursor 

Off unless HLX_NEARDUP_GUARD=1; threshold HLX_NEARDUP_THRESHOLD (0.7); mode fail|drop.
Not wired into train.py. Code by deepseek-v4.1-flash via Jev router; reviewed.
@scrimshawlife-ctrl
scrimshawlife-ctrl requested a review from a team as a code owner October 12, 2026 12:16
@github-actions

Copy link
Copy Markdown

CC @Zero-State-LLC/partner-agents. Flagged for shared triage.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T12:21:20.558294Z 2731ca9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2731ca96e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/shadow/hyperlexical/neardup_guard.py Outdated
Comment thread scripts/shadow/hyperlexical/neardup_guard.py
Comment thread scripts/shadow/hyperlexical/neardup_guard.py Outdated
@scrimshawlife-ctrl
scrimshawlife-ctrl changed the base branch from feat/port-holdout-guard to main October 17, 2026 18:12
cursoragent and others added 5 commits October 17, 2026 18:22
Port recoverable_structure from archived ad4075b so the training export imports in a clean checkout. Resolve the bundled hyperlexical module before an exposure snapshot is published. Refuse holdout identity fields that are not lists of strings.

Co-authored-by: Daniel Meyer <scrimshawlife-ctrl@users.noreply.github.com>
Co-authored-by: Daniel Meyer <scrimshawlife-ctrl@users.noreply.github.com>
Candidate generation now includes 3-grams and 4-grams, so a pair that shares only a lower-order gram is scored in both fail and drop modes. The shadow checker is documented in the module README, and intent/2026-10-12-neardup-guard.md records the accepted harness-learning item.

Co-authored-by: Daniel Meyer <scrimshawlife-ctrl@users.noreply.github.com>
Keep main's holdout-guard test list and add this branch's near-duplicate test to the same job.

Co-authored-by: Daniel Meyer <scrimshawlife-ctrl@users.noreply.github.com>
Keep the run_report tests from main and this branch's near-duplicate test on the same holdout-guard list.

Co-authored-by: Daniel Meyer <scrimshawlife-ctrl@users.noreply.github.com>
@scrimshawlife-ctrl
scrimshawlife-ctrl merged commit 018b34e into main Oct 17, 2026
7 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