Skip to content

Commit 7683e4f

Browse files
杜一min杜一min
authored andcommitted
Store prefix/suffix sharing as dedup + uncompressed: 42.4% of 46.0% saving at ~2x raw lookup
1 parent a623a75 commit 7683e4f

5 files changed

Lines changed: 488 additions & 10 deletions

File tree

‎docs/roadmap.md‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,13 @@ public entry points (`setup.py`). `tools/` is unchanged on disk, so evidence
5858
verifiers and `tools.*` imports keep working. Not done: a PyPI upload and a
5959
`meft-memory` alias package, which need a release decision.
6060

61-
### 4. Structure on a long-trained real table
61+
### 4. Structure on a long-trained table
6262

63-
Structural savings grow with training length, but every test so far used
64-
short SGNS runs or a table where they stay below 1%. Before more planner work,
65-
measure one real, fully trained character n-gram model.
66-
67-
- Train or obtain a FastText-scale model trained to convergence on a public corpus
68-
(e.g. full Wikipedia in one language), with registered keys.
69-
- **Done when** `exact` and `joint` savings and held-out quality are measured on it.
70-
If `joint` at .99 gives under 10% extra saving at unchanged quality, structural
71-
compression stays an optional mode and stops being a priority.
63+
Cheap version done (2026-11-13): on the existing 32k-step checkpoints, joint
64+
sharing stored as dedup + uncompressed keeps 42.4% of the 46.0% n-gram saving with
65+
lookups at ~2× raw instead of ~125×, and no measurable loss change
66+
([report](../evidence/structure_dedup_20261113/README.md)). A converged
67+
FastText-scale table and a FAISS comparison at these points remain open.
7268

7369
### 5. When does identity pay off?
7470

‎evidence/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ here: links in locked READMEs still point to them, and they forward to
3434
| Report | Result and boundary |
3535
| --- | --- |
3636
| [Tree-sharing quality and training mechanism](tree_node_quality_evidence_20261109/README.md) · [protocol](tree_node_quality_protocol_20261109.md) | 18 checkpoints × 204 candidates; 36 trajectories. Order-12 .99/.99 native n-gram-only saving rises from 1.34% at 2k steps to 41.49% at 32k steps. FAISS and precomputed controls keep their limits |
37+
| [Sharing stored without compression](structure_dedup_20261113/README.md) | Joint `.99/.99` rows are byte duplicates, so dedup + uncompressed keeps 42.4% of the 46.0% saving at 32k steps with lookups at ~2× raw instead of ~125× |
3738
| [Conditional prefix/suffix similarity](conditional_similarity_evidence_20261109/README.md) · [protocol](conditional_similarity_protocol_20261109.md) | 27 character models: some parent–child pairs exceed .99 cosine beyond matched unrelated controls; frequency, coverage and initialization matter |
3839
| [Original DATrie / mark-compact ablations](structural_native_evidence_20261030/README.md) | Measures DATrie and approximate joint sharing separately; exact mode finds no identical rows to merge |
3940
| [Large-table structural applicability](large_structural_evidence_20261031/README.md) | 1.85M rows: extra structural savings below 0.63%; broad queries slower |
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Prefix/suffix sharing stored without compression
2+
3+
Joint `.99/.99` DATrie sharing merges a row into its prefix/suffix
4+
representative, which makes the two rows byte-identical. Those duplicates can be
5+
stored with the deduplicated, uncompressed layout from the
6+
[host query profile](../host_query_profile_20261112/README.md), so lookups copy
7+
rows instead of decoding blocks. This checks what that keeps of the saving.
8+
9+
## Result
10+
11+
Nine trained SGNS checkpoints from the [tree-node mechanism study](../tree_node_quality_evidence_20261109/README.md)
12+
(maximum order 12, average derivatives, initialization scale 1, seeds 3/7/11,
13+
2k/8k/32k training steps; 18,137 × 128 FP32 n-gram rows each):
14+
15+
| Training steps | Distinct rows after sharing | Joint + dedup, uncompressed | Joint, XOR + zlib blocks (original) | Identity, XOR + zlib |
16+
| ---: | ---: | ---: | ---: | ---: |
17+
| 2,000 | 97% | 1.4–1.5% saving | 7.2% | 5.9–6.0% |
18+
| 8,000 | 86% | 12.5–12.8% | 17.9–18.2% | 6.6% |
19+
| 32,000 | 56% | 42.3–42.5% | 45.9–46.1% | 7.8% |
20+
21+
Lookup p50 for 5,000 random 40-ID bags, relative to an in-memory array:
22+
23+
| Layout | vs raw |
24+
| --- | ---: |
25+
| Joint + dedup, uncompressed | 1.9–2.2× |
26+
| Joint, XOR + zlib (original) | 122–127× |
27+
| Identity, XOR + zlib (original) | 108–128× |
28+
29+
At 32k steps the uncompressed layout keeps 42.4% of the 46.0% saving and
30+
removes the decoding cost. Every decoded row matched the original joint table
31+
byte for byte. The relative change in held-out loss from joint sharing, taken
32+
from the study's archived 2,000-resample intervals, stays within ±6×10⁻⁵ on the
33+
test and confirmation segments, for all and OOV-only centers.
34+
35+
## Limits
36+
37+
The table is 9 MB and fits in CPU cache, so absolute lookup times say little
38+
about large tables; the ratios show the decoding cost. Query bags are random
39+
IDs, not the study's text traces. The savings are for the n-gram table only.
40+
The longer-trained points also have higher source loss (see the study), so this
41+
shows what training does to structure, not a recommended training length.
42+
43+
## Setup
44+
45+
[`structure_remote.py`](structure_remote.py) on the grid machine (AMD EPYC 7713,
46+
one pinned core, Python 3.12, NumPy 1.26) with the v0.5.0 runtime: decode the
47+
study's identity and joint tables, re-pack each with `pack_native(...,
48+
deduplicate=True, compress=False)`, time lookups. Raw output:
49+
[`results.json`](results.json).

0 commit comments

Comments
 (0)