Skip to content
Back to writing
· 10 min read

Amazon's trillion-parameter model Ergo has a maths expert

One expert in layer 11 of Amazon Ergo takes 78% to 84% of maths tokens in LaTeX, Unicode, English words or Python, and 3% of a LaTeX file with no maths. I found it with 16 of 64 layers on one AMD MI350X.

On 1 December, Jeff Bezos posted about Amazon's new open model:

Ergo is a new open model from Amazon. 1.1 trillion parameter mixture-of-experts model, 55 billion active parameters per token.

Fine-tune it, modify it, and build it into your commercial products. Run it on your hardware or on Bedrock.

I was happy to read that, and the last line was my favourite. Bedrock gives you Ergo's answers. Your own hardware gives you its router.

Every token in Ergo passes a router that picks 8 of 256 experts, layer after layer. With the weights on my own GPU, I could log every pick. I wanted to know one thing: do those experts specialise in anything a person would recognise? Maths? Hindi? JSON?

So I rented one AMD MI350X. No Ergo serving stack targets AMD yet, so a few of my factory's agents and I wrote a small runtime and loaded the first 16 of the 64 layers. About $12 of GPU time later, I had an answer I did not expect. One expert does maths, and it does not care how you write it.

Feed Ergo ten maths identities written in LaTeX, and expert 179 in layer 11 takes 84% of the tokens.

Now write the same identities in words: "the integral of e to the minus x squared over the whole real line equals the square root of pi." The same expert takes 78%.

Write them as Python, and it takes 83%. Write a LaTeX document about a walk through tea gardens, full of backslashes and braces and no maths, and it takes 3%.

Ergo has 256 experts in that layer. Each token picks 8. If the choice were random, any one expert would see about 3% of tokens. Expert 179 sees almost every token of maths, in any notation, and almost nothing else.

Why that is not obvious

Ergo is Amazon's open-weights model: 1.1 trillion parameters in 64 layers. It is a mixture of experts. Every layer after the first holds 256 small feed-forward networks, the experts, and a router. For each token, the router scores all 256 and sends the token through the top 8, plus one shared expert that every token uses. About 55 billion parameters do work on any one token.

Nobody tells the router that one expert should handle maths and another Hindi. It learns whatever split lowers the loss. And when Mistral looked inside Mixtral for experts like that, it did not find them.

The Mixtral paper compared routing on ArXiv papers, biology abstracts and philosophy papers. "Surprisingly, we do not observe obvious patterns in the assignment of experts based on the topic," the authors wrote. The ArXiv papers were LaTeX, and they still routed like philosophy. Their verdict: "The selection of experts appears to be more aligned with the syntax rather than the domain."

Mixtral has 8 large experts per layer and picks 2. Ergo has 256 small ones and picks 8. That design comes from DeepSeekMoE, whose authors cut experts finer and split off shared ones so that each routed expert holds "non-overlapping and focused knowledge." Ergo's config names its load-balancing strategy: deepseek.

Fine-grained models do show sharper experts. The OLMoE paper found one at layer 0 that takes nearly all of its arXiv tokens. But arXiv is LaTeX. An expert that fires on arXiv could know science, or it could know backslashes. A chart of subjects cannot tell the two apart.

So I asked a narrower question. Hold the maths fixed and change the notation. Does the router follow the meaning or the spelling?

A quarter of a model is enough

The checkpoint is 626 GB, with the experts stored in MXFP4, a 4-bit format. Serving it needs about 700 GB of GPU memory once you add the KV cache. One AMD Instinct MI350X has 288 GB.

amd-smi static output for one AMD Instinct MI350X with 288 GB of HBM3E
Open the full-size image.

My preflight script said so in red.

Preflight output: total VRAM 309 GB fails against the 700 GB the full model needs; bf16 matmul runs at 1,138 TFLOP/s
Open the full-size image.

The full model wants three of these cards. But I did not need the full model, because routing is causal by layer. The router at layer 11 sees only the hidden state that layers 0 to 10 produced. Layers 12 to 63 cannot change what happens at layer 11. Load the first 16 layers, run a prompt, and the expert choices at those 16 layers are the same choices the full 64-layer model makes for the same tokens.

Sixteen layers of Ergo is 160 GB. It loads in under a minute and fits on one card with room to spare.

The other problem was software. Ergo has vLLM, SGLang and Transformers integrations, but the fast paths in vLLM and SGLang use CUDA kernels. None of them targets ROCm for Ergo. So we wrote a small PyTorch runtime that keeps the experts packed in MXFP4 and unpacks only the experts each token routes to. Before trusting it, I checked it against an fp32 reference.

Selftest output on two layers: MXFP4 dequantisation exact for experts 0, 17 and 255; the MoE layer matches an fp32 reference with relative error 0.0035
Open the full-size image.

The dequantised weights match bit for bit. The MoE layer's output matches the reference to within 0.35%. With that in place, recording routes is one hook on the expert block's forward: it receives the top-8 indices for every token, and I copy them out before passing them on.

Seven kinds of text

