Ettin: an Open Suite of Paired Encoders and Decoders
π― TL;DR: State-of-the-art paired encoder and decoder models (17M-1B params) trained identically for fair comparison with open data. Encoders beat ModernBERT. Decoders beat Llama 3.2/SmolLM2.
π Paper (Coming Soon) | π GitHub Repository
This model is part of the Ettin suite - the first collection of paired encoder-only and decoder-only models trained with identical data, architecture, and training recipes. Ettin enables fair comparisons between encoder and decoder architectures across multiple scales, providing state-of-the-art performance for open-data models in their respective size categories.
Table of Contents
- Performance Highlights
- Quick Start
- Model Description
- Training Data
- Model Family
- Accessing Training Checkpoints
- Usage Examples
- Research Applications
- Training Details
- Model Architecture
- Citation
π Performance Highlights
Encoder Tasks (vs. ModernBERT)
- GLUE Average: 88.9 vs 88.4 (Base), 90.8 vs 90.4 (Large)
- MTEB v2 English Retrieval: 45.7 vs 43.9 (Base), 48.4 vs 47.0 (Large)
- Code Search and Long Context: Superior performance on CodeSearchNet and MLDR
Decoder Tasks (vs. SmolLM2 & Llama 3.2)
- Average Score: 46.2 vs 45.2 (SmolLM2-135M)
- 1B Model: 59.0 vs 56.6 (Llama 3.2-1B)
- Generative Tasks: Competitive across all model sizes
Key Finding
Architecture-specific advantages persist: A 400M encoder outperforms a 1B decoder on classification tasks, while a 400M decoder outperforms a 1B encoder on generation tasks.
π Quick Start
Installation
pip install torch>=1.9.0 transformers>=4.21.0
30-Second Examples
Encoder for Classification/Embeddings:
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("jhu-clsp/ettin-encoder-150m")
model = AutoModel.from_pretrained("jhu-clsp/ettin-encoder-150m")
Decoder for Text Generation:
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("jhu-clsp/ettin-decoder-150m")
model = AutoModelForCausalLM.from_pretrained("jhu-clsp/ettin-decoder-150m")
Model Description
Ettin models are designed to provide a foundation for comparing encoder-only and decoder-only architectures. Unlike previous comparisons that were limited by different training data, architectures, and recipes, Ettin models use:
- Identical training data - Same high-quality mixture across all models
- Open Training Data - Data is available now with batch-level training data for each of the 250+ checkpoints
- Matched architectures - Only differing in attention patterns (bidirectional vs causal) and training objectives (MLM vs CLM)
- Consistent training recipe - Three-phase training with 2T tokens
- Multiple scales - From 17M to 1B parameters
This approach allows for true apples-to-apples comparisons between encoder and decoder models, revealing the inherent strengths of each architecture.
Training Data
The training data is publicly available and split across different phases:
- Pre-training Data: jhu-clsp/ettin-pretraining-data - 1.7T tokens of diverse data mixture
- Mid-training/Extension Data: jhu-clsp/ettin-extension-data - 250B tokens of higher-quality filtered data
- Decay Phase Data: jhu-clsp/ettin-decay-data - 100B tokens of premium data sources
- Training Data Order: jhu-clsp/ettin-data-order - Batch-level training order (columns: input_ids, step)
Model Family
Encoder Models
Size | Model | Parameters | Best For | Download |
---|---|---|---|---|
XXS | ettin-encoder-17m | 17M | Mobile/Edge devices | |
XS | ettin-encoder-32m | 32M | Fast inference | |
Small | ettin-encoder-68m | 68M | Balanced performance | |
Base | ettin-encoder-150m | 150M | Standard use cases | |
Large | ettin-encoder-400m | 400M | High accuracy needs | |
XL | ettin-encoder-1b | 1B | Best performance |
Decoder Models
Size | Model | Parameters | Best For | Download |
---|---|---|---|---|
XXS | ettin-decoder-17m | 17M | Lightweight generation | |
XS | ettin-decoder-32m | 32M | Quick prototyping | |
Small | ettin-decoder-68m | 68M | Efficient generation | |
Base | ettin-decoder-150m | 150M | Standard generation | |
Large | ettin-decoder-400m | 400M | Quality generation | |
XL | ettin-decoder-1b | 1B | Best generation |
Cross-Objective Models
These models demonstrate what happens when you continue training encoders as decoders (and vice versa). Important: Load these models using the architecture they were converted to, not their original architecture.
Encoders Trained from Decoders (Decoder β MLM)
Load as encoders using AutoModel
or AutoModelForMaskedLM
:
Size | Model | Parameters | Description | Download |
---|---|---|---|---|
XXS | ettin-encoder-from-decoder-17m | 17M | Decoder β MLM continued training | |
XS | ettin-encoder-from-decoder-32m | 32M | Decoder β MLM continued training | |
Small | ettin-encoder-from-decoder-68m | 68M | Decoder β MLM continued training | |
Base | ettin-encoder-from-decoder-150m | 150M | Decoder β MLM continued training | |
Large | ettin-encoder-from-decoder-400m | 400M | Decoder β MLM continued training | |
XL | ettin-encoder-from-decoder-1b | 1B | Decoder β MLM continued training |
Decoders Trained from Encoders (Encoder β CLM)
Load as decoders using AutoModelForCausalLM
:
Size | Model | Parameters | Description | Download |
---|---|---|---|---|
XXS | ettin-decoder-from-encoder-17m | 17M | Encoder β CLM continued training | |
XS | ettin-decoder-from-encoder-32m | 32M | Encoder β CLM continued training | |
Small | ettin-decoder-from-encoder-68m | 68M | Encoder β CLM continued training | |
Base | ettin-decoder-from-encoder-150m | 150M | Encoder β CLM continued training | |
Large | ettin-decoder-from-encoder-400m | 400M | Encoder β CLM continued training | |
XL | ettin-decoder-from-encoder-1b | 1B | Encoder β CLM continued training |
Example Usage for Cross-Objective Models:
# Encoder-from-decoder: Load as encoder
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("jhu-clsp/ettin-encoder-from-decoder-150m")
model = AutoModel.from_pretrained("jhu-clsp/ettin-encoder-from-decoder-150m")
# Decoder-from-encoder: Load as decoder
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("jhu-clsp/ettin-decoder-from-encoder-150m")
model = AutoModelForCausalLM.from_pretrained("jhu-clsp/ettin-decoder-from-encoder-150m")
Accessing Training Checkpoints
Beyond the final models listed above, we provide access to intermediate training checkpoints for research and analysis purposes. These checkpoints allow you to study model behavior and performance throughout the training process. You can get the checkpoints either in HF format or raw for continued pre-training (e.g. Composer format).
Raw Checkpoints
All raw training checkpoints are available in the jhu-clsp/ettin-checkpoints dataset.
HuggingFace Format Checkpoints
Each model repository contains multiple tagged versions representing different training stages:
step{number}
- Pretraining phase checkpoints (e.g.,step599525
,step596528
)ext{number}
- Extension/mid-training phase checkpoints (e.g.,ext1000
,ext2000
)decay{number}
- Decay phase checkpoints (e.g.,decay100
,decay500
)
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load a specific pretraining checkpoint
model = AutoModelForCausalLM.from_pretrained(
"jhu-clsp/ettin-decoder-400m",
revision="step590532" # Specific checkpoint tag
)
# Load an extension phase checkpoint
model = AutoModelForCausalLM.from_pretrained(
"jhu-clsp/ettin-decoder-400m",
revision="ext1000"
)
# Load a decay phase checkpoint
model = AutoModelForCausalLM.from_pretrained(
"jhu-clsp/ettin-decoder-400m",
revision="decay100"
)
This checkpoint availability enables detailed analysis of training dynamics, loss curves, and capability emergence across the complete 2T token training process.
Usage Examples
Encoder: Masked Language Modeling
Click to expand encoder usage examples
from transformers import AutoTokenizer, AutoModelForMaskedLM
import torch
# Load MLM model
tokenizer = AutoTokenizer.from_pretrained("jhu-clsp/ettin-encoder-150m")
model = AutoModelForMaskedLM.from_pretrained("jhu-clsp/ettin-encoder-150m")
def predict_masked_token(text):
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
# Get predictions for [MASK] tokens
mask_indices = torch.where(inputs["input_ids"] == tokenizer.mask_token_id)
predictions = outputs.logits[mask_indices]
# Get top 5 predictions
top_tokens = torch.topk(predictions, 5, dim=-1)
return [tokenizer.decode(token) for token in top_tokens.indices[0]]
# Example
masked_text = "The capital of France is [MASK]."
predictions = predict_masked_token(masked_text)
print(f"Predictions: {predictions}")
Decoder: Text Generation
Click to expand decoder text generation
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("jhu-clsp/ettin-decoder-150m")
model = AutoModelForCausalLM.from_pretrained("jhu-clsp/ettin-decoder-150m")
# Set pad token if needed
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
def generate_text(prompt, max_length=100, temperature=0.7):
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
inputs.input_ids,
max_length=max_length,
temperature=temperature,
do_sample=True,
pad_token_id=tokenizer.eos_token_id,
num_return_sequences=1
)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
# Example usage
prompt = "The future of artificial intelligence is"
generated = generate_text(prompt)
print(generated)
π¬ Research Applications
What Makes Ettin Unique
Ettin provides the first controlled comparison of encoder vs. decoder architectures:
- Identical Training Data: Same 2T token mixture across all models
- Matched Architectures: Only attention patterns and objectives differ
- Open Everything: Training data, model weights, and batch-level training order
- Multiple Scales: Fair comparison from 17M to 1B parameters
- 250+ Checkpoints: Complete training trajectory analysis
Key Research Findings
Architecture Specialization Persists:
- Encoders excel at classification/retrieval even vs. larger decoders
- Decoders excel at generation even vs. larger encoders
- A 400M encoder beats a 1B decoder on MNLI (89.2 vs 88.2)
Cross-Training Limitations:
- Converting decoderβencoder or encoderβdecoder underperforms
- 50B tokens of continued training insufficient to close gaps
- Native training objective remains superior
Scaling Insights:
- Performance gaps between architectures widen with size
- Decoder-from-encoder adaptation scales particularly poorly
Use Cases for Researchers
- Architecture Studies: Compare encoder vs decoder capabilities fairly
- Training Dynamics: Analyze 250+ checkpoints with batch-level data ordering
- Scaling Laws: Study how architectural advantages change with scale
- Transfer Learning: Investigate cross-objective training effectiveness
- Replication Studies: First open replication of ModernBERT training recipe
Reproducibility
All training artifacts are publicly available:
- Training data with exact batch ordering
- Model checkpoints every 8.5B tokens
- Complete hyperparameter configurations
- Training code and evaluation scripts
Training Details
Data: High-quality mixture including DCLM, Dolma v1.7, scientific papers, code, and curated sources totaling 2T+ tokens
Architecture: Transformer with RoPE, GLU activations, and prenorm layers
Training Phases:
- Pre-training: 1.7T tokens with diverse data mixture
- Mid-training: 250B tokens with higher-quality filtered data and context extension to 8K
- Decay phase: 100B tokens with premium data sources
Key Features:
- Context length: Up to 8K tokens
- Vocabulary: 50,368 tokens (ModernBERT tokenizer)
- Deep but efficient architectures following MobileLLM principles
Model Architecture
Parameter | 17M | 32M | 68M | 150M | 400M | 1B |
---|---|---|---|---|---|---|
Layers | 7 | 10 | 19 | 22 | 28 | 28 |
Hidden Size | 256 | 384 | 512 | 768 | 1024 | 1792 |
Intermediate Size | 384 | 576 | 768 | 1152 | 2624 | 3840 |
Attention Heads | 4 | 6 | 8 | 12 | 16 | 28 |
Citation
If you use Ettin models in your research, please cite our work:
@misc{weller2025seqvsseq,
title={Seq vs Seq: An Open Suite of Paired Encoders and Decoders},
author={Orion Weller and Kathryn Ricci and Marc Marone and Antoine Chaffin and Dawn Lawrie and Benjamin Van Durme},
year={2025},
note={Paper coming soon},
url={https://github.com/jhu-clsp/ettin-encoder-vs-decoder},
}
- Downloads last month
- 113