Small examples / big ideas Numerical labs & source deep dive ↓

An illustrated reading journey · H-Net

Does every byte need
the deepest thought?

A language model still has to predict the next byte. H-Net learns which positions deserve a deeper update—and keeps a lighter path running at every position.

Which H-Net? The mechanism below is the July 2025 paper v2 and its public implementation. Your two October 2026 Cartesia blogs also describe an improved internal successor. They are not interchangeable. This correction separates their claims, opens the complete computation, and labels every invented numerical fixture.
Follow one whole process, then zoom into its parts.
We use cat! to keep the arithmetic small. The displayed vectors are teaching inputs, not outputs from a trained H-Net.
Two resolutions, one next-byte prediction task All four byte positions pass through a light encoder and decoder. Only positions zero and two enter a shorter main path in this invented example. The fine-detail path bypasses that main path. Both paths meet before next-byte prediction. bytes encoder mainshorter path decoder nextbyte? fine detail · every position route → gather → main → smooth → repeat → add c a t ! 0 → 2
Start here: follow the horizontal path first, then the raised detour. The encoder reads the seen bytes into numbers; the decoder combines the two paths. This original teaching sketch omits internal layers. We will open each operation below.

01 / The job, before the machinery

What are we trying to predict?

Imagine the model has read ca. Its immediate job is not “understand the whole word.” It must assign scores to possible next bytes. The next byte might be t, r, or something else.

A powerful network can do this at every byte. But that makes its deepest layers process a long sequence. H-Net asks a narrower question: can the deep network work on fewer positions, while the outer network still handles every byte?

Predict: if the deep network waits on the next position, must the entire model stop? Keep that question in mind.

Takeaway 01. H-Net changes the internal route, not the next-byte prediction task.

02 / Make the input tangible

What actually enters the model?

Bytes: integers from 0 to 255. In our deliberately simple ASCII example, each visible character is one byte. A lookup table turns each byte ID into a list of numbers called an embedding. A small causal encoder updates that representation using only the prefix already read.

position 0c99
position 1a97
position 2t116
position 3!33

Notice the difference: 99 is an input byte ID, not an embedding value or a boundary score.

UTF-8 encodes é with two bytes and 猫 with three. Real byte-level modeling cannot assume “one position = one letter.” Special sequence markers are omitted here.

Predict: does the model need a pre-built dictionary entry for the whole string cat!? No—it starts from byte IDs.

Takeaway 02. A byte ID is fixed; its contextual representation changes with the bytes seen so far.

Before the router / how a retained vector remembers

Can one retained vector know about bytes that were skipped?

Yes—through the causal encoder. Gather copies the encoder's vector at a selected position; it does not copy that position's raw byte. By then, the vector has already been updated by every earlier byte. The router also decides from those vectors, so an earlier byte can change both what is sent deeper and whether a later position is sent.

A declared toy encoder, not Mamba and not learned. Each known byte has a chosen two-number embedding. The encoder is the simplest causal memory: h[t] = 0.5·h[t−1] + E[byte t]. The router projections are chosen non-identity matrices: Wq = [[1, 0.5],[0, 1]] and Wk = I. All values are teaching constants; they show the dependency, not what a trained encoder learned.

The controlled experiment: change only a skipped byte.

Compare cat! with cot!. Position 1 is skipped in both. Yet the encoder state at position 2 differs by exactly 0.5 × (E[a] − E[o]), and the router's decision at t flips. The deep network therefore never receives an isolated byte: it receives a vector whose history includes a byte that was never gathered.

Why gather can work. Selection is cheap because the outer encoder has already summarized the past. The real encoder is a stack of causal Mamba-2 layers; this chapter shows the dependency, not their learned features.

The missing bridge / one whole forward pass

What happens between the bytes and the next-byte scores?

The main network is not a mysterious source of the numbers 2 and 10. It is the large sequence model that performs most of the high-capacity processing, on a shorter sequence of continuous vectors. Here is the full composition before any isolated scalar experiment.

byte IDs → embeddingcausal encoder + normrouter → gather vectorsmain network / nested H-Netsmooth → repeat + STEadd projected encoder residualcausal decoder + normbyte head → 256 logits
Concrete public configuration: one-stage Large, not the blogs' newer internal model
OperationInput → outputWhat really happens
Embedding + encoderIDs [B,L] → [B,L,1024]Learned byte lookup; four causal Mamba-2 layers, then network RMSNorm. Every position gets a contextual vector.
Router + gather[B,L,1024] → selected [B,K,1024]Compare adjacent projected encoder vectors; gather those marked b=1. There is no chunk-average operation in the default downsampler.
Main network[B,K,1024] → [B,K,1536] → [B,K,1024]Append a shared learned 512-coordinate vector, run the 22-layer Transformer main network, apply RMSNorm at width 1536, then take the first 1024 coordinates on return.
Dechunk[B,K,1024] → [B,L,1024]EMA over the selected outputs using their selected scores; repeat the latest smoothed vector. The STE factor is 1 in the forward pass.
Residual + decodertwo [B,L,1024] paths → [B,L,1024]Add the learned linear projection of the encoder outputs, then run four causal Mamba-2 decoder layers and RMSNorm.
Byte head[B,L,1024] → [B,L,256]The untied linear head supplies next-byte scores at every original position. Softmax gives a distribution; a generation policy can sample from it.

Shape notation is logical and per sequence: K can differ across batch members. The release handles variable-length inputs using packing/masks; [B,K,D] is not a promise of one rectangular physical layout for every batch.

Exact configuration and head: one-stage Large config · LM wrapper. Widths and layer counts are one concrete release, not universal H-Net constants.

Open the main network, rather than skipping it.

For a Transformer main network, each selected vector becomes an input position. Learned Q/K/V projections and causal self-attention let it use earlier selected vectors; feed-forward blocks transform the resulting features. “Selected” does not mean “understood already.” The main network does the expensive modeling on those selected inputs. H-Net is the surrounding architecture, not a replacement attention equation.

Connected numerical example from supplied encoder states to illustrative next-byte scores. Not checkpoint inference. Actual bytes are [99,97,116,33]. Embeddings E[99], E[97], E[116], E[33] and the trained Mamba encoder are not evaluated. We supply invented two-coordinate encoder outputs. The deepest main stand-in is one causal attention head with Q=K=V=I—not a full Transformer block or T22. Residual W=0.25I; outer decoder=identity; no width expansion or network norms. A two-stage option adds an explicitly invented causal inner encoder and decoder. Head weights are hand-defined. These choices explain composition, not learned segmentation or language ability.

Encoder matrix for the supplied option: [[1,0], [0.8,0.6], selected option, [−1,0]]; its router uses identity Wq/Wk, so strict selection means negative adjacent cosine and the paper/release projection-order difference is hidden. The computed options use the encoder chapter's embeddings, recurrence and non-identity Wq/Wk, so the convention switch changes the actual scores. In the eight-byte two-stage release-convention example the stage-0 selected positions are [0, 2, 3, 4] and the deepest main receives two vectors; under the paper convention the inner stage keeps fewer. The vector selector applies only to the supplied option. Coefficients use ordinary JavaScript arithmetic, not CUDA/dtype equivalence. A single sequence starts at position 0; zero-norm vectors are invalid in this toy.

Tables show a full causally masked four-position calculation, not permission for earlier outputs to see later rows. Change position 2: positions 0 and 1 stay unchanged. “Not selected here” does not guarantee no later selection; later cosine scores are recalculated too.

