File size: 11,331 Bytes
72eaba2 0d36fe4 97f7b18 72eaba2 97f7b18 e5cf13a 97f7b18 e5cf13a c4acf01 72eaba2 97f7b18 72eaba2 0d36fe4 72eaba2 c4acf01 0d36fe4 c4acf01 0d36fe4 72eaba2 0d36fe4 0b8e025 72eaba2 0d36fe4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | ---
license: mit
pretty_name: kip-hash
tags:
- dedup
- near-duplicate-detection
- data-curation
- quality-filter
- minhash
- simhash
- nano
- distillation
---
# kip-hash
**The nano verify-and-dedup word β one 32-bit integer per row, two
planes, two jobs, pure-stdlib inference. MIT licensed.**
word = (bucket << 8) | level # 24 learned bucket bits | 8 score bits
Schema 6 (2026-11-23) β **v6.7, the kimi train-side campaign + the
honest-band correction**. The queued lever from v6.6 ("closing it
needs kimi-labeled train-side supervision, not width") is pulled, and
an audit bug in the honest-band split β shipped silently in v6.5 and
v6.6 β is fixed. The result inverts the neural-verifier comparison on
a correctly measured band.
## What v6.7 changed (all measured on this release's own pool)
1. **THE KIMI TRAIN-SIDE CAMPAIGN (the v6.6 lever, pulled).** Every
v6.7 batch is kimi-labeled: **95 new heterogeneous batches / 1,520
rows across 32 languages**, plus the **38-batch re-label slice**
(606 rows: v6.2 x2 / v6.3 x10 / v6.4 x11 / v6.5 x7 / v6 x8) β the
flattest MiniMax-labeled TRAIN batches (lowest within-batch quality
sd), re-labeled by kimi-k3.1-pro and joined by the trainer's
later-campaign-wins rule β plus **50 teacher-adjudicated dup
pairs** and **79 organic cross-batch xdups**. Train-side teacher
mix: **kimi 57.7%** (v6..v6.5 was ~0%), MiniMax 27.8%, nemotron
23.5%, pre-attribution 5.9%, DeepSeek-V4.1 4.8% of the 10,609
labeled train rows.
2. **THE HONEST-BAND CORRECTION (audit finding, fixed here).** The
honest-band split never actually happened in the shipped v6.5/v6.6
reports: the teacher lookup passed a row INDEX into a
`(batch_id, i)`-keyed map, every lookup fell back to `?`,
`self_labeled` was always 0, and "disjoint_teachers" was the
pooled matched set β v6.5/v6.6's `disjoint probe_spearman 0.8408`
is byte-identical to their pooled probe number. The v6.6 eval
ground truth was mostly MiniMax-labeled (the probe's own teacher),
so the "honest gap" that motivated v6.6 was partly
**self-agreement inflation**. This release ships the FIRST
correctly split band, on an eval redraw whose ground truth is
teacher-diverse (kimi 1,031 / nemotron 814 / MiniMax 612 /
DeepSeek-V4.1 190 / pre-attribution 155 of 2,802 matched rows):
- **self-labeled rows (n=612, ground truth = the probe's own
teacher): kip 0.7915 / MAE 9.14 vs probe 0.6931 / MAE 13.24** β
the word-only scorer beats the neural verifier's re-run of its
own teacher;
- **disjoint-teacher rows (n=2,190): kip 0.6556 / MAE 10.97 vs
probe 0.5206 / MAE 15.22** β and it leads out-of-family too.
Both directions are computed from the same report block
(`honest_band`); the fixed lookup is `train_kip_hash_v67.py`.
3. **THE POOL CHANGE (disclosed, not hidden).** A sandbox recycle
(2026-11-23) destroyed `data/verifier_v62` (2,720 rows) and
`data/verifier_v63/batches.jsonl` (2,314 rows) AFTER the v6.6 run
β no nim_raw payloads, no corpus_rows, never committed, so the row
texts are unrecoverable. This release therefore pools **13,447
labeled docs** (v2 794 + v4 1,913 + v5 2,132 + v6 2,976 + v6.4
1,843 + v6.5 1,663 + v6.7 2,126) across **181 languages** instead
of v6.6's 16,769; the 606-row re-label slice re-stages the lost
campaigns' surviving identities inside v6.7 with fresh kimi
labels. The eval redraw (2,838 docs / 183 batches / 819 dup pairs)
was **re-probed to 100% coverage** (2,838/2,838 rows, MiniMax M3.1
Flash via NIM). **Pooled deltas vs v6.6 are pool-confounded** β
within THIS pool the fair comparables are the MinHash-64 row and
the neural-verifier probe, both measured on the same rows with the
same bars.
4. **DEDUP RE-SWEPT on the new pool.** The full geometry sweep
re-selected the operating point: radii **[2,2,2,1,1,1]** x masks
**[]** x **3,375 probe keys/row** (v6.6: 12,330) with re-selected
tau β doctrine-aligned gates (post-guard-F1 optimal, zero clean
verified false merges, recall-max tie-break). Head-to-head on this
pool, stated plainly: **kip post-guard F1 0.907 vs MinHash-64
0.951** (recall 0.832 vs 0.916) β MinHash leads recall/F1 here β
**but** kip false merges **2 vs 9**, signing **518.8 vs 219
docs/s**, storage **4 B vs 512 B per row (128x less)**, and only
kip carries the O(1) junk triage (word-only AUC **0.966**). The
v6.6-pool verdict (F1 0.9676 vs 0.9596, kip ahead) was
pool-dependent; this release says so. The hard invariant holds:
**0 false merges in the adjudicated false-merge zone, post-guard
(asserted)**; live-dedup consistency: serial vs parallel
word-identical, 0 policy violations, 2,838 rows -> 2,595 kept.
5. **THROUGHPUT 518.8 docs/s** single-core pure-stdlib (v6.6: 521.4
on its pool) β the engine is unchanged; the number re-measures on
this pool. `sign_batch` parallelism is word-identical (asserted).
## Measured (held-out batches, 2,838 docs / 819 dup pairs / 41.6k pair evaluations)
| metric | v6.7 (schema 6) | v6.6 |
| --- | --- | --- |
| eval docs / dup pairs | 2,838 / 819 | 3,230 / 856 |
| **Spearman (pooled)** | **0.7037** | 0.8005 |
| Spearman, informative batches | **0.7112** | 0.8114 |
| verdict MAE (fine) | **10.64** | 10.06 |
| junk head AUC (fine / level) | **0.966 / 0.964** | 0.873 / 0.901 |
| honest band, self-labeled (kip vs probe) | **0.7915 vs 0.6931** (n=612) | (split was broken: 0/3,110) |
| honest band, disjoint teachers (kip vs probe) | **0.6556 vs 0.5206** (n=2,190) | (split was broken: reported 0.800 pooled as "0.8408 disjoint") |
| dedup confirmed recall | **0.8718** | 0.9907 |
| post-guard recall (auto-merge) | **0.8315** | 0.9428 |
| dedup F1 post-guard | **0.9068** | 0.9676 |
| MinHash-64 recall / F1 / false merges (same pool, same bars) | **0.916 / 0.951 / 9** | 0.943 / 0.960 / 19 |
| kip false merges post-guard | **2** | 5 |
| **false merges in the adjudicated zone (explicit)** | **0** (asserted) | 0 (asserted) |
| word-only junk triage AUC | **0.966** | 0.901 (level) |
| bytes per row | **4** | 4 |
| artifact (file) | **~930 KB** | ~925 KB |
| throughput, one core | **518.8 docs/s** | 521.4 docs/s |
| probe keys per row | **3,375** (re-selected) | 12,330 (re-selected) |
| labeled supervision rows | **13,447** | 16,769 |
| label languages | **181** | 180 |
Pool note: every release measures on ITS OWN redrawn split (each
campaign joins the pool, the split redraws, the probe re-runs on the
new rows). The v6.6 column is shown for lineage only β the pools
differ (see change 3), so cross-column deltas are pool-confounded.
Within THIS pool, the honest comparables are in the rows above: the
MinHash-64 baseline (same pairs, same bars) and the neural-verifier
probe (same rows, verdicts from the fixed cache).
## Engine
- **Lexical guard (v6.4 bars, config-driven)** β confirmed candidates
auto-merge at J >= 0.55 (long rows) / 0.72 (12..59-token rows) /
0.73 (6..11-token rows); J < 0.25 rejected; between floor and bar
is the gray lane, recorded for teacher adjudication instead of
silently merged. Bars ship in the artifact; schemas 1-6 all load
byte-faithfully.
- **battery4 surface view** β 34 fused features in ONE pass;
`battery4[:26] == battery3` bit-identical; the junk head reads the
pinned 26-core, the verdict head reads all 34.
- **Masked multi-probe** β 3,375 probe keys/row (re-selected from the
full geometry sweep on this pool under doctrine-aligned gates).
- **Collision policy** β cluster survivor = highest (level,
quality_fine, length, -arrival); O(1) off the word.
- **Quality gate** β rows with level < gate never enter the bucket
index; the junk flag is the light-touch floor for the pretrain
profile (drop-only: junk precision 0.9945, recall 0.578 on this
pool's held-out).
- **`sign_batch(texts, workers=k)`** β order-preserving stdlib
multiprocessing; word-identical to the serial path (asserted).
- **Compact mode** (`with_compact()`): 18-bit buckets -> 26-bit word.
- CLI selftest: `python3 kip_hash.py`. Schemas 1-6 loadable.
## Training
Distilled from the teacher roster on **13,447 labeled rows** across
**181 languages**: 794 v2 (pre-attribution era) + 1,913 v4 + 2,132 v5
+ 2,976 v6 + 1,843 v6.4 + 1,663 v6.5 + 2,126 v6.7 (which includes the
606-row re-label slice), plus deterministic construction-known-truth
supervision (~87.8k train pairs / 10,226 pos). The v6.2/v6.3 rows
lost to the recycle are NOT in this pool (disclosed above); the
606-row slice keeps their identities alive with fresh kimi labels.
| teacher | channel | pool rows | role |
| --- | --- | --- | --- |
| kimi-k3.1-pro | NVIDIA NIM | 5,060 | v6/v6.3-v6.5 eval-side teacher (probe independence) + **v6.7 TRAIN-SIDE MAJORITY** (every v6.7 row + the re-label slice) |
| MiniMax M3.1 Flash | NVIDIA NIM | 3,572 | v6.3-v6.5 train bulk + **the independent eval-side verifier probe** (48-row bundles, fresh cache at 100% redraw coverage) |
| nemotron-3.5-lightning-30b-a3b | NVIDIA NIM | 3,315 | v4 (partial) + v5 bulk teacher |
| DeepSeek-V4.1-Flash-1017 | DeepSeek webapp | 706 | v4 primary / quality anchor |
| (pre-attribution) | β | 794 | v2-era rows; the teacher_model field postdates them |
Deterministic trainer `scripts/train_kip_hash_v67.py` (SEED=20261119,
batch-fold-selected head family β head BLENDS, closed-form ridge).
Weights + metadata only β no corpus text ships in the artifact.
Reconstruction notes (recorded in the artifact provenance):
- 2026-11-21: the v2/v3 helper modules rebuilt from the archived
trainers after a recycle; byte-faithful except `noisy_paraphrase`
(synthetic TEXT contents only) and the sorted-alternate
`fold_batches` assignment.
- 2026-11-23: second recycle β v6.2/v6.3 campaign texts lost (change
3); the helper shims re-extracted byte-faithful (ast) from the
archived v2/v3/v4 trainers; `split_batches` reproduces the shipped
eval arithmetic (v6.5's 225 = 20% x 1,127 pool batches);
`JUNK_FLAGS = {spam, incoherent, error_junk}` validated against the
shipped fold-B junk-head MSE (0.105 ~ p(1-p) at the 11.6% rate);
the eval redraw re-probed to 100% coverage; the honest-band teacher
lookup fixed (change 2).
## Usage
```python
from kip_hash import KipHash
vh = KipHash("kip-hash.json")
w = vh.sign_text("...row text...")
w["word"] # 32-bit int: 24 bucket bits | 8 level bits
w["score4"] # 0-255 composite level (isotonic-calibrated)
w["quality"] # decoded 0-100 verdict for that level
w["junk_prob"] # hash-side junk/boilerplate flag
sigs = vh.sign_batch(texts, workers=4) # corpus-scale, stdlib only
keep, dups, rep = vh.dedup_stream(texts, gate=32)
keep, dups, rep = vh.dedup_stream(texts, junk_floor=True) # pretrain
keep, dups, rep = vh.dedup_stream(texts, workers=4) # parallel sign
vhc = vh.with_compact() # 26-bit word view
```
Pipeline hooks: `kip.fullscale.learned_hash.load_kip_hash` /
`nano_dedup(profile="pretrain")` / `nano_triage(min_frac=...)` /
`lexical_veto`; freshness tags via `kip.fullscale.tags`. The big
pretrain dataset schema that consumes this word is frozen at
`kip.pretrain.schema.v2` (src/kip/fullscale/pretrain_schema.py).
## License
MIT - see [LICENSE](LICENSE) (and the repo-root LICENSE).
|