Files

90 lines
2.9 KiB
Markdown
Raw Permalink Normal View History

---
license: llama2
base_model: meta-llama/Llama-2-7b-hf
pipeline_tag: text-generation
language:
- en
tags:
- llama
- text-generation
- rl-mpq
- mixed-precision
- quantization
- fake-quantization
- balanced
- llama-2
library_name: transformers
datasets:
- wikitext
widget:
- text: "The capital of France is"
---
# Llama 2 7B — RL-MPQ Balanced
Standalone **RL-MPQ** (Reinforcement Learning Mixed-Precision Quantization) checkpoint for the
**Balanced** scenario — a quantized variant of
[meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf).
| Field | Value |
|-------|-------|
| **Base model** | [meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf) |
| **Scenario** | Balanced |
| **Avg bits / weight** | 4.375 |
| **Compression vs FP16** | 3.6571× |
| **WikiText-2 PPL** | 5.0437 |
| **Layers** | 32 |
| **Bit distribution** | `{'4': 29, '8': 3}` |
| **Format** | Fake-quant FP16 + `rlmpq_policy.json` |
**Collection:** [RL-MPQ — Llama 2 7B](https://huggingface.co/collections/AvoCahDoe/rl-mpq-llama-2-7b-6a2ae4f8c590727304e3f634) — all five scenarios for Llama 2 7B.
## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "AvoCahDoe/llama-2-7b-rlmpq-balanced"
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="float16")
tokenizer = AutoTokenizer.from_pretrained(repo)
```
## Other Llama 2 7B scenarios
| Scenario | Avg bits | Compression | WikiText-2 PPL |
|----------|----------|-------------|----------------|
| [High Fidelity](https://huggingface.co/AvoCahDoe/llama-2-7b-rlmpq-high-fidelity) | 6.5 | 2.4615x | 4.9808 |
| [Conservative](https://huggingface.co/AvoCahDoe/llama-2-7b-rlmpq-conservative) | 5.125 | 3.122x | 5.0276 |
| [Aggressive](https://huggingface.co/AvoCahDoe/llama-2-7b-rlmpq-aggressive) | 3.5938 | 4.4522x | 5.2614 |
| [Extreme Survival](https://huggingface.co/AvoCahDoe/llama-2-7b-rlmpq-extreme-survival) | 2.9688 | 5.3895x | 10.9577 |
Grouped archive (all scenarios in one repo):
[AvoCahDoe/llama-2-7b-rlmpq](https://huggingface.co/AvoCahDoe/llama-2-7b-rlmpq)
## Method
1. **Phase 3** — PPO agent assigns per-layer bit widths under the Balanced reward target.
2. **Phase 4** — Policy replayed on real weights; WikiText-2 perplexity validates quality.
3. **Export** — Fake-quantized FP16 weights compatible with Hugging Face Transformers.
## Files
| File | Description |
|------|-------------|
| `config.json` | Llama architecture + RL-MPQ metadata |
| `model.safetensors` | Fake-quantized weights |
| `rlmpq_policy.json` | Per-layer bit-width policy |
| `rlmpq_metrics.json` | Validation & PPL summary |
## Citation
```bibtex
@misc{rlmpq_llama_2_7b_balanced_2026,
title = {RL-MPQ Balanced: Llama 2 7B Mixed-Precision Quantization},
author = {AvoCahDoe},
year = {2026},
url = {https://huggingface.co/AvoCahDoe/llama-2-7b-rlmpq-balanced}
}
```