Where does the second hierarchy go?

Inward: bytes → E⁰ → Chunk⁰ → E¹ → Chunk¹ → M

Outward: M → Dechunk¹ + Linear(E¹) → D¹ → Dechunk⁰ + Linear(E⁰) → D⁰ → byte head

A two-stage H-Net replaces the first stage's main block with another complete encoder/chunk/main/dechunk/decoder system. Stage 1 receives the selected vectors from stage 0, not raw bytes again. Each stage has its own routing scores, selection map, smoothing state and residual. The outer smoother consumes the inner decoder's returned vectors, not the deepest main output directly.

Neither “stage 0 = characters” nor “stage 1 = words” is guaranteed. Those are interpretations of learned behavior, not architectural type constraints. v2 §2.1.

Whole-process takeaway. H-Net learns which contextual vectors the large inner model processes, and how its shorter output informs every outer prediction. Routing alone is not H-Net.

03 / A four-beat reading strip

What can the model know right now?

Read our example one byte at a time. The strip deliberately hides unread positions. A selected position sends its current encoder vector deeper. It does not collect a completed future word.

Predict before clicking: after reading ca, changing the future from t! to r! should leave all earlier results unchanged.

A teaching choice, not information given to the model.
Outer path · every byte
Deep path · selected positions

Separate scalar zoom, not the complete trace above. Invented scores: [1, 0.2, 0.8, 0.1] by default. Hypothetical main outputs at selected positions: 2 and 10. We compute selection and smoothing here, not learned encoder or main-network vectors.

Notice that the “outer path” count increases even when the deep count does not.

Takeaway 03. Causal means “no unread future.” Waiting deeper does not mean waiting everywhere.

04 / Open the selector

Which positions get the deeper update?

The router compares neighboring contextual representations and produces a score between 0 and 1. A large score signals a change. The released code keeps a position when its score is strictly greater than 0.5; the first position is forced to be kept.

In this toy we choose the score ourselves. Keep the four input bytes fixed for this experiment, and change only the score at position 2. That isolates the decision from everything else.

Predict: at exactly 0.50, will position 2 be kept? Make your prediction, then set the score.

Notice what crosses the gate: a vector of numbers at one position, not a string token. An earlier unselected byte can still influence a later encoder vector through the causal encoder.

Notice this: in the authors' routing panel, each little circle sits above a contextual vector. The diagonal arrows compare neighboring vectors—not whole words.

Cropped official routing panel: adjacent vector pairs feed circles representing boundary scores.
Read it bottom to top: vectors → neighboring comparison → score p. Takeaway: our hand-set 0.8 stands in for one learned score.
Official H-Net figure, panel (a), cropped from the authors' PNG; Hwang, Wang & Gu (2025), repository © 2025 brwa-cartesia, MIT. Exact crop and hashes. Not simulated model activity.
Why a “change” score? Show the source distinction.

The score derives from cosine similarity of learned projections of adjacent encoder states. Similar directions give a low score; different directions can give a larger score. This is not a word-boundary detector with a dictionary.

Paper §2.2.1 / Eq. 4 writes p = (1 − cos(Wq x_current, Wk x_previous))/2 and uses p ≥ 0.5. The pinned release compares Wq x_previous with Wk x_current and uses strict p > 0.5. Learned unequal projections can make the scores differ. This lesson's toys use the release's strict decision; they do not simulate the learned projections.

Open the retained angle and paper/code lab ↓

Takeaway 04. The router learns which contextual positions to retain; it does not wait to recognize whole words.

05 / One number before a whole vector

How do we avoid an abrupt replacement?

Suppose the previous smoothed deep value is 2. At position 2, the main network hypothetically returns 10. Rather than completely replacing the old value, H-Net uses the routing score to mix old and new.

For now we use one number instead of a whole vector. Both numbers are invented, not the byte IDs 99 and 116.

Predict: with score 0.8, should the result be closer to the new 10 or the old 2?

New contribution0.8 × 10 = 8
Old contribution0.2 × 2 = 0.4
8.4

These controls share the score with the selector above. Below or at 0.5, the new main output is not consumed: the correct result is “reuse 2,” not an interpolation with 10.

Notice the two jobs of the score: it decides whether to keep a position, and—at a kept position—weights the smoothing update.

Notice this: each upper square receives one arrow from the new output below and one from the preceding smoothed state on the left.

Cropped official smoothing panel: a chain of smoothed vectors receives new selected outputs weighted by P, and previous state weighted by one minus P.
Read it left to right: the horizontal weight is 1 − P; the incoming new value has weight P. Takeaway: 0.2 × 2 + 0.8 × 10 = 8.4 is one coordinate of this recurrence.
Official H-Net figure, panel (c), cropped from the authors' PNG; Hwang, Wang & Gu (2025), repository © 2025 brwa-cartesia, MIT. Exact crop and hashes. Illustrative static source material.
Generalize the one-number calculation to vectors.

At selected index j, each coordinate uses the same scalar weight: smoothed[j] = P[j] × main[j] + (1 − P[j]) × smoothed[j−1]. This recurrence is evaluated over selected positions, not all original byte positions.

Our first selected value is exactly 2 in the unclamped conceptual toy. The released kernel clamps selected scores to [0.0001, 0.9999], so numerical execution has small differences. The retained dry-run offers the kernel-clamp option.

Open the full editable numerical trace ↓

Takeaway 05. Smoothing blends selected deep outputs; it does not secretly process skipped positions.

06 / Return to every position

If the deep value repeats, why don't predictions repeat?

After processing fewer positions, we need one coarse value per original byte position again. Reuse the most recent smoothed value until another selected position arrives. This is causal repetition, not recovery of deleted bytes.

Separate scalar dechunking toy · values update with the shared score
Position / byte0 / c1 / a2 / t3 / !
Deeper update?yesnoyesno
Restored coarse value228.48.4

But the coarse path is only half the story. The encoder also sends a projected fine-detail residual directly to the decoder at every position. “Residual” just means an additional signal added to the coarse one. The decoder still updates on every byte, and its output head still scores the next byte.

Predict: hold the coarse vector fixed. Can changing only the fine detail change the next prediction? Try it.

New zoom level: to illustrate addition and an output head, switch from the earlier scalar 8.4 to a separate invented two-number vector [2, 1]. This is not a conversion between those examples.

[2, 1]fixed coarse+[0, 0]=[2, 1]

Identity toy decoder; three invented candidate IDs A/B/C, not actual letters or trained predictions. The real byte-level head has 256 scores. Our head computes logits [first coordinate, second coordinate, −their sum], then softmax.

Takeaway 06. A reused coarse state does not force reused predictions: the fine-detail path and decoder still change.

07 / Connect the toy to the real design

Where are those operations in the authors' figure?

Now open the real architecture, after the small example makes its arrows meaningful. This is the official H-Net repository's static architecture figure—not a live simulation and not our drawing.

Notice this: start at the bottom-left E, climb through the shorter middle, and finish at the top-left D. The right-hand panels open the operations we just computed.

Official H-Net architecture: encoder E at bottom, chunking, recursively nested main network M, dechunking, decoder D at top; right panels show routing, downsampling, smoothing and upsampling.
How to read it: (a) scores neighboring vectors; (b) retains selected vectors; (c) blends returned vectors with past smoothed state; (d) repeats the latest smoothed vector back to the original positions. E = encoder; M = main network; D = decoder. The circles marked c at the upper right are confidence/straight-through factors, not byte values. The large left blue block can itself contain another H-Net, which makes the hierarchy recursive.
Takeaway: our four-byte example is one stage of a design that can nest the same idea.
Official figure: H-Net project / Sukjun Hwang, Brandon Wang & Albert Gu (2025). Repository copyright © 2025 brwa-cartesia. Pinned original · MIT notice · Revision, hash & reuse evidence. Original PNG, unmodified.

