OverFill

September 2, 2025 ยท View on GitHub

main

This repo contains the code and released models for our paper: OverFill: Two-Stage Models for Efficient Language Model Decoding. OverFill uses a full model for the prefill stage, processing system and user inputs in parallel. It then switches to a dense pruned model for sequential decoding. By leveraging more compute during prefill, OverFill achieves a better efficiency-accuracy tradeoff compared to traditional one-stage decoding.

๐Ÿ’พ Released Models

We release OverFill decoders in two sizes:

๐Ÿš€ Setup

# Create conda environment
conda create -n overfill python=3.10
conda activate overfill

# Install dependencies
pip install -r requirements.txt

# Install flash-attn
ninja --version && echo $?  # should return 0
pip install flash-attn==2.6.3 --no-build-isolation

# Install alignment-handbook
mkdir tmp && cd tmp
git clone https://github.com/huggingface/alignment-handbook.git
cd alignment-handbook
git checkout e057d7f
python -m pip install .

# Install lm_eval
cd ..
git clone https://github.com/EleutherAI/lm-evaluation-harness.git
cd lm-evaluation-harness
git checkout 370e2f9
python -m pip install -e .
pip install lm-eval[math] lm-eval[ifeval]

# Install OverFill
cd ../..
python -m pip install -e .

๐Ÿ’ก Prepare Pruned Model

You can either use existing pruned models:

Or you can prune your own model and push it to the Hugging Face Hub or save it locally. Refer to the README in the pruner folder.

๐ŸŽ“ Train

All training is configurable via YAML files located in the recipes/ folder. We recommend using 8 GPUs. To change this, modify recipes/accelerate_configs/deepspeed_zero3.yaml.

OverFill Training

3B โ†’ 1B

ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes accelerate_configs/deepspeed_zero3.yaml overfill/train.py recipes/llama-3_2-3b-instruct/sft/overfill_width.yaml --report_to=wandb

8B โ†’ 3B

ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/deepspeed_zero3.yaml overfill/train.py recipes/llama-3_1-8b-instruct/sft/overfill_width.yaml --report_to=wandb

Baseline Training

Finetune Base Model

# Finetune Llama 1B
ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/deepspeed_zero3.yaml overfill/train_sft.py recipes/llama-3_2-3b-instruct/sft/1b_base.yaml --report_to=wandb
# Finetune Llama 3B
ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/deepspeed_zero3.yaml overfill/train_sft.py recipes/llama-3_2-3b-instruct/sft/3b_base.yaml --report_to=wandb

Finetune Pruned Model

# Finetune 3B โ†’ 1B
ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/deepspeed_zero3.yaml overfill/train_sft.py recipes/llama-3_2-3b-instruct/sft/pruned_width.yaml --report_to=wandb
# Finetune 8B โ†’ 3B
ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/deepspeed_zero3.yaml overfill/train_sft.py recipes/llama-3_1-8b-instruct/sft/pruned_width.yaml --report_to=wandb

๐Ÿ”ข Evaluate

We use the lm-evaluation-harness package to evaluate all models. We provide evaluation scripts in eval_scripts for four model types: OverFill, Pruned, Finetuned, and Instruct (untuned).

ModelOverFillPrunedFinetunedInstruct
1Boverfill_1b.shpruned_1b.shfinetuned_1b.shinstruct_1b.sh
3B Decoderoverfill_1b.shpruned_3b.shfinetuned_3b.shinstruct_3b.sh
8B DecoderNANANAinstruct_8b.sh

Usage:

bash eval_scripts/{script_name} <model_path> <task> <n_shot>

Available Tasks:

  • gsm8k_cot_llama
  • wmt16-de-en
  • ifeval
  • arc_challenge_chat
  • mmlu_llama
  • nq_open

Notes:

  • For OverFill, Pruned, Finetuned: set <model_path> to the local path of your trained model.
  • For Instruct: set <model_path> to None.
  • For OverFill, if you want to use our released model instead of your local checkpoint, set <model_path> to None.
  • Results will be saved to eval_results folder.

Examples:

# Using locally trained OverFill model
bash eval_scripts/overfill_1b saved_models/3b_instruct_overfill_h0.45-i0.45-a0.0-d0.0 gsm8k_cot_llama 4

# Using released OverFill checkpoint
bash eval_scripts/overfill_1b None gsm8k_cot_llama 4

Citation

@inproceedings{kim2025overfill,
  title={OverFill: Two-Stage Models for Efficient Language Model Decoding},
  author={Kim, Woojeong and Wang, Junxiong and Yan, Jing Nathan and Abdelfattah, Mohamed and Rush, Alexander M.},
  booktitle={Conference on Language Modeling},
  year={2025},
  url={https://arxiv.org/abs/2508.08446}
}