Why Elixir Is the Best Language for LLMs
On the largest multi-language code generation benchmark published so far, large language models solve Elixir problems at a higher rate than any of the other nineteen languages tested. That is the short version. The longer version is more interesting, because Elixir is a low-resource language. The internet holds a fraction of the Elixir code it holds for Python or JavaScript, so the models had far less to learn from. They came out ahead anyway. This post walks through what the benchmark found, why it happens, where the claim stops being airtight, and what any of it means if you build software with AI.<br>The evidence<br>The benchmark is AutoCodeBench, published by Tencent Hunyuan. It contains 3,920 problems spread evenly across 20 languages, roughly 196 problems each, and it grades answers by running the generated code in a sandbox rather than by eyeballing it. More than 30 models were evaluated, open and closed, in both reasoning and non-reasoning modes. Tencent has no stake in Elixir, which is part of what makes the result worth paying attention to.<br>Two numbers carry the story.<br>The first is the union upper bound: take every problem that at least one model solved, and ask what share of each language that covers. Elixir sits at 97.5 percent, the highest of all 20 languages, and the gap is wide.<br>RankLanguageUpper bound (%)1 Elixir 97.5 2Kotlin89.53C#88.44Racket88.35Ruby79.5n/aBenchmark average74.820Python63.3Python, the language with more training data than any other on earth, lands last at 63.3.<br>The second number is more telling, because it looks at individual models rather than the union. For nearly every frontier model, Elixir is the single language it scores highest on, by a margin of roughly 30 points over its own overall average.<br>Model (reasoning mode)Overall average (%)Elixir (%)Claude Opus 452.480.3Claude Sonnet 451.181.8OpenAI o4-mini50.082.3OpenAI o3-high51.180.8Grok-450.976.8DeepSeek-R150.277.3Every model in that table does its best work in Elixir. The non-reasoning results tell the same story: Claude Opus 4 scores 82.3 on Elixir with reasoning turned off, again its top language. The effect, then, is not a quirk of one lab or one prompting mode. It shows up across labs, across model sizes, and across both modes.<br>The part that should stop you is the training-data angle. Language models learn from what they have seen, and they have seen an ocean of Python and JavaScript and a puddle of Elixir. If corpus size drove performance, Python would win and Elixir would sit near the bottom with the other niche languages. The opposite happened. Elixir beat languages with roughly ten times its training data. Whatever is going on, it is not “the model memorized more Elixir.”<br>One more slice of the data rules out the easy counter-explanation that this is a chat-tuning artifact. AutoCodeBench includes a variant, Complete, that grades raw base models with three-shot prompting, before any instruction tuning or reinforcement learning from human feedback. Elixir lands in the upper half there too: DeepSeek-Coder-V2-Base scores 52.0 on it, Seed-Coder-8B-Base 48.0. If the advantage were something the labs polished in during alignment, it would not show up in models that never went through that step. It shows up anyway, which points back at the language itself.<br>Why it happens<br>The benchmark tells you Elixir wins. It does not tell you why. José Valim, the creator of Elixir, wrote the clearest explanation at Dashbit, and his argument is that the result is not luck. It falls out of design choices that happen to line up with what a language model needs. Five of them matter.<br>Immutability keeps reasoning local. In Elixir, data goes into a function and a new value comes out. Nothing mutates behind your back. Valim calls the absence of hidden side effects “no spooky action at a distance,” and for a model with a finite context window that is the whole game. The less surrounding code the model has to pull in to be sure of what a function does, the fewer chances it has to be wrong. The pipe operator makes the data flow visible on one line:<br>"Elixir is awesome" |> String.split() |> Enum.frequencies()That transparency scales up to the module boundary too, which is the argument I made separately about why Phoenix contexts are good for LLMs: a well-drawn context is a small, self-contained surface a model can reason about without loading the rest of the app.<br>Documentation is a verified contract. Elixir separates the public contract, written with the @doc attribute, from ordinary implementation comments. The examples inside those docs are runnable, and they execute as part of the test suite. The documentation cannot quietly drift out of sync with the code, because the build fails when it does. On top of that, the ecosystem centralizes on HexDocs with versioned, indexed search. The practical effect is that the text the models trained on was correct, and the text an agent retrieves at runtime is correct.<br>A...