Read the official panels again using the separate scalar lab's default score of 0.8: two selected outputs instead of four original positions, one blend producing 8.4, then restoration to [2, 2, 8.4, 8.4]. The full figure uses its own example and more positions; its colors are not our toy's byte IDs.

The authors' own explanation of an easily missed problem: a returned chunk representation can be misaligned with the position that needs it.

Official paper Figure 2 compares oracle tokenization with hard routing without smoothing and routing with EMA smoothing for the text new product. Boundary probabilities and colored representations illustrate how uncertain selection can misalign returned states, and how smoothing mitigates that problem.
Read the three cases: the oracle panel is a comparison, not H-Net's algorithm. In the hard-routing panel a small boundary-score change can switch which contextual vector reaches the main network. The smoothed panel blends selected returned vectors instead of abruptly replacing them. Labels describe contextual information in vectors; they are not dictionary tokens or evidence that a selected current vector contains unread bytes. This paper illustration uses its own example and inclusive-threshold convention; the public implementation rejects an exact 0.5 tie.
Takeaway: selecting a position is not the same as constructing a completed future chunk at that position.
Figure 2, Hwang, Wang & Gu, Dynamic Chunking for End-to-End Hierarchical Sequence Modeling, arXiv:2507.07955v2 (2025). Original figure and caption · Original PNG · CC BY 4.0. Unmodified source image; explanatory caption is ours. Attribution and reuse record.
What is learned, and what have we not simulated?

The embedding, encoder, router projections, main network, residual projection, decoder and prediction head are learned jointly. Training uses next-byte prediction plus a ratio-targeting auxiliary loss and gradient estimators around hard routing. Smoothing supplies a differentiable path through the routing scores; it does not make the discrete choice exactly differentiable.

We have not run trained weights. Our widgets reuse validated toy selection, smoothing and head arithmetic. Neither our chosen scores nor our invented vectors prove that a trained model will segment a particular sentence in the same way. Real learned boundaries can be context-dependent and need not match words.

Open training, straight-through estimation and ratio-loss labs ↓

Takeaway 07. The toy explains the operations; the official figure shows how they compose and recurse.

Close the loop / learning and autoregressive generation

How can a hard choice learn? What happens at the next byte?

So far we have described a forward calculation. Training adds a target: after input c, score the true next byte a; after a, score t; after t, score !. These targets shift by one position. Our four-byte fixture has no supplied target after !, so it excludes that last row from its demonstration loss. Real training uses the surrounding data and the training sequence conventions.

Prediction loss: LAR = −mean(log probability of the true next byte).

Total: L = LAR + α ΣsLratios. Paper α = 0.03; there is one auxiliary term for each chunking stage.

Hard gather has no ordinary derivative telling the router “keep this other position instead.” H-Net does not magically solve that with backpropagation through an exact discrete choice. It uses two routes for a surrogate training signal:

  1. Smoothing: selected scores P multiply new and previous states, so changing a selected score changes the returned state continuously while the selection mask stays fixed.
  2. Straight-through estimation (STE): ct = pt when selected, otherwise 1−pt. Multiply the repeated coarse vector by c + stop_gradient(1−c). Its forward value is 1, but its backward derivative with respect to c is 1. This is an intentionally biased gradient estimate, not the true derivative of the hard router. It gates the coarse branch, not the residual.

The ratio term discourages an unhelpful “send everything deep” solution and targets a chosen compression ratio N. For each stage F = mean(b) and G = mean(p):

Lratio = N/(N−1) · [(N−1)FG + (1−F)(1−G)]

F is computed from hard selections; gradients flow through G here. N is a training target, not a demand for exactly N bytes per chunk. Only along the special line F=G does this expression have its minimum at 1/N. It is not a universal “loss ≥ 1” theorem. The retained ratio-loss lab exposes the actual equation and partial derivative.

Follow one learning step by hand.

Here is the smallest connected version of the claim “the router learns from next-byte error.” We give the router one trainable number, φ: it rotates Wk. Everything else—embeddings, Wq, the tied toy head, the attention stand-in—stays fixed. The page then splits the derivative into the parts that can be differentiated and the part that is a declared surrogate.

One local derivative, not training. One stage, release convention, hard selection mask frozen while differentiating, central differences with ε = 10−6, and one parameter step. The gate derivative is also checked against independent softmax calculus. No optimizer state, mini-batches, other parameters or generalization are involved.

Read the table in this order. A skipped position still has a confidence c = 1 − p. Its forward gate is exactly 1, so ordinary differentiation of the forward pass sees no effect from the gate. The straight-through rule substitutes a backward derivative of 1 for the gate, so the router receives a signal from every position. Because dc/dp = +1 when retained and −1 when skipped, the local surrogate term is (2b − 1) × dL/dgate × dp/dφ. It is an estimator, not the derivative of the hard router. Try cot!: at a small step the surrogate-driven change does not improve the immediate fixed-mask loss; larger steps change the hard mask, which fixed-mask calculus cannot predict.

One byte at a time: which state advances?

Public-release decode step: each incoming sampled byte is consumed before predicting the following one
ComponentAt every outer byte?State and work
EncoderYesAdvance causal Mamba state; produce the current contextual vector.
RouterYesCompare with the immediately previous incoming encoder vector—even if that previous position was skipped. Remember the current vector for the next comparison.
Inner/mainOnly when selectedAdvance its Transformer KV cache or nested state on its own shorter clock. A nested stage may decide not to advance its own deeper main.
DechunkCalled each stepOn a boundary, update smoothed returned state; otherwise reuse it. This is not a new deeper-model computation.
Residual + decoder + headYesAdd the current projected detail; advance the decoder; produce the next-byte logits.

Prefill first: consume the prompt and construct encoder/router/main/dechunk/decoder caches. Use the last prompt logits to sample one byte; consume that byte in the next decode step. Public LM step explicitly requires batch size 1; do not generalize this demonstration to arbitrary batched serving. The router remembers the previous incoming vector, not the last selected one.

Learning versus inference. Training changes weights using prediction and ratio losses. At generation, weights stay fixed; data-dependent routing changes which inner states advance.

Evidence for the design / what happened when parts were removed

Why these particular primitives?

An operation can be correct without being necessary. Paper v2 includes controlled removals and replacements. They support specific design choices in the tested settings; they do not prove every component is uniquely optimal or that every result transfers to another modality.

