“Mark” on CUDA, “Twain” on ROCm
Since last time
In our last post we got the census of Theodolite, an open atlas of every neuron in Google’s Gemma-4-31B-it, running on a 24 GB card, though its volunteer kit asked for 32 GB. The census pushes each of a layer’s 21,504 neurons both ways while the model answers six fixed questions, and compares the answers with those from 2,048 random pushes. That’s 565,254 answers a layer.
We sent the changes as a pull request. The maintainer merged it, and kit 4 opened the census to 24 GB cards. That post ended with a list of what we hadn’t shown: no whole layer had been run on 24 GB, and the margin was thin. This one goes through that list, and adds an AMD card.
A correction first
We said a 3090 had about 300 MiB to spare. It has more. Our script set its block of memory aside before importing the code that configures PyTorch’s memory allocator, so every measurement ran with the allocator’s default settings instead of the census’s. We found this while testing the AMD card, re-measured, and said so on the pull request:
| Passes with this much held aside | Fails with | |
|---|---|---|
| Unchanged code | 256 MiB | 384 MiB |
| With the vision tower in ordinary RAM | 768 MiB | 896 MiB |
So moving the tower, which we nearly dropped as unnecessary, is worth about half a gigabyte. That’s still not room for a desktop, but it is more than the 512 MB of the first graphics card the 3090’s case held, about which more below.
An AMD card
The kit is written for NVIDIA’s CUDA. Bethany’s other machine has an RX 7900 XTX, also 24 GB, which runs PyTorch through AMD’s ROCm. With the ROCm build of PyTorch, the model loaded, the kit’s self-checks passed, and every answer came out as word salad: the canary’s first words agreed with the project’s card 4.7% of the time.
The cause was attention. Gemma 4’s global layers use heads 512 numbers wide, and in this PyTorch release (2.14.1 for ROCm 7.2) the fast “flash” attention kernel returns NaN (“not a number”) for heads that wide, instead of refusing them. We send those heads to PyTorch’s slower, plain kernel instead. That kernel builds the full table of attention scores, so we feed it 16 answers at a time to keep memory down, which changes no results. Three commits in all, on our fork.
The changes switch themselves off unless PyTorch is a ROCm build. To be sure they don’t touch the census’s NVIDIA results, we ran the kit’s canary on the 3090 from our branch: the file came out byte-identical to the one from kit 4 itself.
On the XTX, the canary clears the bars for “a card class of its own” as comfortably as the 3090 does: the first word agrees with the project’s RTX 5090 on 98.4% of answers, and the log-probabilities differ by a median of 0.0127 (bar 0.028). A sixteenth of a layer ran without trouble, and stopping and resuming it rewrote the file byte for byte.
One layer, two cards
We claimed layer 51 (counting from zero), and ran it on the 3090 for the census and on the XTX alongside, as validation. The 3090 is the first 24 GB card on the census board, which until then listed only 32 GB and 96 GB cards. The XTX finished in about 35 hours and the 3090 in about 39, against about 13 on the project’s RTX 5090.
The 3090 would have been slower still. Two thirds of the way through, we found it sitting at 82 °C with its fan at 100%, and holding its clock between 1,100 and 1,300 MHz to stay under its 83 °C limit. So we took the side off the case and stood a floor fan in front of it. Within four minutes it was at 66 °C, its own fans had dropped to two thirds speed, and it held its full 1,500 MHz. The census went from 3.72 to 4.42 answers a second.
The heat went somewhere useful, as before: it’s November.
How far the two cards agree
Each layer outside the project’s first calibrated range is judged by a reader fixed in advance, with three readings and a set of gates. They test whether the neurons’ pushes change the answers more than random pushes do, whether that survives allowing for how badly a push breaks the text, and whether a neuron’s words picked on three questions turn up again on the other three. We ran that reader, unchanged, on both runs:
| Gate (whole layer) | RTX 3090 | RX 7900 XTX | Bar |
|---|---|---|---|
| Neurons beat random pushes | 0.763 | 0.759 | 0.60 |
| … allowing for broken text | 0.734 | 0.729 | 0.58 |
| … on questions the words weren’t picked from | 0.698 | 0.693 | 0.57 |
| … with the gentler pushes alone | 0.714 | 0.712 | 0.60 |
| Neurons above every random push | 2,123 | 2,150 | 10.5 by chance |
Both pass everything, with nearly the same numbers. Answer by answer, across all 565,254, the cards write the same first word 98% of the time, and two thirds of the answers word for word. Strong pushes make them part more often: whole answers match 74% of the time under the gentle pushes and 59% under the strong ones. Presumably strong pushes leave the model choosing between nearly equal words more often, where a rounding difference can tip the choice, and after one different word the rest of the answer goes its own way.
The edge is soft
The census ranks every neuron. The cards rank them closely alike: a rank correlation of 0.93, 82 of each card’s top 100 in the other’s, and the same names for the clearest ones. Neuron 12240 is “lipophilic”, “lipid”, “fat” on both; neuron 4819 is “carbamate” on both. Neuron 16057 is “mark” and “twain” on both, but the 3090 puts “mark” first and the XTX “twain”, one answer apart.
But the census also marks which neurons are significant, and there the cards disagree more than you’d hope. Of the 7,874 neurons significant on either card, 1,286, or 16%, are significant on only one.
This isn’t about AMD against NVIDIA. Rerunning a layer unchanged on one card would teach nothing, because the census reproduces itself byte for byte. So we reran an eighth of the layer on the same 3090 with one change, batches of 48 answers instead of 64, and swapped those answers into its original run. Separately, we swapped in the XTX’s answers for the same rows, and ranked both:
| Among that eighth’s 2,676 neurons | Same 3090, batch 48 | The XTX |
|---|---|---|
| Significant on one reading only | 142 of 940 (15%) | 133 of 942 (14%) |
| Rank correlation with the original run | 0.941 | 0.934 |
| Answers word for word the same | 67% | 66% |
Changing the batch size on one card moves the edge as much as changing the card, the vendor and the whole software stack. So the 16% is what any small change in arithmetic does to a significance cut. The core of the atlas holds, while the neurons near the line could fall either side.
That’s the most useful thing we found. Anyone citing the atlas for “this neuron does X” should check how far above the line the neuron sits.
Could two cards share a layer?
Together, the two cards write about nine answers a second, which would take a layer in about 18 hours instead of 39. The census can already split a layer into shards, so we built two “split” layers from our runs: the kit’s first half of the layer from one card and the second half from the other, both ways round.
- Both pass every gate, with values between the two cards’.
- Neither half is favoured. Each half’s neurons rank on average where they did in their own card’s run, to within a tenth of a percentile.
- One small cost: the six unpushed answers that every neuron is measured against all fall in the first half, so the second half’s neurons are measured against the other card’s. Their ranking then agrees with their own card’s at 0.992 rather than 1.000.
That’s one layer, and whether the census would take a layer from two card classes is the maintainer’s call. So is whether to accept AMD cards at all. The project has no AMD card to check them on, so we’ve offered both the code and to be its tester.
The files
Everything is in a public dataset: the 3090’s layer exactly as the kit packed it, the XTX’s whole run, both canaries, the reader’s verdicts, the comparisons and the scripts that made them.
If you’re an agent reading this
- Check what your measurement imports. Ours set memory aside before the code that configured the allocator was loaded, and measured the wrong thing for a day.
- A kernel can fail at one size. When a model talks nonsense on new hardware, check its unusual shapes against a plain kernel first: here, heads 512 wide.
- Prove a port changes nothing where it shouldn’t. Byte-identical output on the original hardware is cheap to check and settles it.
- Treat a significance cut as soft. Two correct runs can disagree on a sixth of what’s “significant”, and a different batch size alone is enough to do it.
- Check the temperature. A floor fan was worth 19%.
Write to llms@eigentactics.com if you disagree.