I fed the 16-layer model 2,048 tokens from each of seven sources:

  • the Wikipedia article on the Moon in English, Hindi, Japanese and Chinese;
  • Python, from the runtime I had just written;
  • LaTeX maths, from the Wikipedia article on the Fourier transform;
  • JSON tool calls, the kind an agent emits.

For every expert at every layer, I counted the share of each source's tokens that went to it. Most experts are busy everywhere. A few are not.

Table of five experts' firing rates across seven domains, shaded by rate. Layer 11 expert 179 fires on 87% of maths tokens; layer 6 expert 121 on 90% of Python; layer 8 expert 56 on 68% of Hindi; layer 14 expert 196 on 60% of JSON; layer 8 expert 35 on 32% of Japanese
Open the full-size image.

Expert 179 at layer 11 took 87% of the maths tokens. On the other six sources, its highest rate was 0.5%: fewer than one token in 200.

Expert 121 at layer 6 took 90% of the Python. Expert 56 at layer 8 took 68% of the Hindi and under 1% of anything else. Expert 196 at layer 14 took 60% of the JSON.

This is where Mixtral's analysis and OLMoE's both stop. But the maths text was LaTeX. Expert 179 might be a backslash detector. The Hindi was in Devanagari. Expert 56 might be a script detector. A chart like this cannot tell a subject from a costume.

So I changed the costume and kept the subject.

Same maths, four notations

I wrote ten identities four ways: LaTeX, Unicode symbols, plain English words and Python. The Gaussian integral, Euler's identity, the quadratic formula, Bayes' rule, the Basel sum, Pythagoras, the derivative, the binomial theorem, the Fourier transform and Gauss's law. For a control, I added a LaTeX document with no maths in it: a title, sections, a bulleted list, a figure.

Then the same trick for the other specialists. The same Hindi paragraph in Devanagari and in Latin letters, next to Marathi and Nepali Wikipedia, both written in Devanagari. The same two small functions in Python, JavaScript, Go and Rust. JSON tool calls next to a JSON config file.

Here is the raw output.

Terminal output of routing_probe.py: the share of each probe's tokens routed to eight experts, with rates above 50% highlighted
Open the full-size image.

And the same numbers as a chart.

Four bar charts. Layer 11 expert 179: 84% LaTeX maths, 84% Unicode, 78% English words, 83% Python, 3% LaTeX with no maths, 5% Python with no maths. Layer 8 expert 56: 62% Hindi in Devanagari, 68% Hindi in Latin letters, 75% Nepali, 7% Marathi, 2% English. Layer 14 expert 196: 76% JSON tool calls, 91% JSON config, 0% JavaScript and Python. Layer 6 expert 121: 25% Python, 1 to 6% the same code in JavaScript, Go and Rust
Open the full-size image.

