Views
No views yet

| Method | Train-Free? | C3 | CMNLI | CHID (test) | WSC | HellaSwag | PIQA | Race-M | Race-H | MMLU | CMMLU | AVG | RP |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Llama 2 7B (baseline) | 43.8 | 33.0 | 41.6 | 37.5 | 71.3 | 78.1 | 33.1 | 35.5 | 46.8 | 31.8 | 45.3 | 100.0% | |
| LLM-Streamline* | ❌ | 🏆 43.3 | 33.0 | 24.1 | 36.5 | 🏆 61.1 | 🏆 71.5 | 34.8 | 37.0 | 45.5 | 29.4 | 41.6 | 92.0% |
| LLMPruner* | ❌ | 29.7 | 33.4 | 28.4 | 40.4 | 54.6 | 72.0 | 22.9 | 22.0 | 25.3 | 25.0 | 35.4 | 78.2% |
| SliceGPT* | ❌ | 31.5 | 31.6 | 18.5 | 43.3 | 47.5 | 68.3 | 27.0 | 29.4 | 28.8 | 24.8 | 35.1 | 77.5% |
| LaCo* | ❌ | 39.7 | 🏆 34.4 | 🏆 36.1 | 40.4 | 55.7 | 69.8 | 23.6 | 22.6 | 26.5 | 25.2 | 37.4 | 82.7% |
| UIDL* | ❌ | 40.2 | 🏆 34.4 | 21.5 | 40.4 | 59.7 | 69.0 | 35.2 | 34.7 | 44.6 | 28.9 | 40.9 | 90.3% |
| ReplaceMe (this model) | ✅ | 42.5 | 33.0 | 25.2 | 38.5 | 59.4 | 71.1 | 35.4 | 🏆 36.7 | 🏆 46.4 | 🏆 30.4 | 🏆 41.9 | 🏆 92.5% |
🔥 Our training-free methods achieve 92.5% of baseline performance while other approaches require expensive retraining!
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/Llama2-5B-ReplaceMe"
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}