Antivision · Latent Rehearsal
16

The minimum
and the volume

The lecture makes two claims about energy that can be checked with a ruler: that inference is a search for the minimum, and that training an energy-based model means keeping the landscape from going flat. We measured both on our model. The first one caught us where it hurts: there is a setting in which what we called a search by energy did not find the minimum in a single one of the 96 positions tested — and another in which it always finds it, but only because the energy had become the policy itself.

Chapter 16 Prerequisite: 05 (the rudder and the world model) and 13 §1 (dependency energy)

1 The two sentences

From the energy-based models part of the lecture, two claims are checkable and had never been checked here.

The first is about inference. "Inference by optimization, not by forward propagation." Given an x, the compatible y are the ones that minimize the energy; finding them is a search, not a forward pass. And he insists on what that implies: "there's no single y for a given x — it's a relation, not a function", and therefore "you can give me multiple answers".

The second is about training. "To train an energy-based model you have to prevent collapse. The collapse problem would be manifested by the energy function being flat everywhere." And the two ways out: the contrastive one, "you generate points outside the region of data and you push the energy up"; and the regularized one, which he prefers, "minimizing the volume of space that can take low energy".

Why this becomes a chapter now

Chapter 13 §1 built the dependency energy as a minimum over the eight most likely actions from the policy. That was a cost decision, and it was written as one. But "the eight most likely" come out of the token head, which is forward propagation — exactly what the sentence tells you not to use. As long as nobody computed the true minimum, there was no way to know whether the shortcut was harmless or whether it erased the whole concept. Now there is: the vocabulary has 16,392 entries and the model has 256 dimensions, so the exact minimum fits in one batched pass on the CPU.

2 The set you search in

The energy-mode planner (server/ours.py) worked like this, at every token: take the k most likely tokens from the token head, imagine each one in latent space, and reorder them by energy. The missing question is simple: was the true minimum of the energy inside that list?

If it always was, the shortcut is harmless and the discussion ends. If it was not, what we called "inference by optimization" was a reordering of a list that forward propagation had already closed — and the name was wrong.

The script model/inference.py answers that with the exact argmin over the whole vocabulary, and measures three things: coverage (how often the exact minimum is in the top-k), energy left on the table (what the approximation gives up) and how many answers tie near the minimum.

Protocol

Model mini-moderno-reg1-wm1-sz1-duelo. Six sequences of 64 tokens drawn from the validation set with a fixed seed, 16 positions each: 96 searches, each over 16,392 actions. No cherry-picked text. The two energies are measured separately because they answer different questions, and the number from one does not carry over to the other.

3 Dependency energy: the policy misses the minimum in 70% of positions

The dependency energy is the one from chapter 13: given the real pair (zt, zt+1), which action best explains the target. E(zt, z′) = mina ‖Pred(zt, ea) − z′‖² There is no plausibility term: this is the world model on its own.

Coverage of the policy's top-k over the exact argmin, dependency energy. "Energy lost" is how far the top-k minimum sits above the true minimum, as a fraction of it.
kcoverageenergy lost
111.5%+706.6%
830.2%+109.1%
3241.7%+34.9%
12853.1%+9.3%

With the eight candidates chapter 13 used, the true minimum was outside the list in 70% of positions, and the reported energy was twice the real one. Not even 128 candidates — sixteen times the cost — push coverage past half. This does not invalidate the numbers in chapter 13, which measured something else (whether the energy rises on a violation, and it does), but it invalidates reading that minimum as the minimum.

4 Task energy: it depends entirely on the guardrail weight

The generator does not use the dependency energy. It uses the task energy, which has two terms: the heading and the plausibility. E(a) = 1 − cos(Pred(zt, ea), heading) + γ · (−log p(a)) The second term comes from the same token head that produces the top-k. So the weight γ decides whether the question even makes sense — and the answer swings from end to end.

Coverage of the top-k over the exact argmin of the task energy, heading "futebol gol campeonato", by guardrail weight. The last column is the energy lost at top-8.
γk = 1k = 8k = 32k = 128lost at top-8
0 (heading only)0.0%0.0%0.0%9.4%+35.9%
0.133.3%85.4%97.9%100.0%+1.2%
1 (the default)90.6%100.0%100.0%100.0%+0.0%

Read the two extreme rows together, because they form a pair of scissors:

Between the two extremes there is no comfortable point, there is a price: γ = 0.1, which chapter 12 already flagged as "the value that gives the heading a voice", leaves 14.6% of positions without the minimum in the top-8. Either the energy is dominated by plausibility and planning changes almost nothing, or the heading has a voice and the candidate set is nowhere near the minimum. Both ends hollow out the lecture's sentence, for opposite reasons.

What this corrects in what was already written

