bytelex v1: README — model-free byte-information relational system, artifact contract, loss primitives
Browse files
README.md
CHANGED
|
@@ -1,3 +1,89 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- tokenization
|
| 5 |
+
- byte-level
|
| 6 |
+
- distillation
|
| 7 |
+
- lexicon
|
| 8 |
---
|
| 9 |
+
|
| 10 |
+
# geolip-bytelex — the universal byte-information relational system
|
| 11 |
+
|
| 12 |
+
A **model-free translation matrix between tokenizer languages and byte
|
| 13 |
+
language**. Foreign tokens are not the same language as bytes — but any
|
| 14 |
+
real token *is* a byte string underneath, and the statistics of byte
|
| 15 |
+
information itself (not any particular model's internals) decide how
|
| 16 |
+
that token relates to byte-native units. This repo hosts the matrix:
|
| 17 |
+
every token of many tokenizers, projected through corpus-derived byte
|
| 18 |
+
relational structure, so that **any ByteLM derivative** can consume
|
| 19 |
+
foreign-tokenizer supervision (distillation, alignment, evaluation)
|
| 20 |
+
through one reusable interface.
|
| 21 |
+
|
| 22 |
+
Design rules, per the program's laws:
|
| 23 |
+
|
| 24 |
+
- **Model-free.** Nothing here depends on model weights. Internal model
|
| 25 |
+
structure drifts over training; corpus byte statistics do not care.
|
| 26 |
+
- **Alphabet-parametric.** The alphabet (256 byte values today) is a
|
| 27 |
+
schema parameter — it can grow or shrink; the system regenerates.
|
| 28 |
+
- **Gram-modular.** Relational views are declared, not hardcoded:
|
| 29 |
+
char n-grams (1–4 exact), hashed large-n (9-gram class), word-grams
|
| 30 |
+
via a separator predicate — add views as required (quadgram, wordgram
|
| 31 |
+
combos, whatever the task needs).
|
| 32 |
+
- **Specials are out-of-alphabet.** Control tokens are tabled and
|
| 33 |
+
flagged, never silently byte-expanded into text statistics.
|
| 34 |
+
|
| 35 |
+
## Artifacts
|
| 36 |
+
|
| 37 |
+
| path | contents |
|
| 38 |
+
|---|---|
|
| 39 |
+
| `vocab_<tokenizer>.jsonl` | Normalized token→bytes tables: `{"id", "hex", "text", "n_bytes", "is_special", "continuation"}`. Hex is authoritative; `text` is null when bytes aren't valid UTF-8. |
|
| 40 |
+
| `byte_lexicon_v1/` | The corpus statistics: exact char-gram tables (n=1..4), hashed 9-gram table, word-gram table, schema + provenance in `meta.json`. |
|
| 41 |
+
| `matrix_<tokenizer>.jsonl` | The full lexicon translation matrix: every non-special token's relational profile — `hmax`/`hargmax` (internal boundary-entropy maximum: where byte-language says the token divides), `pmin` (minimum internal PMI: cohesion), `word` (word-gram standing). |
|
| 42 |
+
| `matrix_summary.json` | Cross-tokenizer comparison: word fraction, divides/cohesive fractions, mean internal entropy. |
|
| 43 |
+
|
| 44 |
+
## Tokenizer roster (v1)
|
| 45 |
+
|
| 46 |
+
byte-BPE: gpt2 · Qwen3.8 (248,077 vocab) · DeepSeek-V3 · SmolLM2 ·
|
| 47 |
+
Llama-3.1 — tiktoken: cl100k_base · o200k_base — SentencePiece-BPE:
|
| 48 |
+
Mistral v0.3 · XLM-R — SP-unigram: T5 — WordPiece: bert-base-uncased
|
| 49 |
+
(lossy/uncased: flagged) — byte-identity control: ByT5.
|
| 50 |
+
|
| 51 |
+
All twelve extracted and round-trip spot-checked. Every generative
|
| 52 |
+
tokenizer in the roster attaches whitespace **leading**; byte-native
|
| 53 |
+
segmentations (measured on AlephLM) tend to build **trailing**-space
|
| 54 |
+
units — consumers must normalize the convention before comparing
|
| 55 |
+
boundaries.
|
| 56 |
+
|
| 57 |
+
## The loss primitives (what consumers do with this)
|
| 58 |
+
|
| 59 |
+
For distillation from any token-level teacher into any ByteLM student:
|
| 60 |
+
|
| 61 |
+
1. **Alignment endpoints** = corpus-entropy boundaries (successor
|
| 62 |
+
branching entropy over the byte corpus), *not* any model's
|
| 63 |
+
segmentation and *not* the teacher's token boundaries alone.
|
| 64 |
+
2. **Per-token weight** = cohesion (`pmin`, internal PMI): a token the
|
| 65 |
+
byte-language considers one unit aligns as one endpoint-to-endpoint
|
| 66 |
+
span.
|
| 67 |
+
3. **Non-cohesive tokens split** at their internal entropy maxima
|
| 68 |
+
(`hargmax`) before matching — the token was two byte-units wearing
|
| 69 |
+
one id, and the loss should know.
|
| 70 |
+
|
| 71 |
+
Teacher logits push forward to byte space along each token's byte
|
| 72 |
+
expansion (the exact-conversion direction of Phan et al., ICLR 2025);
|
| 73 |
+
chunk-level likelihood matching happens between co-boundaries (the ALM
|
| 74 |
+
family, arXiv:2503.20083), with the chunks defined by the corpus, so
|
| 75 |
+
the same matrix serves every teacher and every ByteLM student.
|
| 76 |
+
|
| 77 |
+
## Regeneration
|
| 78 |
+
|
| 79 |
+
The consuming/producing code is `geolip.bytelex` in
|
| 80 |
+
[AbstractEyes/alephllm](https://github.com/AbstractEyes/alephllm):
|
| 81 |
+
build a `ByteLexicon(GramSchema(...))` over any corpus stream, `feed`
|
| 82 |
+
raw bytes, `save`; project any `vocab_*.jsonl` through
|
| 83 |
+
`ByteLexicon.profile`. New alphabet, new corpus, new gram views, new
|
| 84 |
+
tokenizers — same recipe.
|
| 85 |
+
|
| 86 |
+
Part of the AlephLLM / Mini-Beatrix program
|
| 87 |
+
([training record](https://huggingface.co/AbstractPhil/alephllm-mini-beatrix-training)).
|
| 88 |
+
AlephLM is the strongest current consumer of this structure — but the
|
| 89 |
+
matrix belongs to the bytes, not to any one model.
|