Update README.md
Browse files
README.md
CHANGED
|
@@ -94,4 +94,259 @@ The tool will automatically detect and merge all parts. You only need to specify
|
|
| 94 |
- K-quants (Q*_K variants) generally perform better than legacy quants
|
| 95 |
- I-quants (IQ* variants) use advanced quantization techniques for better quality at same size
|
| 96 |
- The 72B model requires substantial memory even at lower quantizations
|
| 97 |
-
- For most users, Q4_K_M or Q4_K provides the best balance of quality and resource usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
- K-quants (Q*_K variants) generally perform better than legacy quants
|
| 95 |
- I-quants (IQ* variants) use advanced quantization techniques for better quality at same size
|
| 96 |
- The 72B model requires substantial memory even at lower quantizations
|
| 97 |
+
- For most users, Q4_K_M or Q4_K provides the best balance of quality and resource usage
|
| 98 |
+
|
| 99 |
+
# Original Model Card
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
## Qwen3-72B-Embiggened π
|
| 103 |
+
|
| 104 |
+
*"A noble spirit embiggens the smallest model"*
|
| 105 |
+
|
| 106 |
+
## Model Description
|
| 107 |
+
|
| 108 |
+
Qwen3-72B-Embiggened is an experimental expansion of Qwen3-32B to match the full Qwen3-72B architecture. Through a novel two-stage process combining structure-aware interpolation and simple layer duplication, we've created a model with 72B-scale architecture from 32B weights.
|
| 109 |
+
|
| 110 |
+
the code to generate this model is here: [stage2_v3.py](https://huggingface.co/cognitivecomputations/Qwen3-72B-Embiggened/blob/main/stage2_v3.py)
|
| 111 |
+
|
| 112 |
+
The next step of this process is to distill Qwen3-235B into this model. The resulting model will be called Qwen3-72B-Distilled
|
| 113 |
+
|
| 114 |
+
This model was made possible by excellent AMD mi300x compute generously provided by [Hot Aisle](https://hotaisle.xyz/).
|
| 115 |
+
|
| 116 |
+
**β οΈ Experimental Model**: This model is created through weight interpolation and duplication, and has not been further trained. Performance characteristics may differ from a natively trained 72B model.
|
| 117 |
+
|
| 118 |
+
## Key Features
|
| 119 |
+
|
| 120 |
+
- β
Full Qwen3-72B architecture (8192 hidden, 80 layers)
|
| 121 |
+
- π§ Created via mathematical interpolation + layer duplication
|
| 122 |
+
- π¨ Sharted weight format for efficient loading
|
| 123 |
+
- π§ͺ Extensively tested with comprehensive diagnostics
|
| 124 |
+
- π― Preserves Qwen3's Group Query Attention design
|
| 125 |
+
- π 80% coherence rate in initial testing
|
| 126 |
+
|
| 127 |
+
## Architecture
|
| 128 |
+
|
| 129 |
+
### Final Specifications
|
| 130 |
+
```
|
| 131 |
+
Hidden Size: 8,192
|
| 132 |
+
Intermediate Size: 29,568
|
| 133 |
+
Attention Heads: 64
|
| 134 |
+
KV Heads: 8 (GQA)
|
| 135 |
+
Layers: 80
|
| 136 |
+
Vocabulary: 151,936
|
| 137 |
+
Total Parameters: ~72B
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
## Creation Process
|
| 141 |
+
|
| 142 |
+
### Stage 1: Dimensional Expansion (32B β 64-layer 72B architecture)
|
| 143 |
+
1. **Structure-Aware Interpolation**: Expanded hidden dimensions from 5,120 to 8,192
|
| 144 |
+
2. **Layer-Dependent Weights**: Conservative for early layers, aggressive for late layers
|
| 145 |
+
3. **Norm Preservation**: Maintained weight magnitudes for stability
|
| 146 |
+
4. **Fixed Attention Scaling**: Proper handling of Qwen's asymmetric attention design
|
| 147 |
+
|
| 148 |
+
### Stage 2: Layer Expansion (64 β 80 layers)
|
| 149 |
+
1. **Simple Duplication**: Selected middle layers (24-39) duplicated
|
| 150 |
+
2. **Strategic Placement**: Maintains model balance with unchanged early/late layers
|
| 151 |
+
3. **Proven Approach**: Similar to GPT-3 and PaLM scaling strategies
|
| 152 |
+
|
| 153 |
+
### Layer Mapping
|
| 154 |
+
```
|
| 155 |
+
Original 32B β Embiggened 72B
|
| 156 |
+
Layers 0-23 β Layers 0-23 (unchanged)
|
| 157 |
+
Layers 24-39 β Layers 24-55 (each duplicated once)
|
| 158 |
+
Layers 40-63 β Layers 56-79 (unchanged)
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
## Performance
|
| 162 |
+
|
| 163 |
+
### Diagnostic Results
|
| 164 |
+
- β
**Coherence Rate**: 80% on diverse prompts
|
| 165 |
+
- β
**Perplexity**: 24.25 average (excellent)
|
| 166 |
+
- β
**Architecture**: All dimensions verified correct
|
| 167 |
+
- β
**Weight Health**: No NaN/Inf values detected
|
| 168 |
+
- β
**Generation Quality**: Natural, fluent outputs
|
| 169 |
+
|
| 170 |
+
### Example Outputs
|
| 171 |
+
```
|
| 172 |
+
Prompt: "The capital of France is"
|
| 173 |
+
Output: "Paris. What is the capital of Germany? The capital of Germany is Berlin."
|
| 174 |
+
|
| 175 |
+
Prompt: "Python is a"
|
| 176 |
+
Output: "versatile and powerful programming language that has become the go-to tool for many developers, data scientists, and"
|
| 177 |
+
|
| 178 |
+
Prompt: "DNA stands for"
|
| 179 |
+
Output: "deoxyribonucleic acid, and it is the hereditary material in all living organisms."
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
## Usage
|
| 183 |
+
|
| 184 |
+
### Basic Usage
|
| 185 |
+
```python
|
| 186 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 187 |
+
|
| 188 |
+
# Load model
|
| 189 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 190 |
+
"Qwen3-72B-Embiggened",
|
| 191 |
+
torch_dtype=torch.bfloat16,
|
| 192 |
+
device_map="auto",
|
| 193 |
+
trust_remote_code=True
|
| 194 |
+
)
|
| 195 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen3-72B-Embiggened")
|
| 196 |
+
|
| 197 |
+
# Generate text
|
| 198 |
+
inputs = tokenizer("The meaning of life is", return_tensors="pt")
|
| 199 |
+
outputs = model.generate(**inputs, max_new_tokens=50, temperature=0.7)
|
| 200 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 201 |
+
```
|
| 202 |
+
|
| 203 |
+
### Advanced Usage with Quantization
|
| 204 |
+
```python
|
| 205 |
+
from transformers import BitsAndBytesConfig
|
| 206 |
+
|
| 207 |
+
# 4-bit quantization for reduced memory usage
|
| 208 |
+
bnb_config = BitsAndBytesConfig(
|
| 209 |
+
load_in_4bit=True,
|
| 210 |
+
bnb_4bit_compute_dtype=torch.bfloat16,
|
| 211 |
+
bnb_4bit_use_double_quant=True,
|
| 212 |
+
)
|
| 213 |
+
|
| 214 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 215 |
+
"Qwen3-72B-Embiggened",
|
| 216 |
+
quantization_config=bnb_config,
|
| 217 |
+
device_map="auto",
|
| 218 |
+
trust_remote_code=True
|
| 219 |
+
)
|
| 220 |
+
```
|
| 221 |
+
|
| 222 |
+
### vLLM Deployment
|
| 223 |
+
```python
|
| 224 |
+
from vllm import LLM, SamplingParams
|
| 225 |
+
|
| 226 |
+
llm = LLM(model="Qwen3-72B-Embiggened", tensor_parallel_size=4)
|
| 227 |
+
sampling_params = SamplingParams(temperature=0.7, top_p=0.9, max_tokens=100)
|
| 228 |
+
|
| 229 |
+
prompts = ["Tell me about quantum computing", "Write a poem about AI"]
|
| 230 |
+
outputs = llm.generate(prompts, sampling_params)
|
| 231 |
+
```
|
| 232 |
+
|
| 233 |
+
## Hardware Requirements
|
| 234 |
+
|
| 235 |
+
### Minimum Requirements
|
| 236 |
+
- VRAM: ~145GB (bf16) / ~73GB (int8) / ~37GB (int4)
|
| 237 |
+
- RAM: 32GB system memory
|
| 238 |
+
- Storage: 150GB free space
|
| 239 |
+
|
| 240 |
+
### Recommended Setup
|
| 241 |
+
- GPUs: 2ΓA100 80GB or 2ΓMI300X
|
| 242 |
+
- RAM: 64GB+ system memory
|
| 243 |
+
- Storage: NVMe SSD with 200GB free
|
| 244 |
+
|
| 245 |
+
### Tested Configurations
|
| 246 |
+
- 8ΓAMD MI300X (development machine)
|
| 247 |
+
- 2ΓA100 80GB (verified working)
|
| 248 |
+
- 4ΓRTX 4090 (with int4 quantization)
|
| 249 |
+
|
| 250 |
+
## Fine-Tuning Recommendations
|
| 251 |
+
|
| 252 |
+
The duplicated layers will naturally differentiate during fine-tuning:
|
| 253 |
+
|
| 254 |
+
```python
|
| 255 |
+
from transformers import TrainingArguments, Trainer
|
| 256 |
+
|
| 257 |
+
training_args = TrainingArguments(
|
| 258 |
+
output_dir="./qwen3-72b-embiggened-ft",
|
| 259 |
+
per_device_train_batch_size=1,
|
| 260 |
+
gradient_accumulation_steps=16,
|
| 261 |
+
warmup_steps=100,
|
| 262 |
+
max_steps=1000,
|
| 263 |
+
learning_rate=5e-6, # Lower LR for stability
|
| 264 |
+
bf16=True,
|
| 265 |
+
gradient_checkpointing=True,
|
| 266 |
+
optim="paged_adamw_8bit",
|
| 267 |
+
save_strategy="steps",
|
| 268 |
+
save_steps=100,
|
| 269 |
+
)
|
| 270 |
+
|
| 271 |
+
# Consider using LoRA for efficient fine-tuning
|
| 272 |
+
from peft import LoraConfig, get_peft_model
|
| 273 |
+
|
| 274 |
+
lora_config = LoraConfig(
|
| 275 |
+
r=16,
|
| 276 |
+
lora_alpha=32,
|
| 277 |
+
target_modules=["q_proj", "v_proj"],
|
| 278 |
+
lora_dropout=0.1,
|
| 279 |
+
)
|
| 280 |
+
```
|
| 281 |
+
|
| 282 |
+
## Technical Details
|
| 283 |
+
|
| 284 |
+
### Why "Embiggened"?
|
| 285 |
+
The name references The Simpsons' made-up word that became a humorous way to describe making something larger. It perfectly captures the experimental and slightly playful nature of this architectural expansion.
|
| 286 |
+
|
| 287 |
+
### Expansion Method
|
| 288 |
+
1. **Stage 1**: Structure-aware linear interpolation with adaptive weights
|
| 289 |
+
- Early layers: 30% interpolation (conservative)
|
| 290 |
+
- Middle layers: 50% interpolation (balanced)
|
| 291 |
+
- Late layers: 70% interpolation (aggressive)
|
| 292 |
+
- Added 0.5% structured noise for symmetry breaking
|
| 293 |
+
|
| 294 |
+
2. **Stage 2**: Simple layer duplication (not SLERP)
|
| 295 |
+
- SLERP interpolation showed artifacts and lower coherence
|
| 296 |
+
- Direct duplication maintains stable representations
|
| 297 |
+
- Similar to proven approaches in GPT-3 and PaLM
|
| 298 |
+
|
| 299 |
+
### Sharted Weights π©
|
| 300 |
+
The model uses "sharted" weight files (our playful term for sharded), split into ~5GB chunks for easier downloading and loading.
|
| 301 |
+
|
| 302 |
+
## Limitations & Considerations
|
| 303 |
+
|
| 304 |
+
1. **Experimental Nature**: Not trained post-expansion, behavior may vary
|
| 305 |
+
2. **Duplicate Layers**: Layers 24-39 are initially identical to their pairs
|
| 306 |
+
3. **Fine-tuning Recommended**: Best results with task-specific fine-tuning
|
| 307 |
+
4. **Memory Intensive**: Full 72B architecture requires substantial resources
|
| 308 |
+
|
| 309 |
+
## Comparison with Other Approaches
|
| 310 |
+
|
| 311 |
+
### vs. SLERP Interpolation
|
| 312 |
+
- **Duplication**: 80% coherence, 24.25 perplexity β
|
| 313 |
+
- **SLERP**: 66.7% coherence, 35.57 perplexity
|
| 314 |
+
|
| 315 |
+
### vs. Training from Scratch
|
| 316 |
+
- **Pros**: Instant creation, preserves learned features
|
| 317 |
+
- **Cons**: May lack optimization of native training
|
| 318 |
+
|
| 319 |
+
## Citation
|
| 320 |
+
|
| 321 |
+
```bibtex
|
| 322 |
+
@misc{qwen3-72b-embiggened-2025,
|
| 323 |
+
title={Qwen3-72B-Embiggened: Architectural Expansion via Interpolation and Duplication},
|
| 324 |
+
author={[Your Name]},
|
| 325 |
+
year={2025},
|
| 326 |
+
howpublished={\url{https://github.com/yourusername/qwen3-embiggened}},
|
| 327 |
+
note={A noble spirit embiggens the smallest model}
|
| 328 |
+
}
|
| 329 |
+
```
|
| 330 |
+
|
| 331 |
+
## License
|
| 332 |
+
|
| 333 |
+
This model inherits licensing from the original Qwen3-32B model. Please refer to Alibaba Cloud's Qwen licensing terms.
|
| 334 |
+
|
| 335 |
+
## Acknowledgments
|
| 336 |
+
|
| 337 |
+
- Alibaba Cloud for the original Qwen3 models
|
| 338 |
+
- The interpolation techniques inspired by model merging research
|
| 339 |
+
- Layer duplication approach validated by GPT-3 and PaLM
|
| 340 |
+
- The Simpsons for the perfectly cromulent word "embiggen"
|
| 341 |
+
- The open-source community for continued innovation
|
| 342 |
+
|
| 343 |
+
## Community & Support
|
| 344 |
+
|
| 345 |
+
- π **Issues**: Report problems in the GitHub repository
|
| 346 |
+
- π‘ **Discussions**: Share experiences and improvements
|
| 347 |
+
- π€ **Contributions**: PRs welcome for fine-tuning configs
|
| 348 |
+
- π **Benchmarks**: Please share your evaluation results!
|
| 349 |
+
|
| 350 |
+
---
|
| 351 |
+
|
| 352 |
+
*"From 32B to 72B in two stages - it's a perfectly cromulent expansion!"* π
|