Chapter 12 records that at γ = 1 "plausibility dominates the energy and the task barely counts". That was right as an observation about the result. What had not been measured is the consequence for the method: at γ = 1 the search is superfluous, and at low γ it is insufficient. The problem was never the weight; it was the set being searched.

5 A relation, not a function: how many answers tie

The other half of the sentence is that there is no such thing as the answer. With the exact minimum in hand, you can count how many actions land within 1%, 5% and 10% of it.

Mean number of actions within a margin of the minimum, among the 256 lowest-energy ones. The median is in parentheses.
energy≤ 1%≤ 5%≤ 10%
dependency (world model)1.4 (1)12.9 (3)40.6 (6)
task, γ = 02.2 (2)35.5 (28)136.9 (119)
task, γ = 0.11.4 (1)4.1 (2)12.1 (6)
task, γ = 11.1 (1)1.4 (1)1.9 (1)

The reading is direct, and it is the lecture's: the more the energy is only the heading, the more it describes a set; the more it is the policy, the more it becomes a function. At γ = 1 there is essentially a single answer — which is another way of saying that this is no longer an energy model, it is a probabilistic model, which the talk itself classifies as the special case.

One concrete example, in the same position, shows both sides. The context ends in our mindset,” and the token that actually came was Ash. By dependency energy, the five lowest-energy actions are ro, pl, tr, pr, gl, all between 0.1628 and 0.1648 — five syllable openings that carry the state to nearly the same place, and none of them is the real token. By task energy at γ = 0, the top five are ac, oc, ú, v, í: fragments that point at the heading in Portuguese and that no policy would ever pick. The minimum of the heading alone is almost always an implausible token — which is exactly why the plausibility term exists. The mistake was not having it; it was leaving it heavy enough to decide on its own.

6 The fix, and what it costs

Two changes, both additive — the old behaviour is still the default.

What changed in the code. No new parameters: inference only.
wherewhat now exists
Transformer.energia_dependenciak=None searches over all actions in the vocabulary, in chunks sized by a memory budget; respostas=N returns the N lowest-energy actions instead of one — the "multiple answers" of the talk
server/ours.pythe candidate source accepts todos (all): every token in the vocabulary is imagined one step ahead and scored by energy, and the top-k comes out of that ordering, not the policy's
model/inference.pythe script behind this chapter: coverage, energy lost and answer counts, on both energies and at any γ
server/ours.py, _todos_por_energialater fix (chapter 18): the vocabulary ordering now uses the whole energy, including the γ · (−log p) term, as inference.py does. Before, it ordered by the heading alone
model/collapse.py--only-volume, --volume-seed and --sample-scale: measure only the volume, with another seed and with another norm for the sampled points (§10)

The cost is a batched pass of 16,392 × 256 per generated token, against 8 × 256 before. It is expensive, which is why it did not become the default: it exists to measure what the shortcut costs in each configuration, and to be switched on when the heading matters more than speed.

7 Is the landscape flat?

The second sentence. Collapse, in the lecture's definition, is not the model being wrong: it is the energy being the same everywhere. Such a model passes any "low energy on the data" test, because it is low on everything — and it is useless, because it does not discriminate.

The test is direct: measure the energy on real pairs and on targets outside the data region. We do not need to invent points: the hardest negatives are real states in the wrong place — same norm, same geometry, just not the target of that zt.

Mean energy, model mini-moderno-reg1-wm1-sz1-duelo, 16 sequences of 96 validation tokens. "Conditional" uses the action that actually came; "dependency" has already searched for the best possible action among all 16,392, so what is left is not the wrong token, it is a target no action can reach. The identity (predicting that nothing changes) sits alongside as the floor.
targetconditionalvs realdependencyvs realidentity
real pair (inside)0.1583—0.1252—0.8916
target 7 positions ahead1.2315+677.9%0.4876+289.6%1.4512
target from another sequence1.9020+1,101.5%1.3863+1,007.6%2.0783
target shuffled across the batch1.9116+1,107.6%1.1403+811.0%2.0739
noise of the same size as the real states2.0545+1,197.9%1.5433+1,132.9%2.2344

It is not flat. The data valley sits ten times below the rim, and the gradation makes sense on its own: seven positions ahead is the least wrong target of all (+289.6%), because the text is still the same one; pure noise is the most expensive. A collapsed landscape would give the same column throughout.

8 The volume of low energy

Here is the quantity the regularized family claims to minimize, and that we had not been measuring: how much of the space can get low energy. The measurement takes four steps.

  1. The possible destinations. We pick one position in the text. For each of the 16,392 tokens in the vocabulary, the world model predicts where the state would go if that token were written there. That gives 16,392 destinations.
  2. What low energy means. A point in the space has low energy when it sits close to one of those destinations. The low-energy region is therefore a small valley around each destination — one valley per token.
  3. The reference. The real text tells us which state actually came next. The energy of that true state, that is, how close it gets to the nearest destination, is the reference: the energy level a legitimate target reaches.
  4. The sampled points. We draw random points with the same size as the real states, so that things of different scales are not compared. For each one, we measure the energy and count how many fall below one, two, five and ten times the reference.