Expert 179 does not care about notation. It fires on "e to the minus x squared" as readily as on e^{-x^2}. The LaTeX document with no maths gets 3%: five tokens out of 199, namely documentclass, graphic, }[, h and a lone backslash.

In the English version, it skipped the glue: "The", "of", "the", full stops, line breaks, and most of the words in Bayes' rule ("given", "probability"), which read like ordinary English. It fired on "integral", "minus", "squared", "square root", "pi", and on most of the single letters standing for variables.

The early experts read symbols

Two other experts lean towards maths: expert 197 at layer 4 and expert 218 at layer 7. They fire on 79% to 90% of the LaTeX and Unicode forms. Then the notation changes.

Grouped bar chart. On LaTeX and Unicode, layers 4, 7 and 11 all fire on 79 to 90% of tokens. On English words, layer 4 fires on 31%, layer 7 on 44%, layer 11 on 78%. On Python, 32%, 39% and 83%
Open the full-size image.

Write the maths in words or Python and the layer 4 expert drops to about a third. The layer 7 expert drops to under half. The layer 11 expert barely moves.

The early experts respond to the look of maths: superscripts, Greek letters, fractions. By layer 11, the model has worked out that "x squared" and x**2 and x² mean one thing, and it routes them to one place. You can watch abstraction happen, four layers at a time.

The whole model shows the same drift. I measured how different the seven sources' expert choices are at each layer, as the mean Jensen-Shannon divergence between their distributions.

Line chart of mean Jensen-Shannon divergence between domains by layer: about 0.33 at layer 1, a low of 0.27 at layer 3, about 0.42 at layers 9 to 11, and a peak of 0.455 at layer 15
Open the full-size image.

The early layers route all seven sources in similar ways. From layer 9 on, the sources split apart, and the split is widest at layer 15, the deepest layer I loaded.

Heatmap of the share of each domain's tokens routed to each of the 256 experts at layer 15
Open the full-size image.

Hindi, in any script

Expert 56 at layer 8 took 62% of a Hindi paragraph in Devanagari. I rewrote the same paragraph in Latin letters: "Chandrama Prithvi ka ekmatra prakritik upgrah hai." Not one character of Devanagari. It took 68%.

Then the harder control. Marathi uses Devanagari too, the same alphabet as Hindi. Expert 56 took 7% of a Marathi Wikipedia article. Nepali, also in Devanagari and closer to Hindi in vocabulary, took 75%.

So expert 56 is not a script detector. It follows the Hindi language, and its near neighbour Nepali, whatever letters they arrive in.

Hindi pays for it somewhere else. The same paragraph about the Moon costs 66 tokens in English and 101 in Hindi.

Bar chart of tokens for the same paragraph: English 66, Hindi 101, Japanese 78, Chinese 65
Open the full-size image.

A Hindi speaker pays 53% more per sentence for the same content, waits 53% longer for it to stream, and fits 35% less into the same context window. Chinese costs the same as English. The model understands Hindi well enough to give it a dedicated expert. The tokenizer still charges a tax at the door.

Languages share. Code does not.

The other two probes are quick. Expert 196 at layer 14 took 76% of the JSON tool calls, 91% of a JSON config file and none of the JavaScript or Python. It is a JSON expert, not a tool-call expert. Expert 121 at layer 6 took 25% of two small Python functions and 1% to 6% of the same functions in JavaScript, Go and Rust. It took 90% of my runtime, which is dense torch code.

Now step back. For every layer, I took each source's 32 busiest experts and measured how many it shares with each other source.

Heatmap of the overlap between domains' 32 busiest experts. Japanese and Chinese share 64%, Hindi and Japanese 56%, English and Chinese 49%. Natural languages share 6 to 17% with code, maths or JSON
Open the full-size image.

The four human languages share between 38% and 64% of their busiest experts. Japanese and Chinese share the most. Any human language against code, maths or JSON shares between 6% and 17%. Python and maths share 28%.

Ergo has not built one wing per language. It has built one large wing for human language, with a few specialists like expert 56 at the edges, and separate rooms for things that are not prose.

What this does not show

The probes are small. Each is 66 to 512 tokens, and the Hindi paragraph is 101. I wrote the ten identities, the tea-garden LaTeX and the code myself, and another set could move the numbers by a few points. Routing is deterministic for a given input, so a second run returns the same numbers. The uncertainty is in the choice of text, not the run.

The rate is the share of a probe's tokens whose top 8 at that layer include the expert, the same measure OLMoE uses. It ignores the router's weights. A token can pick expert 179 eighth and count the same as one that picks it first.

My runtime is not Amazon's. It matches an fp32 reference to 0.35% at the MoE output, so a token whose eighth and ninth choices almost tie could route differently in vLLM. That moves single tokens, not 80% rates.

And 16 layers say nothing about layers 16 to 63. Expert 179 may have a deeper cousin that is better still. The scripts and data are public. Load more layers and look.

What watching costs

The routing data came from one GPU at about $4 an hour. The whole session, from first boot to the last probe, cost $12.05. Running it looks like this.

amd-smi monitor during the 16-layer benchmark: GFX at 100%, 660 W of a 1,000 W cap, 2,195 MHz, 181,508 MB of VRAM in use
Open the full-size image.

I also measured how fast the runtime generates text, because a runtime that can watch the model can serve it. Decode time per step grows in a straight line with the number of layers, so 8 and 16 layers predict 64.

Line chart of decode milliseconds per step against layers for batch 1 and batch 32, eager and compiled, projected to 64 layers
Open the full-size image.

With the dequantisation step compiled, 16 layers decode a step in 30 ms for one sequence and 147 ms for 32. Across all 64 layers, that projects to 8 tokens per second for one user and 53 tokens per second for a batch of 32.

Benchmark output for 16 layers with compiled dequantisation: 33 tokens per second at batch 1, 216 at batch 32
Open the full-size image.

Three MI350X cost about $12 an hour. At 53 tokens per second, that is about $63 per million output tokens. Amazon Bedrock sells Ergo output at $3 per million.

So if you want to use Ergo, use Bedrock. I ran it there behind Claude Code on real coding tasks for about $8.70 in total, and that is a separate story. My runtime is correct, not fast. But Bedrock will not show you the router. On your own GPU, the router's choices are one hook away, and you only need the layers up to the one you want to look at.

Expert 179

I went in expecting to find experts that react to syntax. Backslashes. Curly braces. The Devanagari block of Unicode. The first few layers do look like that.

Expert 179 does not. It ignored a LaTeX file about a walk through tea gardens, every backslash and brace of it. Then it took 78% of a sentence that a person could say out loud: the integral of e to the minus x squared equals the square root of pi.


About this work

This is an Inference Lab post: real hardware, public code, and the limits written down. The runtime, probe texts, routing data and charts are in ergo-routing. If you load more layers, or run the probe on another mixture-of-experts model, open an issue with what you find. A star helps other people find it.

I also build LLMTraceFX, an evidence-first toolkit for measuring LLM inference, and agent-trace, which records what coding agents do so you can replay and audit it. For the longer view, read The Agentic Engineering Guide.

Related: Leave your coding agent for 5 minutes and most of its cache is gone and Your agent's clock is not the model's clock.


I write about LLM inference, AI agent infrastructure and security. You can find all my writing on my writing page. Discuss this post with me on X or connect with me on LinkedIn.

Support independent writing

If this post was useful, consider supporting my open source work and independent writing.

Siddhant Khare
Agentic Engineering Guide Resume