Author-reported component evidence, not reproduced here
Changed componentWhat the authors comparedReported effectWhat it does and does not show
EMA smoothingReplace smoothing by direct upsampling (“w/o smoothing”) in the H-Net 2-stage ablation, Large scale, FineWeb-Edu (§3.3, Fig. 7).Compression ratios fluctuated severely during training and performance degraded substantially; the authors call smoothing essential for stable training.Supports smoothing as the most important of the three removals tested here. It does not show EMA is the only possible fix.
Cosine-similarity routerReplace adjacent-vector similarity with direct probability prediction from individual inputs.Less critical than smoothing, but important for stability and final performance; the authors report more consistent compression and more interpretable chunks.Supports comparing adjacent representations. “Interpretable” is the authors' qualitative reading, not a guarantee of word boundaries.
Straight-through estimatorSkip the STE in Eq. 9 (“w/o STE”).Also less critical than smoothing, but contributes to stability and final performance. §2.2.2 says the model already performs well without it, with additional improvement when included.Supports STE as a helpful estimator, not a necessity for any chunking behavior.
Downsampling by gatherDefault gather versus max pooling, mean pooling or cross-attention, with and without boundary residuals (Appendix E.1, Fig. 13).The simple default performed on par with the alternatives.“On par” means extra pooling machinery was not shown necessary; it does not claim gather is superior. This is why the encoder-state chapter matters.
Encoder/decoder layersM4-M4, M2T1-T1M2, T1M2-M2T1 and T2-T2 on raw bytes with H-Net (1-stage) (§3.3, Fig. 8); additional DNA ablations in Appendix E.3.The authors report Mamba-based encoders/decoders significantly outperformed Transformer layers in text. In HG38, M3T1 slightly beat pure M4; they state a Transformer in the encoder did not help text and the DNA result may be modality-specific.Supports the Mamba-heavy outer networks for these tests. It does not transfer unchanged to every modality or sequence length.

Experiment details: §3.3 says the component ablations use Large scale trained on 36B FineWeb-Edu tokens; the displayed Fig. 7 x-axis is total training bytes. Statements above are taken from the paper's text and figure captions; this page does not re-plot, reproduce or independently remeasure the curves.

Operational explanation versus empirical rationale. The earlier chapters explain what each primitive computes. This table explains why the authors kept them, and how strong each piece of evidence is.

Practical limits stated by the authors

What does the paper say the approach costs today?

The earlier compute calculator is deliberately narrow. Paper v2's §4 adds scoped engineering observations that matter when deciding whether to use the architecture:

  • Training speed. The authors say their current implementation may be “approximately up to 2× slower than an isotropic model during training.” This is an author-reported implementation observation, not a universal slowdown or an inference benchmark.
  • Dynamic memory. Memory use depends on the data-dependent number of selected vectors. They warn an unlucky batch can overflow device memory.
  • Batched stepping. Different batch items can require different amounts of compute at a decode step. The pinned public language-model step additionally requires batch size 1.
  • Interpretation. The authors believe these are not fundamental and compare them to early engineering costs of other conditional-compute methods. That is their expectation, not measured evidence here.
What needs measurement for a chosen release and workload
QuestionMeasureWhy the inner-length calculation cannot answer it
Is training faster?Tokens or bytes per second at matched quality and hardwareOuter encoder/decoder, routing, dynamic packing and kernels all cost time.
Will it fit?Peak memory distribution over real dataMemory depends on the learned selection rate in each batch.
Is serving cheaper?Latency and throughput for the intended batch sizeThe public step path is single-sequence; batched dynamic work is unresolved in the source.

Less inner work is not the same as a better system. Treat the analytic reduction as an opportunity and the paper's engineering observations as scoped warning evidence.

Before comparing results

What do these numbers actually measure?

Bits per byte (BPB) converts a model's total negative log likelihood (natural-log units, “nats”) into a cost per byte of text: BPB = total NLL in nats ÷ (bytes × ln 2). Lower is better. It is a likelihood measure, not accuracy and not speed.

Same likelihood, different units: a tokenized model can have a larger loss per token and the same BPB. Therefore equal token loss does not mean equal byte loss. A token model's likelihood for one canonical tokenization is also at most the string's total likelihood (the string can have other tokenizations), so using one tokenization can only overstate NLL. Part II's prompt-boundary/marginalization correction is about this evaluation issue.

The reported comparisons answer different questions
SourceMeasured quantityComparison conditionDo not conclude
Paper v2 §3Validation BPB on FineWeb-Edu; zero-shot task accuracies and their averageMatched training data and FLOP budgets at Large and XL; parameter counts differAccuracy gains are not BPB gains; matched training FLOPs are not matched latency or parameters
Cartesia Part ICompute-equivalent advantages: about 1.28× to validation loss and 2.06× to the OLMES-based downstream measure in the carefully matched one-stage ladderControlled byte-versus-BPE ladder; separate, less tightly matched two-stage comparisonThese are not speedups, not accuracy points and not production latency. The blog, not this page, defines the exact OLMES task mix.
Cartesia Part IILoss-to-loss: validation BPB against downstream behavior, with compute-to-loss kept separateControlled comparison of byte, BPE, BPE-NP, BLT-like and H-Net models; special correction for the BPE-NP prompt-boundary issueA better pretraining loss does not automatically give the same downstream result; interpretation as “understanding” remains a hypothesis

Name the denominator. Before using any improvement, ask: loss or accuracy, bytes or tokens, validation or downstream, compute-equivalent or wall-clock, and which comparison conditions were controlled.

Read the sources without merging different models

What do your two Cartesia blogs add?

Both supplied blogs are dated October 28, 2026. Part I explicitly describes a “much improved version,” calls the earlier published model LH-Net (“lazy” or “lookahead”), and says the improvements are planned for release. We audited the public code at the pinned revision, not an unpublished internal model. We cannot invent equations for the latter or claim that our widgets reproduce it.

Each source answers a different question
SourceUse it forDo not assume
Paper v2 · July 15, 2025Recursive architecture, cosine routing, selected-vector downsampling, EMA/STE, ratio loss, original experiments and limitations.The original model already contains every improvement reported in 2026. Historical benchmarks are not new local measurements.
Public GitHub · 3673fe1Actual operation order, strict ties, coefficient clamp, width/norm placement, caches, release configurations.The implementation exactly follows every notation/tie in the paper, or implements undocumented internal changes.
Part I · Scaling Hierarchical NetworksImproved internal architecture, controlled scaling ladders, dynamic contextual/in-context chunking, original-versus-improved discussion.Its qualitative chunk examples or compute claims are output from the public 2025 checkpoint or our fixture.
Part II · Learning from Raw DataCompression versus transfer, role of pretokenization, byte/token comparisons, proxy boundaries versus joint learning.Compression alone causes understanding; a BLT-like controlled baseline is the complete original BLT; compute ratios imply latency ratios.

1 / “Lookahead” does not mean leaking an unread byte.

Part I says the older model can draw the boundary only after seeing the beginning of the next chunk. That is a statement about chunk alignment and when a useful representation becomes available. The public autoregressive implementation still consumes only current and past input. A vector selected on the current byte can summarize earlier context; a color band labeled with a chunk must not be interpreted as a complete future word embedded at its start. The paper's Figure 2 above makes this alignment problem visible.

2 / A shorter sequence is not automatically a better representation.

Part II removes the hand-crafted regex pretokenization step from BPE in a controlled baseline, BPE-NP. Its BPE merge vocabulary is still corpus-learned. It compresses more yet can transfer worse in their experiments. So “the inner sequence is shorter” is not a sufficient explanation of quality. Which boundaries are chosen, and how they are learned with the model, matters.

3 / Separate compute → loss from loss → downstream performance.

Part I's controlled one-stage ladder reports about 1.28× compute-to-validation and 2.06× compute-to-OLMES advantages. These are historical author-reported research comparisons, not measured speedups on your machine, and not inference latency. The larger two-stage comparison has different parameter counts, data/cooldown controls and approximately matched FLOPs per byte; it is not an otherwise identical production race.