The reading is intuitive. In a collapsed model, the destinations pile up and cover the whole space: almost any sampled point lands near one of them, and the fraction is high. In a model that separates well, the valleys are narrow: a random point sits far from every destination, and the fraction is low.

Counting only the points below the reference itself does not work: in 256 dimensions, a randomly sampled point almost never gets as close to a destination as the true state does, and every model would score zero. That is why we count at several multiples of the reference. The curve shows the shape of the valley and, because it is measured in multiples, it allows comparing models whose energies have different scales.

Volume of low energy, with the representation-collapse measures alongside. wm1-sz1 trains the world model end to end with SigReg on the states (the per-dimension regularizer); wm1det uses the shortcut of cutting the gradient at the target, with no regularizer on the state. Six sampled positions, 256 targets each. This is a single draw; §10 measures how much these numbers vary.
measurewm1-sz1 (regularized)wm1det (shortcut)
energy of the real pair (dependency)0.12520.4179
noise vs real (dependency)+1,132.9%+358.6%
median energy of a sampled point15.0× the reference4.6× the reference
fraction of space below 5× the reference0.00%82.49%
fraction of space below 10× the reference53.12%99.93%
rows different (cosine between samples)+0.0738+0.1352
columns different (|correlation| off-diagonal)0.24840.1841
columns different (effective rank, 1 to 256)75.7135.5
validation loss (best checkpoint)5.77615.2653

The two bold rows are the result of this chapter. In the regularized model, no sampled point gets energy below five times the reference; in the shortcut, 82% do. That is the sentence "minimizing the volume of space that can take low energy" coming out as a number, confirming what the lecture describes.

But the rest of the table is uncomfortable, which is why all of it is here:

The conclusion this forces

Representation collapse and energy collapse are different things, and our routine measures only saw the first. A well spread space, with independent dimensions and high rank, can sit on top of a shallow energy landscape — because what defines the volume is not how the states are distributed, but how far the predictor carries different actions apart. Until the volume curve enters the training evaluation, "it did not collapse" remains a statement about the matrix, not about the energy.

9 Rows and columns: does the taxonomy hold?

The lecture organizes the two families by the batch matrix, one row per sample and one column per variable: "one way is to make sure all the rows are different; another way is to make sure all the columns are different". Making rows different is the per-sample method (InfoNCE, CLIP); making columns different is the per-dimension method (VICReg, SigReg), the one he prefers.

We have had a per-sample contrastive control in the queue since chapter 13 — the wm1-nce1 round, with InfoNCE in place of SigReg. Its result, from the training history:

Best checkpoint of each round. Mind the ruler: these columns are measured on the embedding table, which is what training records, not on the batch state matrix used in the previous table. They are different matrices; the numbers do not mix.
roundvalidationrowscolumns |r|rank
wm1-nce1 (per-sample contrastive)6.51290.11930.1065242.5
wm1-sz1 (per-dimension regularized)5.77610.04850.0894243.5
wm1det (shortcut)5.26530.05270.0663244.6
reg1 (control, no world model)5.25770.04850.0640245.2

The taxonomy did not show up. The per-sample contrastive method should have won precisely on the rows column, and it lost: 0.1193 against 0.0485, two and a half times the cosine between samples. It also lost on the columns, and it cost 0.74 nats of validation. In our test, the expected advantage of the per-sample method did not appear — which, given the caveats below, says more about the limits of the test than about the taxonomy.

On 17/09 the round was re-run keeping the weights, and it gave the same validation numbers to the fourth decimal. With the weights, the measurement lands on the right matrix — the batch state matrix — with the energy landscape alongside, under the same protocol as §8 (24 sequences, 12 volume positions):

Batch state matrix and energy landscape (model/collapse.py), the three families. "Noise vs real": how far the dependency energy of a noise target sits above the real pair's. "Median": energy of a sampled point, in multiples of the reference (§10 shows it is the stable measure).
roundvalidationrows (cos)columns |r|ranknoise vs realmedian
wm1-nce1 (per-sample contrastive)6.51290.09160.170170.5+2,302.7%33.6×
wm1-sz1 (per-dimension regularized)5.77610.05410.240378.8+915.6%21.9×
wm1det (shortcut)5.26530.11990.1831139.4+312.7%5.4×

On the right matrix, the taxonomy still does not show up the expected way: the per-sample method trails the regularized one on rows (0.0916 against 0.0541) and leads on column correlation (0.170 against 0.240), the reverse of what the split predicts. What is its own shows up in the landscape: energy outside the data rises more than in any other round — noise 23 times above the real pair, a sampled point at 33.6 times the reference. That is the talk's description of the contrastive family, "push the energy up" outside the region of data, measured. It is also the round that costs the generator most (+23.87%): the deepest landscape did not come for free.

