Overlap-detection algorithms for the whole-draft × whole-corpus scan: benchmarks, costs, and where chroma/BERTopic fit #115
Closed
prasadtalasila
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Context: the grounded-writing roadmap's Phase 1 (#110, #111, #112) builds a whole-draft × whole-corpus verbatim scan. Before implementing #110, we surveyed the overlap-detection benchmark literature — the PAN/CLEF text-alignment shared tasks (2012–2015 and the 2025 generative revival) and the MOSS/winnowing fingerprinting lineage — to pick algorithms deliberately rather than by habit. One constraint sharpens everything: the drafts this pipeline produces are LLM-written, so the guards must be strong against both exact copying and literal paraphrase (same sentence skeleton, synonyms swapped, function words shuffled) — the mode of reuse LLMs actually produce.
What the benchmarks say
The dividing line for this project is its own rule: only deterministic checks may block. Exact and skip-gram matching are deterministic (gate-eligible); embedding similarity never is (advisory forever).
The consequence: a three-tier guard stack
Because the drafts are LLM-written, tiers 2–3 move up from "someday" to immediately after #111 — ahead of where the original roadmap parked paraphrase detection.
Candidates by descending implementation effort, with value
Merits and resource requirements
Corpus scale for the numbers: 501 PDFs, ~13,400 pages, ~7M words.
Can this be built on the existing chroma collection and BERTopic?
Not #110 itself — deliberately — but chroma is exactly the substrate for tier 3, and BERTopic fits neither.
Why #110 cannot sit on chroma:
embedding_modelchanges — chroma-based findings would change on a config edit, breaking the ledger-hash reproducibility contract and the only-deterministic-checks-block rule.Where chroma does fit — tier 3 is nearly free on today's infrastructure: the corpus side is already embedded, incremental re-embedding by text hash is already built (
embed_index.py), andget_client_and_model()is the reuse seam. The tier: chunk the draft with the samechunk_text(), embed with the same model, query the collection per segment, flag high-cosine/low-lexical-overlap pairs, then page-locate matched chunks through the passages ladder. Advisory, gated oncontent/chroma/existing — the same fall-back shape the skills already use.BERTopic: no.
content/topics.jsonhas no consumer, assignments are unstable between runs and whole-corpus-recomputed, and topic granularity is far too coarse for overlap. Its only conceivable role — prefiltering candidate sources — is worthless at ~500 documents, where the exact index checks every source in one lookup.Proposed sequence
#110 (exact index) → #111 (scan + gap-tolerant merge) → #112 (wiring + adversarial fixtures) → new PR: deterministic skip-gram channel (the
tokenizer_versioncache-key field in #110's design exists for exactly this) → new PR: chroma advisory tier feeding the same findings format.The concrete implementation plan for #110 is posted on that issue.
All reactions