Skip to content

Zhoutong-Wu/SkipV1Former

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SkipV1Former

Improving Model Representation and Reducing KV Cache via Skip Connections with First Value Heads


🧠 Overview

SkipV1Former introduces a simple yet effective architectural modification to Transformer models: it reuses the first-layer Value heads across deeper layers, improving model representation and reducing the cost of Value projections and KV-cache, while preserving model capacity.

This repository provides a reference implementation and reproduction code for the paper:

Improving Model Representation and Reducing KV Cache via Skip Connections with First Value Heads
Zhoutong Wu, Yuan Zhang et al., 2025

Two experiment suites are included:


🚀 Quick Start (5 minutes)

# 1️⃣ Clone this repo
git clone https://github.com/Zhoutong-Wu/SkipV1Former.git
cd SkipV1Former

# 2️⃣ Install PyTorch by platform (example: CUDA 12.1)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

# 3️⃣ GPT-side experiment (DenseFormer-based)
pip install -r GPT_experiments/requirements.txt
python GPT_experiments/main.py --dataset owt2 --skipv1 --iterations 40000 --lr 1e-3

# 4️⃣ LLaMA-side experiment (GaLore-based)
pip install -r LLaMA_experiments/exp_requirements.txt
cd LLaMA_experiments/scripts/benchmark_c4
chmod +x *.sh
. skip_llama_1b.sh

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published