Part II then asks whether equal validation loss produces equal downstream results. Its transfer curves and proxy/frozen-boundary comparisons support the value of end-to-end learned boundaries under those tested budgets. “The model understands semantics better” remains an interpretation or hypothesis, not a proven causal mechanism.

4 / Context adaptation is not an optimizer step.

A learned router can produce different boundaries for the same characters in different prefixes, including an in-context example. That changes activations and decisions with fixed weights. It does not mean the model retrains itself while you type.

Evaluation caveat from Part II: canonical tokenization need not represent the full probability of a byte string. Their BPE-NP comparison uses a prompt-boundary/marginalization correction; standard BPE curves generally do not receive that same correction. Do not mix the corrected and uncorrected quantities without saying so.

Use the authors' interactive figures as primary references.

Open Part I for Figure 1's architecture, training dynamics, language/code chunk examples and in-context tokenization; open Part II for the scaling-law selector and boundary-learning comparisons. These are linked rather than rehosted: no separate reuse permission for the blog artwork was established. Our local images are the explicitly licensed repository/paper figures, not an imitation of the authors' interactive components.

Source-grounded conclusion. We can explain and compute the 2025 public mechanism. We can explain what the 2026 authors report and how their comparisons are scoped. We cannot silently turn that into a verified implementation of their improved internal model.

08 / Put the pieces back together

Can you retell the whole trip?

  1. Read every byte. An encoder creates contextual vectors without seeing the future.
  2. Choose some positions. A learned router retains selected vectors for the deeper main network.
  3. Process the shorter sequence. The causal main network transforms gathered vectors, or a nested H-Net runs its own full inward/outward computation.
  4. Blend and restore. Smooth the selected outputs, then repeat the latest one at original positions.
  5. Add detail and predict. Combine coarse state with the every-position residual; the decoder and head predict the next byte.

Final prediction: at position 1 (a), our toy does not select a deeper update. What happens?

Three boundaries of the idea

  • Not word tokenization in disguise. Selected items are continuous contextual vectors, not dictionary entries for completed words.
  • Not lossless decompression. Restoring the number of positions is not reconstructing the original input from the coarse path alone.
  • Not an automatic speed promise. Fewer inner positions can reduce inner work. Outer work, kernels, caches and hardware still matter; the toy counts are not latency benchmarks.
Return to the whole picture ↑

Takeaway 08. Every byte keeps its own outer computation; only the expensive inner sequence gets shorter.

You have followed the source-defined process and a connected synthetic trace. This is not a trained-checkpoint run, an implementation of the undisclosed newer internal model, or every result in the paper. Open a precise lab below to examine a specific component.

Optional same-page reference chapters

Keep going only where you're curious.

The original detailed explanations and numerical labs are preserved here, under their original section anchors. Repetitive page headers/navigation and the mandatory miniature-town presentation are not part of this reading path. The original source documents are preserved byte-for-byte in original-material.

A · Slower numerical examples8 retained sections · byte reader, smoothing, detail/head, nesting, gradients and checks
1 / START WITH A SMALL PROBLEM

Should the biggest network work on every byte?

Imagine the input is cat!. Because these four characters are ASCII, it is four bytes: 99, 97, 116, 33. A byte model must still produce a next-byte prediction after every input position.

Option A: a large stack at every byte

The same large model processes c, then a, then t, then !. It has four positions to process.

This is straightforward, but a long document has many byte positions. Large-network work can be expensive.

Option B: H-Net's two paths

A smaller outer network still reads all four bytes. A learned router may send only selected contextual vectors into the larger inner network.

The decoder uses both the latest inner result and the fine-detail path. It still produces a prediction at every byte position.

“Skip the deep update” does not mean “skip reading the byte.”
It means the outer path updates, while the larger inner path can keep its previous state.

In the worked example below, deeper updates occur at c and t. This is a manually chosen teaching pattern, not a claim that trained H-Net splits this word that way.

Fewer deep updates explain the efficiency idea. They do not prove lower real latency, and they do not mean fewer model weights need to be stored.

2 / TRANSLATE THE ARCHITECTURE TERMS

What do these names mean in plain English?

Embedding: turn a byte ID into numbers

A byte such as 99 is an index, not a meaning. The learned embedding table maps it to a list of numbers called a vector.

If the toy width is 2, a vector has two coordinates. The released Large model's outer width is 1024. Coordinates are learned; they are not named fields such as “word” and “emotion.”

Encoder: read the byte with its past

The encoder processes the current vector using already-seen context. Its output is a contextual vector.

After reading a in ca, that vector can depend on both c and a. It cannot depend on the unread t. It is not guaranteed to store a perfect copy of the prefix.

Router and downsampler: choose positions

The router gives a confidence score. The released code selects a position when its score is greater than 0.5; the first position is always selected.

The downsampler is the gather operation: it keeps those encoder vectors in order. It does not average a future word.

Main network: process the selected sequence

The larger network sees the selected contextual vectors, in causal order. It performs its own learned computation on that shorter sequence.

It does not receive the unselected vector as another position. But selected vectors may carry information about previously seen, unselected bytes through the encoder.

Dechunker: bring the inner result back

It smooths a newly returned inner vector with the previous smoothed vector. Between selected positions, it repeats the latest result.

“Upsampling” means restoring the number of positions, not reconstructing an exact original string or increasing numerical precision.

Fine-detail path, decoder and head

A learned projection of every encoder vector bypasses the shorter path. This is the skip/residual path. It supplies current fine detail.

The decoder combines that detail with the repeated inner result and uses its causal state. The output head maps its vector to 256 next-byte scores.

A packet shape such as [1,4,2] means: one example, four positions, two coordinates at each position. Shortening to [1,2,2] changes the number of positions from four to two; it does not necessarily change the vector width.

3 / REVEAL THE INPUT ONE BYTE AT A TIME

Read cat! without peeking into the future.

Press “Read next byte”. Unread bytes stay hidden. The display tells you the prefix that has been read; that label is teaching metadata, not literal text stored inside a real neural vector.

Other fixed toy scores: position 0 = 1, position 1 = 0.2, position 3 = 0.1. This slider also drives the smoothing/training examples below. It is not a trained router or a learned segmentation result.

At “a”, what is skipped?

After reading ca, the outer encoder has updated twice. Its second vector may contain information about both bytes.

With the toy score 0.2, the second vector is not sent deeper. The repeated inner result is still 2. The current encoder vector and the decoder state are not frozen.

At “t”, what is sent deeper?

With the toy score 0.8, the third encoder vector is selected. It can depend on the already-read prefix cat. The main network returns a new hypothetical scalar value 10.

The smoother blends this with its previous value 2, giving 8.4. The model does not send the character string “cat” as a new dictionary token.

Try a causal counterexample

Stop after reading ca. Change the prepared input from cat! to car!. The read prefix, byte IDs and toy coarse state remain identical. The different third byte must not affect an earlier causal state.

The toy uses the same invented scores and values for both inputs, so it also does not model how a trained encoder might react differently after the third byte. This experiment tests no future peeking, not semantic understanding.

4 / SMOOTHING WITH ONLY TWO NUMBERS

Keep some old information. Add some new information.

Assume the old smoothed value is 2 and a selected new main-network value is 10. The confidence p controls their blend.

At p = 0.8, take 80% of 10 and 20% of 2:

0.8 × 10 = 8 0.2 × 2 = 0.4 8 + 0.4 = 8.4

At p = 1, use the new value entirely. At p = 0.6, use 60% new and 40% old. At p ≤ 0.5, this toy position is not selected under the code convention, so there is no new deeper update and the result stays 2.

