Ettin Suite: SoTA Paired Encoders and Decoders
요약
Ettin은 동일한 데이터(2T 토큰), 아키텍처, 그리고 훈련 레시피를 사용하여 처음으로 최고 수준의 성능을 보이는 페어드 인코더 전용 및 디코더 전용 모델을 선보입니다. 이 접근 방식은 엔코더와 디코더라는 두 가지 다른 아키텍처 간에 진정한 'apples-to-apples' 비교를 가능하게 합니다. Ettin은 ModernBERT의 최신 기법을 활용하여 인코더 훈련에 적용했으며, 특히 분류나 검색 같은 판별적 작업에서 강점을 보이는 엔코더 모델의 중요성을 강조합니다. 이들은 다양한 크기(17M~1B)로 제공되어 온디바이스부터 대규모 애플리케이션까지 폭넓게 활용 가능하며, 모든 훈련 데이터가 공개적으로 재현 가능하다는 장점이 있습니다.
핵심 포인트
- Ettin은 동일한 조건에서 훈련된 페어드 인코더 및 디코더 모델을 제공하여 아키텍처 간의 공정한 비교를 가능하게 합니다.
- 엔코더(Encoder)는 양방향 어텐션(bidirectional attention)을 사용하여 분류, 검색 등 판별적 작업에 강점을 가지며, 디코더(Decoder)는 인과적 어텐션(causal attention)을 사용합니다.
- Ettin은 ModernBERT의 최신 훈련 레시피를 기반으로 하며, 엔코더 모델이 기존 대비 성능 향상 및 속도 개선을 이루었습니다.
- 모델 크기를 17M부터 1B까지 다양하게 제공하여 온디바이스 환경부터 대규모 서비스까지 폭넓게 대응할 수 있습니다.
- 모든 훈련 데이터가 공개적이고 재현 가능하므로, 사용자가 직접 새로운 데이터를 이용해 모델을 개선하거나 추가 학습시킬 수 있습니다.
ModernBERT 레시피를 디코더 전용 모델에 적용하면 어떤 일이 일어날까요? 결과적으로 Llama 3.2 1B 와 SmolLM2 를 능가하는 최상위 수준 (SoTA) 디코더 언어 모델을 만들었습니다!
우리는 새로운 오픈데이터 훈련 레시피를 소개합니다. 이 레시피로 엔코더 전용 ModernBERT 모델 (그리고 실제로는 이를 능가하여!) 을 재현할 수 있습니다. 우리는 동일한 레시피를 디코더 전용 모델에 적용합니다. 이제야 두 가지 다른 훈련 목표 (masked language modeling (MLM) 와 causal language modeling (CLM)) 를 가진 동일한 설정에서 훈련된 두 개의 최상위 수준 모델을 보유하게 되었습니다.
이 블로그 포스트는 Ettin 을 소개합니다. Ettin 은 첫 번째 SoTA paired encoder-only and decoder-only models (17M-1B params) 입니다. 이 모델들은 동일한 데이터 (2T tokens), 아키텍처, 및 훈련 레시피로 훈련되었습니다. Ettin 은 아키텍처 간 진정한 apples-to-apples 비교를 가능하게 하며, 두 카테고리 모두에서 state-of-the-art performance for open-data models 를 제공합니다. 우리는 이제 디코더에서 시작하여 경쟁력 있는 엔코더를 얻는 것이 가능한지, 그리고 그 반대의 경우를 더 탐구합니다.
모델을 테스트해 보려는 분들에게 이 블로그 포스트의 끝부분에 일부 boilerplates 가 있습니다!
LLM 커뮤니티는 GPT, Llama, Qwen 와 같은 디코더 전용 모델에 크게 수렴했습니다. 그들의 생성 능력은 놀랍습니다만, 이러한 집중은 BERT 와 같은 엔코더 전용 모델을 포함한 다른 카테고리에서 주목을 빼앗고 있습니다.
그러나 엔코더 BERT-like 모델은 분류, 검색, 임베딩 작업의 프로덕션 시스템의 일등공신입니다. 그들은 더 빠르고, 메모리 효율성이 높으며, 판별적 (discriminative) 작업에서는 종종 더 정확합니다. 핵심 차이는 attention 패턴에 있습니다:
Encoder models는 bidirectional attention 을 사용하여 각 토큰이 시퀀스 내 모든 다른 토큰을 "보게" 됩니다 (fully visible).
Decoder models는 causal attention 을 사용하여, autoregressive generation 을 가능하게 하기 위해 이전 토큰만 볼 수 있습니다.
디코더 모델은 빠른 혁신을 보였지만, 엔코더 모델 개발은 최근 ModernBERT 와 같은 노력까지도 제외하고 고착화되어 있었습니다. 그러나 어떤 아키텍처가 더 나은가요? 이전의 엔코더와 디코더 비교는 다른 데이터셋, 아키텍처, 및 훈련 레시피를 사용했기 때문에 판단하기 어려웠습니다.
Ettin 은 두 개의 노스 신화 거인 이름에서 유래되었으며, 동일한 데이터, 동일한 모델 모양 (model shapes), 및 동일한 훈련 레시피로 두 가지 아키텍처로 훈련함으로써 controlled comparison 를 제공합니다. 그들은 attention 패턴과 훈련 목표에서만 다릅니다!
우리는 디코더 전용 모델의 현대적 기법을 차용하여 엔코더 훈련에 가져온 ModernBERT 레시피를 기반으로 합니다. 이는 두 아키텍처를 훈련하는 강력한 기반을 제공합니다.
우리는 17M 에서 1B 파라미터까지 다양한 6 가지 크기를 훈련합니다. 이는 규모의 효과를 테스트할 수 있게 하며, 여러분이 사용할 수 있는 다양한 모델을 제공합니다! 당신이 빠른 on-device 모델이 필요하든, 강력하지만 느린 모델이 필요하든, 우리는 모두 커버해 드립니다!
우리는 성능을 극대화하기 위해 포괄적인 세 단계 훈련 방식을 사용합니다:
Phase 1 - Pre-training (1.7T tokens): 우리는 다양한 고품질 데이터 소스의 혼합으로 시작하며, 짧은 컨텍스트 (1024 tokens) 에서 훈련하여 강력한 기초 지식을 확립합니다.
Phase 2 - Context Extension (250B tokens): 우리는 더 높은 품질의 필터링된 데이터를 사용하여 컨텍스트 길이를 8K 토큰으로 늘립니다. 이를 통해 모델이 더 긴 문서와 복잡한 관계를 이해할 수 있습니다.
Phase 3 - Decay (100B tokens): 과학 논문, 교재 및 큐레이션된 콘텐츠와 같은 프리미엄 데이터 소스를 포함하여 학습률을 점진적으로 감소시키면서 마무리합니다.
Our encoder models gain all the benefits of ModernBERT's speed, allowing them to be significantly faster than the previous generations of encoders. (ModernBERT 의 속도상의 모든 혜택을 얻어 이전 세대 엔코더보다 훨씬 빠르게 작동할 수 있습니다.)
Unlike ModernBERT, all our training data is public and reproducible:
You can continue to train these models on new data or propose a new recipe to further improve results!
Our encoder models outperform ModernBERT across all tasks and model sizes, while using completely open training data. Since we provide a large range of sizes, you can now use ModernBERT-style models in smaller sizes (great for on-device or for fast-inference), or power up with a 1B-sized encoder that crushes the competition.
Applying the same recipe to decoder models yields equally impressive results, with our models outperforming or matching established baselines such as Llama 3.2 and SmolLM2:
The gains are particularly strong on knowledge-intensive tasks like SciQ, reflecting the benefits of our high-quality training data mixture. These results demonstrate that our training recipe creates genuinely strong models in both architectural paradigms.
For the first time, we can fairly compare encoder and decoder architectures trained with identical data and recipes. The results reveal fundamental architectural advantages that persist even when all other factors are controlled:
The results show clear patterns:
Encoders dominate classification and retrieval: On MNLI classification, even a 150M encoder (89.2) outperforms a 400M decoder (88.2). For retrieval tasks, the gap is smaller but still noticeable - especially when decoders are not trained with MNTP.
Decoders excel at generation: On generative tasks, decoders maintain consistent advantages, with the performance gap actually widening at larger model sizes.
Size doesn't always matter: A 400M encoder beats a 1B decoder on classification tasks, while a 400M decoder beats a 1B encoder on generation tasks.
Due to the lack of new encoder models, works like LLM2Vec have proposed to continue pre-training decoders with MLM. We can now test the effectiveness of this strategy!
We switched the objective and continued to train our models with the opposite objective for 50B additional tokens. This is what we found:
Encoder-from-decoder: Still generally trails native encoders on classification/retrievalDecoder-from-encoder: Are significantly worse than native decoders, especially at larger scales. This may be because the encoders were trained with MLM instead of MNTP (masked next token prediction) as proposed by LLM2Vec (and used in our encoder from decoder recipe).
This suggests the architecture choice matters fundamentally, not just the training objective.
With identical training data, we can study how different objectives affect learning. For example, analyzing gender bias using the WinoGender benchmark reveals:
Encoder modelsprefer gender-neutral pronouns more often (60%+ neutral vs 30%+ for decoders)Both architecturesshow male bias, but decoders slightly more soCross-objective trainingaffects bias patterns in measurable ways
This opens doors for systematic studies of how training objectives influence model behavior beyond just accuracy metrics.
You can use these models with just a few lines of code!
from transformers import AutoTokenizer, AutoModel
분류/임베딩 임베딩을 위한 인코더 로드
tokenizer = AutoTokenizer.from_pretrained("jhu-clsp/ettin-encoder-150m")
...
분류 및 검색 작업을 위해 인코더 모델을 사용하세요: 이러한 작업에 대해 세밀 조정된 버전을 사용하시길 원할 수 있습니다.
텍스트 생성 작업을 위해 디코더 모델을 사용하세요:
from transformers import AutoTokenizer, AutoModelForCausalLM
# 생성을 위한 디코더 로드
tokenizer = AutoTokenizer.from_pretrained("jhu-clsp/ettin-decoder-150m")
...
Sentence Transformers 를 사용하여 이를 밀집 임베딩 모델로 세밀 조정하는 방법을 확인하려면 클릭하세요
import argparse
from datasets import load_dataset
from sentence_transformers import (
...
PyLate 를 사용하여 이를 다중 벡터 임베딩 모델로 세밀 조정하는 방법을 확인하려면 클릭하세요
from datasets import load_dataset
from pylate import losses, models, utils
from sentence_transformers import (
...
Sentence Transformers 를 사용하여 이를 스페이스 검색 모델을 세밀 조정하는 방법을 확인하려면 클릭하세요
import logging
from datasets import load_dataset
from sentence_transformers import (
...
Sentence Transformers 를 사용하여 이를 리랭커 모델로 세밀 조정하는 방법을 확인하려면 클릭하세요
import logging
import traceback
import torch
...
디코더 학습 코드를 펼치기 위해 클릭하세요
python trl/scripts/sft.py \
--model_name_or_path jhu-clsp/ettin-decoder-17m \
--dataset_name trl-lib/Capybara \
...
python trl/scripts/sft.py \
--model_name_or_path jhu-clsp/ettin-decoder-17m \
--dataset_name trl-lib/Capybara \
...
sft.py 와 함께:
import argparse
from datasets import load_dataset
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
...
완전한 Ettin suite 는 인코더 및 디코더 모두에 대해 6 가지 다른 규모 (scale) 의 모델을 포함합니다:
표준 모델:
- ettin-encoder-17m / ettin-decoder-17m (17M 파라미터)
- ettin-encoder-32m / ettin-decoder-32m (32M 파라미터)
- ettin-encoder-68m / ettin-decoder-68m (68M 파라미터)
- ettin-encoder-150m / ettin-decoder-150m (150M 파라미터)
- ettin-encoder-400m / ettin-decoder-400m (400M 파라미터)
- ettin-encoder-1b / ettin-decoder-1b (1B 파라미터)
연구 리소스:
- 🤗 Ettin Model Collection
- 📝 Paper
- 🗂️ Training Data (2T+ 토큰, 완전 오픈)
- 💻 GitHub Repository
- 📊 250+ 학습 체크포인트를 통해 학습 동역학 또는 지식 학습을 연구하기 위한 것
AI 자동 생성 콘텐츠
본 콘텐츠는 Hugging Face Blog의 원문을 AI가 자동으로 요약·번역·분석한 것입니다. 원 저작권은 원저작자에게 있으며, 정확한 내용은 반드시 원문을 확인해 주세요.
원문 바로가기