初始化项目,由ModelHub XC社区提供模型
Model: oopere/Llama-3.2-1B-pruned-40pct Source: Original Platform
This commit is contained in:
36
.gitattributes
vendored
Normal file
36
.gitattributes
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
82
README.md
Normal file
82
README.md
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
---
|
||||||
|
library_name: transformers
|
||||||
|
license: llama3.2
|
||||||
|
metrics:
|
||||||
|
- accuracy
|
||||||
|
- perplexity
|
||||||
|
base_model:
|
||||||
|
- meta-llama/Llama-3.2-1B
|
||||||
|
---
|
||||||
|
|
||||||
|
# Model Card for oopere/pruned40-llama-1b
|
||||||
|
|
||||||
|
<!-- Provide a quick summary of what the model is/does. -->
|
||||||
|
This model is a pruned version of the Llama-3.2 architecture, with a parameter reduction of 40% in the MLP Layers.
|
||||||
|
The pruning process aims to enhance computational efficiency while maintaining acceptable performance across specific tasks.
|
||||||
|
This model is not intended to be used directly, but rather to be fine-tuned for specific tasks where it can achieve equal or superior performance compared to fine-tuning the base model for the same task.
|
||||||
|
|
||||||
|
|
||||||
|
## Model Details
|
||||||
|
|
||||||
|
- **Model Type:** Pruned version of LLaMA-1.2B using structured pruning
|
||||||
|
- **Original Model:** meta-llama/Llama-3.2-1B
|
||||||
|
- **Pruning Method:** Structured pruning of MLP layers using importance scores based on absolute maximum weights
|
||||||
|
- **Size Reduction:** 26.3% (from 1.24B to 914M parameters)
|
||||||
|
- **Architecture:** Same as original LLaMA but with reduced MLP layer sizes
|
||||||
|
- **Language(s):** Same as original model
|
||||||
|
- **License:** Same as original model
|
||||||
|
- **Developed by:** [Pere Martra](https://huggingface.co/oopere)
|
||||||
|
|
||||||
|
These models are part of the study "[Exploring GLU Expansion Ratios: Structured Pruning in Llama-3.2 Models](https://doi.org/10.31219/osf.io/qgxea)". They explore structured pruning in GLU-based architectures using Llama-3.2 (1B and 3B variants). The pruning experiments target optimal expansion ratios to balance performance, computational efficiency, and environmental sustainability. The models were evaluated across multiple benchmarks, including BoolQ, ARC-Easy, and MUSR, and demonstrate significant efficiency gains while maintaining robust task performance.
|
||||||
|
|
||||||
|
|
||||||
|
### Performance on Standard Benchmarks
|
||||||
|
|
||||||
|
| Benchmark | Original Model | Pruned Model | Relative Change |
|
||||||
|
| ---- | ---- | ---- | ---- |
|
||||||
|
| ARC-Easy | 65.19% | 40.19% | -38.7% |
|
||||||
|
| BoolQ | 64.16% | 62.11% | -3.2% |
|
||||||
|
| LAMBADA-OpenAI | 62.20% | 29.85% | -52.0% |
|
||||||
|
| LAMBADA-Standard | 53.46% | 24.78% | -53.6% |
|
||||||
|
|
||||||
|
### Key Findings
|
||||||
|
- Remarkably maintains strong performance on binary classification tasks (BoolQ)
|
||||||
|
- Significant degradation on reasoning tasks (ARC-Easy)
|
||||||
|
- Substantial impact on long-range comprehension (LAMBADA)
|
||||||
|
- Notable increase in perplexity for language modeling tasks
|
||||||
|
|
||||||
|
### Limitations
|
||||||
|
- Considerable reduction in performance on complex language understanding tasks
|
||||||
|
- Significant degradation in long-range dependency handling
|
||||||
|
- May not be suitable for applications requiring high accuracy on language completion tasks
|
||||||
|
- Best suited for simpler classification tasks
|
||||||
|
|
||||||
|
### Implementation Details
|
||||||
|
- **Pruning Notebook:** [Detailed implementation and methodology](https://github.com/peremartra/Large-Language-Model-Notebooks-Course/blob/main/6-PRUNING/6_3_pruning_structured_llama3.2-1b_OK.ipynb)
|
||||||
|
- **GitHub Repository:** [LLM Course](https://github.com/peremartra/Large-Language-Model-Notebooks-Course)
|
||||||
|
|
||||||
|
### Pruning Method
|
||||||
|
- **Technique:** Structured pruning targeting MLP layers
|
||||||
|
- **Pruning Ratio:** 40% of neurons removed from MLP layers
|
||||||
|
- **Selection Criteria:** Importance scoring based on absolute maximum weights
|
||||||
|
- **Architecture Specifics:** Maintained GLU structure during pruning
|
||||||
|
|
||||||
|
### Hardware Requirements
|
||||||
|
- Reduced memory footprint compared to original model
|
||||||
|
- Can run on hardware with ~26% less memory than original
|
||||||
|
|
||||||
|
## Acknowledgments
|
||||||
|
- Thanks to [Mariusz Kurman](https://huggingface.co/mkurman) for creating [llama-pruning](https://github.com/MedITSolutionsKurman/llama-pruning), a library that extends and improve this pruning methodology.
|
||||||
|
|
||||||
|
- This model was created following the pruning method described in the paper: The Width Pruning Dichotomy in Llama-3.2
|
||||||
|
```
|
||||||
|
@misc{martra2025fragileknowledgerobustinstructionfollowing,
|
||||||
|
title={Fragile Knowledge, Robust Instruction-Following: The Width Pruning Dichotomy in Llama-3.2},
|
||||||
|
author={Pere Martra},
|
||||||
|
year={2025},
|
||||||
|
eprint={2512.22671},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={cs.CL},
|
||||||
|
url={https://arxiv.org/abs/2512.22671},
|
||||||
|
}
|
||||||
|
```
|
||||||
36
config.json
Normal file
36
config.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"_name_or_path": "meta-llama/Llama-3.2-1B",
|
||||||
|
"architectures": [
|
||||||
|
"LlamaForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 128000,
|
||||||
|
"eos_token_id": 128001,
|
||||||
|
"head_dim": 64,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 2048,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 4916,
|
||||||
|
"max_position_embeddings": 131072,
|
||||||
|
"mlp_bias": false,
|
||||||
|
"model_type": "llama",
|
||||||
|
"num_attention_heads": 32,
|
||||||
|
"num_hidden_layers": 16,
|
||||||
|
"num_key_value_heads": 8,
|
||||||
|
"pretraining_tp": 1,
|
||||||
|
"rms_norm_eps": 1e-05,
|
||||||
|
"rope_scaling": {
|
||||||
|
"factor": 32.0,
|
||||||
|
"high_freq_factor": 4.0,
|
||||||
|
"low_freq_factor": 1.0,
|
||||||
|
"original_max_position_embeddings": 8192,
|
||||||
|
"rope_type": "llama3"
|
||||||
|
},
|
||||||
|
"rope_theta": 500000.0,
|
||||||
|
"tie_word_embeddings": true,
|
||||||
|
"torch_dtype": "bfloat16",
|
||||||
|
"transformers_version": "4.48.3",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 128256
|
||||||
|
}
|
||||||
9
generation_config.json
Normal file
9
generation_config.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 128000,
|
||||||
|
"do_sample": true,
|
||||||
|
"eos_token_id": 128001,
|
||||||
|
"temperature": 0.6,
|
||||||
|
"top_p": 0.9,
|
||||||
|
"transformers_version": "4.48.3"
|
||||||
|
}
|
||||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:2cb4544536146230dc17171ca056ed13a5684eec8fce071e7ad485f6579df1d0
|
||||||
|
size 1827557768
|
||||||
16
special_tokens_map.json
Normal file
16
special_tokens_map.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"bos_token": {
|
||||||
|
"content": "<|begin_of_text|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"eos_token": {
|
||||||
|
"content": "<|end_of_text|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
tokenizer.json
(Stored with Git LFS)
Normal file
BIN
tokenizer.json
(Stored with Git LFS)
Normal file
Binary file not shown.
2062
tokenizer_config.json
Normal file
2062
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user