Views
No views yet

| Method | num_pruned_layers | Dataset | State | race 🏁 | winogrande 🎲 | piqa 🧠 | boolq ❓ | openbookqa 📖 | sciq 🔬 | lambada_openai 🦙 | ppl | Avg-acc 📊 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| acc | acc | acc_norm | acc | acc_norm | acc_norm | acc | ||||||
| Llama 3.1 (baseline) | - | - | - | 0.450 | 0.779 | 0.810 | 0.842 | 0.430 | 0.961 | 0.732 | 3.404 | 0.712 |
| UIDL* | 8 | slim_orca | no training | 0.341 | 0.719 | 0.690 | 0.773 | 0.310 | 0.719 | 0.087 | 932.000 | 0.592 |
| ReplaceMe (Ours) ✅ | 8 | slim_orca | no training | 0.406 | 0.742 🏆 | 0.706 | 0.830 | 0.338 | 0.901 | 0.471 | 16.760 | 0.654 |
| ReplaceMe (Ours) ❌ | 8 | slim_orca | SFT | 0.431 🏆 | 0.716 | 0.728 🏆 | 0.849 🏆 | 0.378 🏆 | 0.912 🏆 | 0.697 🏆 | 4.04 🏆 | 0.669 🏆 |
🔥 Our Healed model can acheive 94.0% of baseline performance after healing on 1B tokens!
1pip install replaceme
2# or
3git clone https://github.com/mts-ai/ReplaceMe
4cd ReplaceMe
5pip install -e .# LSTSQ method (recommended)
run_replaceme --config ./reproduce/Replace_Me_pipeline_lstsq.yaml
# Cosine similarity method
run_replaceme --config ./reproduce/Replace_Me_pipeline_cosine.yaml1## EXAMPLE
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_name = "MTSAIR/Llama3.1-6B-ReplaceMe-Healed"
5
6model = AutoModelForCausalLM.from_pretrained(
7 model_name,
8 torch_dtype="auto",
9 device_map="auto"
10)
11tokenizer = AutoTokenizer.from_pretrained(model_name)
12
13prompt = "What is ReplaceME pruning method?!"
14messages = [
15 {"role": "user", "content": prompt}
16]
17text = tokenizer.apply_chat_template(
18 messages,
19 tokenize=False,
20 add_generation_prompt=True
21)
22model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
23
24output = model.generate(
25 **model_inputs,
26 max_new_tokens=512
27)
28response = tokenizer.batch_decode(output, skip_special_tokens=True)[0]
291@article{shopkhoev2025replaceme0,
2 title = {ReplaceMe: Network Simplification via Layer Pruning and Linear Transformations},
3 author = {Dmitriy Shopkhoev and Ammar Ali and Magauiya Zhussip and Valentin Malykh and Stamatios Lefkimmiatis and Nikos Komodakis and Sergey Zagoruyko},
4 year = {2025},
5 journal = {arXiv preprint arXiv: 2505.02819}
6}