Linked to the router slider above

new × p
old × (1−p)

Bars show the effective blend weights. When the position is not selected, effective new weight is 0 and old weight is 1. The real module smooths full vectors coordinate by coordinate; these scalars isolate the arithmetic.

Why repeat the same value?

With p = 0.8, the inner path updates at positions 0 and 2. Its smoothed values are [2, 8.4]. Returning to four positions gives:

position: 0 1 2 3 byte: c a t ! deep update? yes no yes no repeated value: 2 2 8.4 8.4

Position 1 reuses the newest available inner value, from position 0. Position 3 reuses the value from position 2. This is a causal hold: never pull a value backward from a future position.

The first selected score is 1 and the initial smoothed state is 0, so the conceptual first EMA equals the first main output. The released kernel clamps scores slightly away from 0/1; this beginner example omits that numerical detail.

5 / THE MOST COMMON CONFUSION

“If the inner value is repeated, won't the prediction repeat too?”

No. Only one input to the decoder is repeated. The fine-detail input can change at every byte, and the real decoder has its own causal state.

A complete, deliberately tiny arithmetic example

Hold the coarse vector fixed at [2,1]. Change a projected detail vector [0,d]. Add them to get [2,1+d].

To isolate the addition and head, use an identity decoder in this toy: its output equals its input. A real H-Net decoder is a learned sequence network, not identity.

Our toy head has only three candidate IDs A, B and C; they are labels, not the letters in cat!. A real head scores all 256 byte IDs.

Whead = [[ 1, 0], [ 0, 1], [-1, -1]] shape [3,2] logits = Whead × [2,1+d] probability = softmax(logits)

These weights are invented. The example proves that differing detail can change scores even with a fixed coarse input. It does not demonstrate a trained model's next-byte accuracy.

Slide d while the coarse vector stays fixed. The probabilities change because the head receives a different combined vector.

Softmax converts arbitrary scores into nonnegative probabilities that sum to 1. It is not choosing a new chunk; it is producing a next-symbol distribution.

H-Net preserves two routes: coarse contextual processing and current fine detail. Their coexistence is why shorter deep sequences do not force repeated byte predictions.
6 / TWO STAGES WITHOUT THE BIG DIAGRAM

The same idea can happen again inside.

Start with six encoder vectors e₀ … e₅. Their labels mark positions, not semantic types. Assume the first router selects positions 0, 2 and 4.

Going inward: 6 → 3 → 2

Outer sequence: 6 positionse₀, e₁, e₂, e₃, e₄, e₅First router keeps e₀, e₂ and e₄.
↓ gather selected vectors; inner encoder processes them
Inner sequence: 3 positionsf₀, f₁, f₂These are new contextual outputs, not merely renamed raw bytes. Second router keeps f₀ and f₂.
↓ innermost network receives 2 vectors
Deepest sequence: 2 positionsf₀, f₂ → main network → g₀, g₁Expensive processing now has two positions rather than six.

Coming outward: 2 → 3 → 6

Smooth g₀, g₁ → u₀, u₁repeat to [u₀, u₀, u₁]This restores three positions. Add the three-position skip, then run the inner decoder.
↓ inner decoder gives three outputs
Smooth those outputs → v₀, v₁, v₂repeat to [v₀, v₀, v₁, v₁, v₂, v₂]This restores six positions. Add the six-position skip, then run the outer decoder.
↓ output head scores the next byte at each position
Six original-resolution outputsone prediction distribution per original positionWe restored length, not an exact inverse of discarded vectors.

Nothing requires the first stage to be “letters to words” and the second to be “words to sentences”. Those are possible interpretations of learned patterns, not supervised stage definitions. Each stage selects positions in the sequence it actually receives.

Where does a score such as 0.8 come from in the real router?

It comes from the direction of two learned, projected contextual vectors—not from comparing raw byte IDs. In a two-coordinate example, use previous vector [1,0] and current vector [−0.6,0.8], with identity projections. Both have length 1; their dot product is −0.6, so their cosine similarity is −0.6.

p = (1 − cosine) / 2 = (1 − (−0.6)) / 2 = 1.6 / 2 = 0.8 → selected under p > 0.5

This is a tiny numerical example of the actual similarity rule, not evidence that “t” produces those coordinates. The encoder and projections learn these numbers during training. Explore the angle slider →

7 / LEARNING, ONE SMALL PIECE AT A TIME

What tells the router to change?

The actual training objective rewards better next-byte prediction and adds a compression-budget penalty. It does not provide a correct boundary label for every word. Below, isolate only the smoothing gradient using a toy numerical target.

Suppose we want the blend closer to 9

At p = 0.8, the blend is 8.4. Moving p up gives more weight to 10 and less to 2, so the blend increases.

blend = p×10 + (1−p)×2 = 2 + 8p toy squared error = (blend − target)² derivative with respect to p: 2 × (blend − target) × 8

With target 9, the derivative is −9.6. Gradient descent subtracts a negative number, so it raises p. With a small step 0.01, p becomes 0.896; the blend becomes 9.168 and squared error falls from 0.36 to 0.028224.

This is only a fixed-selection derivative. It is not exact differentiation through the decision to gather a position. The actual model also backpropagates through many layers.

The score is shared with the reader. The step is allowed only when it stays above the selection threshold and inside [0,1]. Invalid fixed-selection steps are explained, not silently clipped.

Why also use a straight-through estimator?

A hard keep/skip decision does not have an ordinary useful derivative at the switch. H-Net adds a surrogate gradient path using decision confidence.

Its gate equals 1 in the forward pass, so it does not shrink the repeated vector. In the backward pass, the gate passes a gradient to confidence. This is a training device, not another averaging operation.

The detailed chapter below includes the exact STE equations and code/paper distinctions.

Why also penalize the compression ratio?

Always keeping everything removes the efficiency benefit. Keeping almost nothing may discard useful context.

The ratio loss encourages a target average retained fraction. “Target 3 positions per chunk” does not mean split every third byte, and it does not guarantee every example attains exactly that average.

For six inputs, the actual router might keep two, three or another number depending on learned scores. The regularizer shapes training; it does not impose a fixed stride.

8 / CHECK THE MENTAL MODEL

Answer these before exploring the detailed chapter.

If “a” is not selected, does the model ignore “a”?

No. The encoder and decoder still update at that byte. Its information can also influence a later selected encoder vector. Only its direct position in the inner input sequence is omitted.

Does the vector selected at “c” represent the complete word “cat”?

No. At “c”, “a” and “t” have not been read. The vector depends on the current prefix and earlier context. A later selected vector at “t” can depend on “cat”. Neither vector is a fixed word token.

Does dechunking recover the original encoder vectors?

No. It restores positions using smoothed inner outputs and causal repetition. The separate fine-detail path helps the decoder; there is no guaranteed lossless inverse.

Can the head predict differently if the deep state did not update?

Yes. Current projected detail and the causal decoder state can change. The three-candidate toy explicitly shows different probabilities from one fixed coarse vector.

What is the difference between a chunk and a byte?

A byte is one input/output symbol from the 256-value alphabet. A chunk here is one selected contextual representation used by the inner network. The output head still predicts bytes, not chunk IDs.

Is H-Net routing the same as MoE routing?

No. H-Net selects positions to send deeper into a shared hierarchy. MoE typically chooses experts for positions. Similar regularization ideas do not make the architectures identical.

Does the scalar example show that H-Net understands language?