That deserves three caveats, because it is a single-round result and it runs against expectations:

10 The volume, measured again

The first version of this chapter closed with four questions that only a round could answer. The two about inference — whether searching the whole vocabulary improves the text, and whether there is a γ with both heading and coverage — became chapter 18, because the answer changed subject: what decides the text is the energy, not the search. Along the way a defect in the todos mode showed up, which chapter 18 describes. The two questions about the volume are here. They ran on CPU, on wm1-sz1 and wm1det.

How many positions does the volume need?

Volume of low energy (model/collapse.py --only-volume), 256 targets per position, three seeds (7, 8, 9) for each number of positions; each cell lists the three measures. "Median" is the median energy of a sampled point, in multiples of the reference.
positionswm1-sz1: ≤ 5×wm1det: ≤ 5×wm1-sz1: medianwm1det: median
30 / 0 / 0%67 / 49 / 33%19.5 / 24.3 / 31.7×4.2 / 5.5 / 7.0×
617 / 17 / 0%71 / 77 / 83%14.2 / 16.9 / 21.4×3.8 / 4.4 / 3.3×
120 / 0 / 0%53 / 31 / 70%20.5 / 19.5 / 17.0×5.4 / 6.3 / 4.7×

The ordering of the two models holds in all 18 measures: no shortcut measure falls below any regularized one. The absolute number does not hold. With 12 positions the shortcut still ranges from 31% to 70% below 5× the reference, and the 0.00% against 82.49% of §8 is one draw inside those ranges. The round fractions (16.67% is one position in six) show why: each position tends to count all or nothing, because the reference changes a lot from one position to the next. The variation is between positions, not between the sampled targets.

The median is steadier. With 12 positions it stays between 17.0× and 20.5× for the regularized model and between 4.7× and 6.3× for the shortcut: narrow ranges, far apart. To enter the training evaluation, the measure to keep is the median over 12 positions — about 15 seconds per position on this CPU, three minutes per evaluation. The fraction below 5× is for illustration, not for comparing rounds.

Does the volume depend on the size of the sampled points?

Same 6 positions (seed 7), varying the norm of the sampled points in multiples of the mean norm of the real states (1 = the protocol of §8).
normwm1-sz1: ≤ 5×≤ 10×medianwm1det: ≤ 5×≤ 10×medianratio of medians
0.533.3%81.1%6.6×100.0%100.0%1.6×4.1
0.816.7%46.2%10.6×99.4%100.0%2.7×3.9
116.7%33.1%14.2×71.0%100.0%3.8×3.7
1.255.4%16.7%19.9×37.5%100.0%5.4×3.7
20.0%0.1%44.5×0.0%33.3%12.4×3.6

It depends a lot, and in a way that separates the two things the question wanted to separate. The fraction is a sampling choice: the same shortcut goes from 100% to 0% below 5× just by changing where the points are drawn, and at norm 2 both models score zero. The comparison is the shape of the valley: the ratio of the medians stays between 3.6 and 4.1 across a fourfold range of norm. The shortcut offers energy about four times cheaper than the regularized model, wherever one looks.

What the two answers change

The claim of §8 still stands — the regularized model leaves much less space with cheap energy — but the number to carry forward is the ratio of medians, close to 4, not 0.00% against 82.49%.

11 What changes in the project

The balance of this chapter. No new piece in the generation path; three new measures, one corrected name and one fix to the todos mode.
claim from the lecturestatus here
inference by optimization, not forward propagationwas false in our code whenever the heading had a voice: 0% coverage up to top-32 at γ = 0. The search over the whole vocabulary now exists, and its cost is measured. It does not improve the text: at γ = 0.1 it lands on the same affinity and perplexity as the policy at γ = 0, and so does the exact search inside the policy's nucleus (chapter 18)
a relation, not a function; multiple answersconfirmed and quantified: 12.9 actions within 5% of the minimum on dependency energy, 35.5 on the pure heading, 1.4 at γ = 1
collapse is the energy going flatwe are not collapsed: a valley ten times below the rim, with a coherent gradation across the four target types
the regularized family minimizes the volume of low energyconfirmed in ordering, across the 18 measures of §10: the shortcut leaves about four times more cheap energy (ratio of medians between 3.6 and 4.1). The fraction below 5× varies with the draw and with the norm of the points
rows different vs columns differentdid not show up as expected, neither on the embedding table nor on the state matrix: the per-sample contrastive trails on rows and leads on columns. What is its own is the deepest landscape (sampled point at 33.6× the reference), with the highest cost to the generator (+23.87%)
Open questions