Explore the research collection
3 entries · Follow this search
- Model
From Tokens to Bytes I & II: Scaling Hierarchical Networks
Cartesia's improved hierarchical networks (H-Nets), end-to-end byte-level language models that replace fixed BPE tokenization with learned, recursive, data-dependent dynamic chunking inside the model (encoder → learned chunking → main network over coarse chunks → dechunking + residual → decoder). Part 1, controlled 1-stage scaling ladder (same Transformer backbone, outer networks FLOP/parameter-matched to embedding/unembedding; Muon optimizer, WSD schedule; data 70% English / 20% code / 5% math / 5% multilingual by bytes; in-corpus BPE retrained as baseline, itself worth ~1.1x vs off-the-shelf): H-Nets show 1.3x compute multiplier on validation loss, rising to 2x on code and up to 5x on out-of-domain code, summarized as up to 3–5x efficiency gains. Part 1, larger 2-stage H-Net vs SmolLM3-3B (HF, 11.1T tokens total across 8T/2T/1T phases, Llama-3 tokenizer): outer stages are Mamba-2 layers + sliding-window attention, main network a 40-layer Transformer with SmolLM3's per-layer shape, compression ~7.6 bytes/chunk vs ~4.5 bytes/Llama-3-token; models compute-matched within 2% FLOPs/byte (H-Net 3.67B params vs SmolLM3 3.08B; outer stages 43% of H-Net FLOPs vs 8% embedding/head for the baseline); the H-Net reaches SmolLM3's final average benchmark score after ~1T tokens vs ~11T, i.e. ~10x less data and (per-byte-matched) compute. Qualitative: learned chunks are context-dependent and semantically coherent across languages and code, including in-context tokenization — boundaries evolve during inference as concepts recur (new words, repeated formats, recurring motifs). Part 2, loss-to-loss laws: H-Net's compute advantage grows from pretraining loss to downstream (1.3x on diverse mixture → 2x downstream; 2x on code → 5x on out-of-domain languages); input encodings can produce 2–4x downstream compute effects. Pretokenization analysis (same regex lineage as #126: GPT-2, cl100k, o200k, DeepSeek): BPE without pretokenization (BPE-NP) is ~5x worse than BPE on compute-to-loss but better on loss-to-loss, and suffers the prompt-boundary/marginalization problem (canonical tokenization only, no sum over segmentations); adding pretokenization back buys 1.5x compute-to-loss and 1.3x loss-to-loss, ~1.9x combined on compute-to-downstream. Beyond language: ongoing H-Net results previewed in biology and vision as a general raw-data architecture.
- Thread
Hand-crafted pretokenizer regexes are part of every frontier LLM and doing heavy lifting (Albert Gu, X thread)
A short illustrated explainer — framed as preparation for an unnamed, undated Cartesia "upcoming release" (pure teaser; nothing about it is verifiable from the thread) — arguing that the regex PRETOKENIZER is the one part of a modern LLM stack still hand-designed rather than learned, and that it does "pretty heavy lifting." Content is a lineage tour of the pretokenizer patterns shipped in well-known public BPE tokenizers, each shown as a screenshot and verified for this entry against the public tokenizer configs (NO errors found): (1) GPT-2's original pattern — contractions case-SENSITIVE and listed individually ('s|'t|'re|'ve|'m|'ll|'d), digits UNGROUPED (\p{N}+). (2) GPT-4 / cl100k_base — contractions become case-insensitive ((?i:…)) and digits are chunked in groups of 1–3 (\p{N}{1,3}) — a deliberate choice with arithmetic consequences (fixed-width digit chunking; a reply in-thread notes left-to-right chunking turns 12345 into 123|45). (3) GPT-4o / o200k_base — the letter branch forks by case (separate uppercase/titlecase-initial and lowercase-initial word patterns), roughly doubling the pattern's complexity; Gu's caption is candid ("honestly i have no idea, something about additional rules around upper/lower case") and the case-handling reading is correct. (4) DeepSeek — the pattern balloons into many script- and punctuation-specific branches, including a dedicated CJK range branch; the screenshot is EXCERPTED (presented without saying so — the full DeepSeek pattern is far longer). Claim hygiene: "part of every frontier LLM" overstates as written — regex pretokenizers are near-universal in the dominant BPE lineage (OpenAI, DeepSeek, Llama-3-style, Qwen, Mistral tiktoken-style), but SentencePiece/Unigram tokenizers and tokenizer-free/byte-level approaches don't use a hand-written regex pretokenizer; read as "every frontier BPE LLM." Post 1's meme regex is an implementation variant (possessive quantifiers, apostrophe-less contraction branch) of the GPT-4-family pattern rather than literally the cl100k pattern shown two posts later — cosmetic, not an error in any captioned claim. A notable unanswered reply asks what regression test catches a silent pretokenizer change that shifts model quality.
- Post
You could have invented transformers from memory
A pedagogical explainer (not a research result) deriving linear maps, MLPs, and self-attention as associative key-value memory stores from first principles. The unifying quantity is the interference-to-signal ratio — interference from other stored memories vs the target's signal — and capacity is the number of memories before interference matches signal (random unit keys, query with a stored key). At d_k=64: outer-product linear store ≈64; optimal linear (least-squares/whitened keys) ≈128; ReLU MLP ≈128; squared ReLU / SwiGLU ≈2d_k²/3 ≈2,700–2,900; cubed ReLU ≈2d_k³/15 ≈35,000; self-attention with β=√d_k ≈e^{2√d_k−2} ≈1.2 million; β ∝ log M allows an essentially unbounded store (>2M in experiments). Derivations: interference terms add like a random walk (√M); σ(s)=ReLU(s)^p gives capacity M≈d_k^p; the exponential is a weighted sum of all powers, so capacity grows exponentially in the sharpness β: M≈e^{2β(1−β/d_k)} for β≪d_k; normalizing weights for numerical stability yields exactly f(x)=Vᵀsoftmax(βKx). Unlike MLPs, self-attention is non-parametric: keys/values come from context tokens, so the store grows with context length. Notes that the original transformer's v2/v3 described the feedforward layer as "a kind of attention" (passage removed from later versions) and tried replacing FFNs with learned-key-value attention at similar quality. The long-context section compares β∝log M tricks (Su 2021 entropy scaling, Scalable-Softmax, Qwen LogN-Scaling, Qwen2.5-1M YaRN scaling), driving the interference ratio to ~10⁻⁴ at 2M memories. Author-stated caveat: the count is random-vector recall of a single layer, ignoring training data; companion pointers to bits-per-parameter memorization work (Morris et al. ~3.6 bits/param; Allen-Zhu & Li ~2 bits factual knowledge/param). Includes interactive demos (sliders for M and β with live interference/signal visualization). Asides: a gradient-descent step is a memory write (Irie, Csordás & Schmidhuber); transformers' MLPs store facts in superposition.