No. It demonstrates selection, causal state updates, blending and a tiny arithmetic head. Language quality must be evaluated using a trained checkpoint and proper datasets.

Your one-sentence explanation:
“H-Net reads every byte with an outer network, sends selected contextual vectors through a deeper network, and combines its latest result with current fine detail to predict the next byte.”

Explore the detailed architecture → · Editable full trace → · Gradient and ratio-loss details →

B · Architecture, training & source detail9 retained sections · contracts, router, editable trace, training, inference, compute, historical evidence and questions

Pause the precise architecture map's connector motion.

01 / THE PROBLEM AND THE IDEA

Compression is useful. A fixed vocabulary is not the only way.

Ordinary tokenized language model

Text → fixed tokenizer → token IDs → large language model → next token → decode token IDs back to text

BPE chooses chunks using a vocabulary learned before language-model training. Segmentation is not jointly optimized with the language model's next-step objective.

Tokenization makes sequences shorter. Direct byte models lose that efficiency unless the architecture compensates.

H-Net language model

Text → UTF-8 byte IDs → embedding → learned hierarchical processing → next-byte logits → UTF-8 decoding

The byte alphabet is still discrete. What disappears is the fixed subword vocabulary and external segmentation rule—not encoding, embeddings, or next-symbol prediction.

Its chunks are continuous contextual vectors, not new vocabulary IDs. Chunking can depend on the already-seen context.

Byte ≠ character ≠ token

A character such as “é” uses two UTF-8 bytes; many other characters use more. A byte-level decoder can emit a partial character before all its bytes have arrived. This widget encodes text only; it does not predict boundaries.

Teaching plan: understand bytes → follow the hierarchy → calculate routing → reconstruct a toy trace → understand gradient paths → inspect causal decoding → separate analytic savings from empirical results.

02 / ONE MAIN MAP, WITH NESTED BLOCKS

Down the hierarchy. Back to byte resolution.

Choose a released Large configuration. Click any block to see its contract and source. The inner lengths are symbolic: learned boundaries determine them for each example.

Alternate view: precise tensor-contract map with animated connectors

This in-page schematic uses the same light palette. It preserves the exact layer counts, weights, tensor contracts and connector motion alongside the byte-by-byte illustrated article.

Slate: byte interface / fine-detail skipOrange: dynamic chunkingInk arrows: representation flow (decorative motion)

Every stage has two information paths

x̂ˢ = Encoderˢ(xˢ) (xˢ⁺¹, pˢ) = Chunk(x̂ˢ) zˢ = Dechunk(ẑˢ⁺¹, pˢ) + Linear(x̂ˢ) ẑˢ = Decoderˢ(zˢ)

The coarse path supplies expensive context. The projected skip supplies fine-grained information at every original position. Selecting fewer vectors is not a claim that the input was reconstructed losslessly.

What has learned weights?

Byte embeddings, encoder/decoder blocks, inner blocks, router projections Wq/Wk, residual projections and the output head are learned.

Gathering boundary vectors and repeating by cumulative boundary count have no learned pooling weights. Wider stages append a shared learned vector; returning stages take the original leading dimensions.

Shapes: Wq, Wk and residual W are [Dˢ,Dˢ]. Large byte embeddings and untied head are each [256,1024] as stored in PyTorch. Activations are floating-point; byte IDs are integers; masks are booleans.

Paper §2.1 / Eqs. 1–3. The block scaffold follows the interactive flow-diagram template, adapted from service request flows to a full learning lesson.

03 / ROUTING IS A LEARNED SIMILARITY TEST

When projected neighbors disagree, select a vector.

A two-dimensional, identity-projection toy

Set Wq = Wk = I and use nonzero unit vectors. The first vector points at 0°. Change the next vector's angle.

previous

The real router has trainable projections

Paper Eq. 4: qₜ = Wq x̂ₜ ; kₜ₋₁ = Wk x̂ₜ₋₁ pₜ = (1 − cos(qₜ, kₜ₋₁)) / 2 bₜ = 1[pₜ ≥ 0.5] ; p₁ = 1 Released code: pₜ = (1 − cos(Wq x̂ₜ₋₁, Wk x̂ₜ)) / 2 bₜ = 1[pₜ > 0.5] ; p₁ = 1

The paper and code swap which adjacent input receives Wq versus Wk. They agree in this identity-projection toy; they need not agree for arbitrary trained matrices. Code argmax chooses “no boundary” at a tie.

Identical directions → p = 0. Orthogonal directions → p = 0.5. Opposite directions → p = 1. A score above 0.5 means negative projected cosine; the encoder/router learn the geometry.

“Probability” is the paper's informal confidence terminology, not a demonstrated calibrated semantic probability. No rule here says “split at spaces.”

Pinned router and dechunk source
04 / SELECT → PROCESS → SMOOTH → REPEAT

Dry-run the mechanism, not a pretend trained model.

Positions 0–7 stand for a sequence. You provide boundary scores p and scalar hypothetical main-network outputs v. Selected outputs enter the EMA. Values at unselected positions are ignored by the coarse path. The real encoder, main network and decoder are not simulated.

Slate positions are retained. Orange outlines mark the inspected position. The table shows the full causal trace, not future information available to earlier outputs.

Position 0

The EMA lives in selected-position space. Repetition maps it back to original-position space. On a non-boundary, the coarse state stays unchanged while the real outer encoder/decoder still update.

PositionpSelected?Chunk indexv if selectedEMA / repeated valueDecision confidence c
Selected chunk j: z̄ⱼ = Pⱼ vⱼ + (1 − Pⱼ) z̄ⱼ₋₁ ; z̄₋₁ = 0 Original position t: j(t) = Σᵢ₌₀ᵗ bᵢ − 1 ; z̃ₜ = z̄ⱼ₍ₜ₎ Then the real model adds Linear(x̂ₜ), runs the decoder, and projects to next-byte logits.

Default example, unclamped: keep [0,2,4,6] → coarse values [2,10,−4,6] → smoothed [2,8.4,0.96,5.496] → repeat [2,2,8.4,8.4,0.96,0.96,5.496,5.496]. Toggle the code clamp to see its small numerical effect.

Paper §2.2 / Eqs. 5–9. The zero-based indexing here is equivalent to the paper's one-based indexing.

05 / HOW CAN A HARD CHOICE LEARN?

Hard selection in the forward pass. Surrogate gradient paths in training.

Three complementary paths

  1. Smoothing: selected score P directly affects the EMA. For a fixed selection, ∂z̄ⱼ/∂Pⱼ = vⱼ − z̄ⱼ₋₁.
  2. STE: decision confidence c = p for a boundary, 1−p otherwise. STE(c) = c + stopgradient(1−c) equals 1 forward but has derivative 1 with respect to c.
  3. Ratio loss: all scores receive a compression-control signal, including nonselected positions.

Thresholding and gathering remain discrete. This is not exact differentiation through the selected index set; STE is a surrogate estimator. Its usefulness is empirical, not a guarantee of unbiased gradients.

Forward: STE(c) × z̃ = 1 × z̃ Backward, holding z̃ fixed: ∂output/∂c = z̃ Total loss: L = next-byte cross-entropy + α Σₛ Lratioˢ Paper experiments: α = 0.03

Moving p without crossing the threshold does not multiply the displayed forward value by c. That is an easy STE misconception.

Control the compression budget

This calculation uses the current scores from the dry-run. Target N is a training preference, not a runtime command that guarantees exactly N bytes per chunk.

