Skip to main content
Back

Johns Hopkins' Ettin Proves Smaller Encoders Beat Larger Decoders on Classification

Johns Hopkins and LightOn release ten paired encoder and decoder models trained identically, ending years of unfair architectural comparisons and beating ModernBERT, Llama 3.2, and SmolLM2.

Pro

  • Johns Hopkins and LightOn released Ettin, ten paired encoder and decoder models from 17M to 1B parameters.
  • Both architectures share identical data, shape, and recipe, differing only in attention and training objective.
  • Ettin encoders beat ModernBERT on GLUE and MTEB; decoders beat Llama 3.2 and SmolLM2 at matched sizes.
  • A 400M encoder outperforms a 1B decoder on MNLI, with the reverse holding for generative tasks.
  • Continued cross-objective pretraining for 50B tokens fails to close the architecture gap in either direction.
  • Full release includes 236 checkpoints per model, batch-ordered training data, and the code repo.

For years, the encoder versus decoder debate has been a mess of confounding variables. When someone claimed a decoder-only model could replace BERT for classification, the models being compared had different training data, different parameter counts, different learning schedules, and different architectures. It was scientifically unsatisfying, and it left practitioners guessing about which family to reach for.

A team from Johns Hopkins and LightOn just fixed that with Ettin, named after the two-headed Norse giant. Ettin is the first suite of paired encoder-only and decoder-only models (17M-1B params) trained with identical data (2T tokens), architecture, and training recipes. The only things that differ between each pair are the attention pattern (bidirectional vs causal) and the training objective (masked vs causal language modeling).

Why apples-to-apples finally matters

Encoder-only models like BERT built the modern NLP era, but the field pivoted hard to decoder-only architectures because they generate text natively. That left a huge chunk of production workloads, classification, retrieval, embeddings, still leaning on models designed in 2019. Meanwhile, papers like LLM2Vec argued you could just take a 7B decoder, do a bit of continued pretraining with masked objectives, and get a better encoder for free.

Nobody could really test that claim rigorously, because a comparison with mismatched data and scale proves nothing. Ettin's authors built the controlled experiment the community has been missing.

The recipe, and why it beats ModernBERT

Ettin is essentially an open-data reproduction of the ModernBERT recipe, then applied symmetrically to decoders. The training data is a mix of DCLM combined with various curated sources from Dolma v1.7, drawing from the same sources used to train Olmo 2. Training proceeds in three phases:

  • Base pre-training on 1.7T tokens with a wide data mix and trapezoidal learning rate schedule.
  • Mid-training / context extension on 250B tokens where sequence length jumps to roughly 8000, RoPE base is raised to 160k, and noisier data sources get dropped.
  • Decay phase on 50B tokens using higher-quality sources like textbooks, Dolma books, and Wikipedia.

The only differences between the encoder and decoder models are the objective function, masked language modeling for the encoder versus causal language modeling for the decoder, and the attention pattern, causal for the decoder and bidirectional for the encoder. Encoders use a 30% masking ratio during pretraining, dropping to 15% during decay.

The suite ships six sizes: 17M, 32M, 68M, 150M, 400M, and 1B parameters, each in encoder and decoder form. Smaller models follow MobileLLM's deep-and-thin philosophy, while the 1B model stays at 28 layers but widens the hidden size to 1792. Every model was checkpointed every 8.5B tokens, with 236 checkpoints per model, and the training data is released in the exact batch order the models saw it.

The results are hard to argue with

On the encoder side, Ettin matches or beats ModernBERT at every comparable size. Ettin-68m hits a GLUE average of 87.2 versus DistilRoBERTa's 83.8. Ettin-150m edges ModernBERT-base 88.9 to 88.4. Ettin-400m pushes to 90.8 GLUE, and the 1B model reaches 91.6, the strongest number in the table.

On the decoder side, Ettin decoders beat Llama 3.2 and SmolLM2 at matched sizes. Ettin-1B averages 59.0 across ten standard tasks versus Llama 3.2 1B's 56.6, with particularly strong numbers on TriviaQA (29.3 vs 24.9) and ARC (39.7 vs 36.2). Ettin-150m even outperforms SmolLM2-135m at 46.2 vs 45.2.

The real finding: architecture still wins over scale

Here is the money quote from the experiments, and the reason this paper matters beyond the model release. A 400M encoder outperforms a 1B decoder on classification tasks, while a 400M decoder outperforms a 1B encoder on generation tasks. The gap does not close with cross-objective continued pretraining either.

The authors tested the LLM2Vec-style approach, taking a fully trained decoder and continuing pretraining with a masked next-token prediction objective for 50B additional tokens (five times more than LLM2Vec used). The resulting encoder-from-decoder helps on retrieval, but it never catches the pure encoder trained from scratch. On MS MARCO retrieval at 400M, the pure encoder hits 42.2 nDCG@10 versus 41.4 for the encoder-from-decoder. On MNLI, the gap is wider.

In the reverse direction, decoders-from-encoders scale poorly. At 1B, a real decoder scores 59.0 on generative tasks while a decoder-from-encoder only reaches 52.2. Interestingly, the encoder-from-decoder does dramatically better on MMLU (37.0 vs 27.0 for the pure decoder) but collapses on GSM8k (18.9 vs 32.0), suggesting the two objectives really do learn different things.

What is actually released

The full artifact drop is unusually thorough:

  • Ten final models across six size points, encoder and decoder variants each
  • Cross-objective trained variants (encoder-from-decoder and decoder-from-encoder)
  • 236 intermediate checkpoints per model for training dynamics research
  • The full 2T-token training data mixture
  • The exact batch ordering each model saw, enabling replay experiments
  • The first open-data replication of the ModernBERT recipe

Using them is straightforward through Hugging Face. The 1B encoder is available at jhu-clsp/ettin-encoder-1b, and the decoders load through the standard AutoModelForCausalLM pipeline. One gotcha noted in the repo: make sure you have the latest version of transformers installed because ModernBERT-decoder support is recent.

When to reach for which

The practical guidance from these experiments is refreshingly clear:

  • Use an encoder when your workload is classification, retrieval, embeddings, reranking, or any task where you need fixed-size representations. A smaller encoder will usually beat a much larger decoder here.
  • Use a decoder for open-ended generation, chat, code completion, or few-shot in-context learning tasks like HellaSwag and TriviaQA.
  • Adapt across objectives cautiously. Continued pretraining a decoder for retrieval works, but a purpose-built encoder at a third the parameter count will likely match or beat it.

The authors point out an uncomfortable implication for the current MTEB leaderboard, which is dominated by 7B-plus decoder-based embedders. Based on their scaling curves, a 3B pure encoder would likely outperform all of them, if only someone would build it. Ettin does not go that big yet, but it provides the recipe and the checkpoints to make that experiment tractable for anyone with a small GPU cluster.