F = mean(b) ; G = mean(p) Lratio = N/(N−1) [(N−1)FG + (1−F)(1−G)] For a fixed hard mask: ∂Lratio/∂G = N/(N−1) (NF − 1)

Curve is the illustrative F = G diagonal, not the actual hard-routing objective trajectory. Its minimum is 1 at F = G = 1/N; off that diagonal, the formula can fall below 1.

The other stability details are not optional decoration

Each encoder, main network and decoder ends in RMSNorm to balance scales. The skip has a separate learned residual projection, with its weight initialized to zero in the inspected code. Width increases use learned padding. Residual initialization accounts for network depth. Stage-specific learning-rate modulation accounts for width and effective sequence lengths. Together these help prevent an unstable router/hierarchy from overwhelming training.

Paper §2.3 · STE, residuals and recursive HNet source

06 / NO FUTURE BYTES REQUIRED

A selected position is a causal event—not the pooled future of a word.

What happens after reading byte t?

  1. Embedding and outer encoder process byte t using past state.
  2. Router compares the previous and current contextual representations.
  3. If bₜ = 1, send the current vector deeper; repeat this choice at nested stages.
  4. Update smoothing only on a selected vector; otherwise reuse its last value.
  5. Add the fine-detail residual, update the outer decoder, emit logits for byte t+1.

Every original byte updates the outer path. Not every byte updates the deepest path. Prefill computes the prompt's causal trace and populates caches; decoding then advances those states.

What does the cache contain?

  • Encoder state: SSM state and/or attention KV.
  • Router state: previous contextual hidden vector plus first-input bookkeeping in this implementation.
  • Main-network state: recursive hierarchy, or innermost KV/SSM state.
  • Dechunk state: last smoothed coarse vector.
  • Decoder state: SSM state and/or attention KV.

There is still autoregressive next-byte decoding. It does not automatically emit a complete learned chunk in one step.

The released LM step() asserts batch size 1. That is an implementation limit, not a mathematical requirement of H-Net.

Resolve the “whole word” doubt

Suppose position 0 is “c”, then “a”, then “t”. If only position 0 is selected, its coarse vector cannot contain the unseen “a” or “t”. The outer causal path still reads them. A later selected position can summarize previously seen context through the encoder. Therefore the vector repeated over an interval is the most recent selected contextual state, not a pooled representation of every byte in that visible interval.

Visual chunk spans are useful bookkeeping, but they do not prove that the selected vector knows future characters or corresponds to a complete word.

07 / USEFUL ANALYTIC SAVINGS, NOT A LATENCY PROMISE

Shorter inner sequences let expensive layers do less position-wise work.

Stage count follows the architecture selector. Ratios here are analytic assumptions, not the ratio-loss targets or measured values from the dry-run.

Compare only the innermost component

Linner ≈ L₀ / r₀ / r₁ (two stages) Same-width position-wise work fraction ≈ Linner/L₀ Same-width global attention interactions fraction ≈ (Linner/L₀)²

This omits outer encoder/decoder work, routing, width changes, normalization, packing, kernel overhead and batching. It does not measure end-to-end FLOPs, peak memory, throughput or latency.

Longer effective reach per inner position is possible, but the model still has trained context limits and must preserve useful information. Compression is not unlimited memory.

08 / WHAT THE 2025 PAPER ACTUALLY SUPPORTS

Promising results under controlled training budgets—not universal superiority.

These are historical, paper-reported results, transcribed from Table 2. They were not reproduced here. Models are matched in training data and FLOP budgets within each scale, not in parameter count. BPB is lower-is-better; average accuracy is higher-is-better.

ScaleModelParams, Table 1FineWeb-Edu BPB7-task average (%)
Large budgetTokenized Transformer760M0.75653.3
Large budgetH-Net 1-stage680M0.75553.6
Large budgetH-Net 2-stage870M0.74355.5
XL budgetTokenized Transformer1.3B0.73055.5
XL budgetH-Net 1-stage1.3B0.72856.2
XL budgetH-Net 2-stage1.6B0.71558.2

What improves?

  • Two-stage models outperform one-stage in the tested settings.
  • Compared with the Large baseline, 55.5−53.3 = 2.2 percentage points in the seven-task average.
  • Compared with the XL baseline, the printed table gives 58.2−55.5 = 2.7 points. Paper prose says 2.6; do not silently erase that rounding/reporting discrepancy.
  • Chinese/code and clean-training noise robustness provide additional evidence. DNA curves show approximately 3.6× less data to match a specified baseline perplexity during the stable phase—not 3.6× less inference compute.

What is not established?

  • Universal improvements over current production LLMs.
  • Guaranteed latency reduction from training FLOP matching.
  • Perfect semantic boundaries or guaranteed better reasoning.
  • Best results on every task: the Large 2-stage PIQA score is below the tokenized baseline.
  • Direct superiority to BLT in a controlled head-to-head: the paper did not set up BLT as a baseline.

Table 1: architecture · Table 2: evaluations · Other datasets

09 / COMPARISONS, LIMITS, AND HOW TO EXPLORE

Keep the distinctions straight.

Is H-Net a Transformer, Mamba, U-Net, or MoE?

H-Net is the hierarchical wrapper and dynamic chunking mechanism. Its sequence blocks may be Transformers, Mamba-2 or hybrids. It resembles a causal U-Net, but uses learned variable-length subsampling rather than fixed spatial pooling. Its router selects positions for deeper processing, not one of several experts. The ratio loss draws inspiration from MoE load balancing; H-Net is not therefore an MoE.

How is it different from BLT, SpaceByte and MegaByte?

MegaByte uses fixed-size grouping. SpaceByte uses delimiter-based selection. BLT uses entropy-based patching with an auxiliary predictor. H-Net trains its contextual boundary scores jointly with the main model using smoothing, STE and ratio regularization. These are mechanism comparisons; they are not a newly run benchmark ranking.

Do later stages represent words, phrases and sentences?

They can learn coarser abstractions, and the paper shows qualitative examples. No loss explicitly labels a stage as “words” or “sentences”. Stage meanings are not fixed or guaranteed. Contextual continuous vectors differ from a reusable dictionary of token strings.

What can go wrong?

Too many selected vectors remove the compute benefit; too few can lose useful context. Hard choices complicate gradients. Smoothing can blur representations. Variable lengths complicate packing and batching. Byte decoding requires more outer updates than token decoding for the same text. Long-range information can be lost in compression. UTF-8 encoding and special-symbol conventions still matter. Training FLOPs do not capture every serving cost.

Can we inspect a real trained H-Net next?

Yes, after agreeing on a compatible checkpoint and compute environment. Start with the official code, run a short inference-mode prompt, read bpred_output, and record each stage's mask/scores. Preserve the checkpoint revision, dtype, byte IDs and causal position mapping. A compatible PyTorch hook or NNsight trace may capture additional tensors; do not assume generic TransformerLens adapters support this custom recursive model. Plot actual outputs in marimo/anywidget or this interface. No such inference was performed here.

What should I try in this lesson?
  1. Set the vector angle to 90° and switch threshold conventions.
  2. In the dry-run, change an unselected “99” value: the coarse result must stay unchanged.
  3. Change 0.6 to 0.49: one selected vector disappears and the reconstruction changes discretely.
  4. Raise a selected p toward 1: the EMA trusts the current output more.
  5. Switch between one and two stages; watch the actual layer/width map and analytic inner work change.
  6. Type “é” in the UTF-8 inspector: one Unicode scalar is two byte positions.