RAMP: Reinforcement Adaptive Mixed Precision Quantization for Efficient On Device LLM Inference
Abstract
Post training quantization is essential for deploying large language models (LLMs) on resource constrained hardware, yet state of the art methods enforce uniform bit widths across layers, yielding suboptimal accuracy efficiency trade offs. We present RAMP (Reinforcement Adaptive Mixed Precision), an off policy Soft Actor Critic framework that learns per layer bit width assignments to minimize perplexity under a global bit budget. The policy conditions on an 11 dimensional embedding of activation statistics, weight properties, and structural descriptors, enabling zero shot transfer across model families and scales. To enable stable sub 4 bit quantization, we introduce Scale Folding, a preconditioning technique that migrates activation outliers into weights via per channel scaling and normalization layer compensation. A quality prioritized reward with asymmetric penalties and budget cliffs drives rapid convergence. On Llama 2 7B, RAMP achieves 5.54 perplexity at 3.68GB (3.65 effective bits), outperforming uniform 4 bit AWQ (5.60 at 3.90 GB) and GPTQ by 6% in size and 1% to3% in quality. Critically, a policy trained only on Llama 2 7B generalizes zero shot to Llama 2 13B and Mistral 7B, often surpassing target specific training, supporting the hypothesis that quantization sensitivity is primarily architectural. The HALO pipeline exports allocations to GGUF format for kernel free inference on CPUs, GPUs, and edge devices, retaining 99.5% of FP16 commonsense reasoning performance.
Figures & tables
| Model | Parameters | FP16 Size | 24 GB GPU | Viable? |
|---|---|---|---|---|
| Llama-2-7B | 7.0B | 13.5 GB | 24 GB | Marginal |
| Llama-2-13B | 13.0B | 26.0 GB | 24 GB | No |
| Llama-3-8B | 8.0B | 16.1 GB | 24 GB | No |
| Mistral-7B | 7.0B | 14.5 GB | 24 GB | Marginal |
| GPT-3.5 | 175B+ | 350+ GB | 24 GB | Impossible |
| Method | Bit Allocation | Transfer | Eval Budget | Llama-2-7B PPL | Year |
|---|---|---|---|---|---|
| RTN-4 | Uniform | — | Single pass | 5.94 | 2018 |
| GPTQ-4 | Uniform | — | Per-layer opt. | 5.69 | 2023 |
| AWQ-4 | Uniform | — | Single pass | 5.60 | 2023 |
| SmoothQuant-4 | Uniform | — | Single pass | 5.62 | 2023 |
| QuIP#-4 | Uniform | — | Single pass | 5.62 | 2024 |
| LRQ-4 | Uniform | — | Single pass + preconditioner | 5.75 | 2025 |
| Component | Choice | Rationale |
|---|---|---|
| RL Algorithm | SAC (off-policy, continuous) | Sample-efficient learning with stable exploration |
| State Representation | 11-dimensional layer embeddings | Abstracts sensitivity; enables cross-model transfer |
| Action Space | Continuous scalar (mapped to discrete bits) | Smooth exploration |
| State Normalization | By layer width/depth | Approximate scale invariance |
| Policy Network | MLP (512–512–256) + LayerNorm | Capacity for heterogeneous sensitivities |
| Q-Networks | Twin critics + Polyak targets | Reduces overestimation bias |
| Method | WikiText-2 PPL | Model Size |
|---|---|---|
| No scale folding | 5.58 | 3.80 GB |
| HALO (with folding) | 5.54 | 3.68 GB |
| Platform | Device Example | Memory | Latency (ms/token) | PPL | Status |
|---|---|---|---|---|---|
| GPU | RTX 3090 | 3.7 GB | 7–10 | 5.54 | |
| GPU | A100 | 3.7 GB | 2–4 | 5.54 | |
| CPU | Intel Xeon (16-core) | 14 GB | 30–50 | 5.54 | |
| Apple Silicon | M1/M2/M3 | Unified | 25–80 | 5.54 | |
| ARM edge | Raspberry Pi-class | 4–8 GB | 300 | — | Runnable |
| Mobile SoC | Snapdragon-class | Device-dependent | Vendor-dependent | 5.5 | Prototype |
| Model | Params | Vocab | Hidden | Transformer Blocks | Attention |
|---|---|---|---|---|---|
| Llama-2-7B | 6.7B | 32K | 4096 | 32 | MHA |
| Llama-2-13B | 13B | 32K | 5120 | 40 | MHA |
| Llama-3-8B | 8B | 128K | 4096 | 32 | GQA |
| Mistral-7B | 7.2B | 32K | 4096 | 32 | SWA |
| DistilGPT-2 | 0.066B | 50K | 768 | 12 | MHA |
| Task | Type | Questions | Metric |
|---|---|---|---|
| PIQA ( Bisk et al., 2020 ) | Commonsense | 2-choice | Accuracy |
| HellaSwag ( Zellers et al., 2019 ) | Commonsense | 4-choice | Accuracy |
| WinoGrande ( Sakaguchi et al., 2020 ) | Commonsense | 2-choice | Accuracy |
| ARC ( Clark et al., 2018 ) | Reasoning | Multiple-choice | Accuracy |
| Method | Type | PPL | Size (GB) |
|---|---|---|---|
| FP16 | Upper bound | 5.51 | 13.5 |
| RTN-4 | Naive | 5.94 | 3.90 |
| GPTQ-4 ( Frantar et al., 2023 ) | SOTA | 5.69 | 3.90 |
| AWQ-4 ( Lin et al., 2023 ) | SOTA | 5.60 | 3.90 |
| QUIP#-4 ( Tseng et al., 2024 ) | SOTA | 5.62 | 3.90 |
| Q4_K_M (GGUF) | Deployment | 5.61 | 3.95 |
| Parameter | Value | Rationale |
| Learning rate | Actor and critics | |
| Batch size | 128 | Stability vs. efficiency |
| Replay buffer | 30,000 transitions | 120 episodes 250 steps |
| Discount | 0.99 | Standard episodic RL |
| Target update | 0.005 | Slow tracking |
| Gradient clip | 1.0 | Stability |
| Parameter | Value | Rationale |
|---|---|---|
| Method | Per-group asymmetric | Standard LLM PTQ |
| Group size | 128 | GGUF-compatible |
| Bit widths | Aggressive compression range | |
| Target avg. bits | 4.0 | Compression goal |
| Ceiling | 4.25 | Reward-enforced |
| Calibration | WikiText-2 (128 seq., 2048 tokens) | Efficient and representative |
| Parameter | Value | Rationale |
|---|---|---|
| Scale | Smoothing | |
| Normalization | Magnitude preservation | |
| Stabilization | Numerical safety | |
| Scope | Per-channel (Q/K/V/O/gate/up) | Fine-grained conditioning |
| Norm adjustment | Equivalence preservation | |
| Calibration | 128 sequences | Reuse of quantization data |
| Method | Size (GB) | PPL | Size vs RAMP | PPL vs RAMP |
|---|---|---|---|---|
| FP16 | 13.5 | 5.51 | — | |
| RTN-4 | 3.90 | 5.94 | ||
| GPTQ-4 | 3.90 | 5.69 | ||
| AWQ-4 | 3.90 | 5.60 | ||
| QUIP#-4 | 3.90 | 5.62 | ||
| Q4_K_M | 3.95 | 5.61 |
| Method | Size (GB) | PPL | Size vs RAMP | PPL vs RAMP |
|---|---|---|---|---|
| FP16 | 26.0 | 4.85 | — | |
| GPTQ-4 | 7.68 | 5.02 | ||
| AWQ-4 | 7.68 | 4.97 | ||
| Q4_K_M | 7.73 | 4.98 | ||
| Direct SAC | 7.25 | 4.96 | ||
| RAMP (zero-shot) | 7.24 | 4.95 | — | — |
| Method | Size (GB) | PPL | Size vs RAMP | PPL vs RAMP |
|---|---|---|---|---|
| FP16 | 16.1 | 6.23 | — | |
| GPTQ-4 | 5.74 | 8.58 | ||
| AWQ-4 | 5.31 | 6.74 | ||
| Q4_K_M | 5.48 | 6.79 | ||
| RAMP (zero-shot) | 4.22 | 6.47 | — | — |
| Method | Size (GB) | PPL | Size vs RAMP | PPL vs RAMP |
|---|---|---|---|---|
| FP16 | 14.5 | 5.45 | — | |
| GPTQ-4 | 3.85 | 5.71 | ||
| AWQ-4 | 3.85 | 5.59 | ||
| Q4_K_M | 3.90 | 5.60 | ||
| Direct SAC | 3.62 | 5.58 | ||
| RAMP (zero-shot) | 3.63 | 5.56 | — | — |
| Target | Direct PPL | Direct Bits | Zero-shot PPL | Zero-shot Bits | Winner |
|---|---|---|---|---|---|
| Llama-2-13B | 4.96 | 3.66 | 4.95 | 3.66 | Zero-shot |
| Mistral-7B | 5.58 | 3.67 | 5.56 | 3.67 | Zero-shot |
| Method | PIQA | HellaSwag | WinoGrande | ARC | Avg |
|---|---|---|---|---|---|
| FP16 | 79.4% | 58.2% | 64.0% | 53.9% | 63.9% |
| AWQ-4 | 78.8% | 57.1% | 62.3% | 52.4% | 62.7% |
| Q4_K_M | 78.6% | 56.9% | 62.1% | 52.1% | 62.4% |
| RAMP | 79.2% | 57.9% | 63.7% | 53.6% | 63.6% |
| Retention vs. FP16 | 99.7% | 99.5% | 99.5% | 99.4% | 99.5% |
| Layer Role | Llama-2-7B | Llama-2-13B | Mistral-7B | Correlation |
|---|---|---|---|---|
| Embedding layer | (0.87, 0.34, 0.12, …) | (0.91, 0.36, 0.13, …) | (0.85, 0.32, 0.11, …) | |
| Attention o_proj | (3.12, 0.18, 0.08, …) | (3.15, 0.19, 0.09, …) | (3.08, 0.17, 0.07, …) | |
| MLP down_proj | (2.87, 0.22, 0.11, …) | (2.91, 0.23, 0.12, …) | (2.84, 0.21, 0.10, …) | |
| Output layer | (1.24, 0.41, 0.19, …) | (1.28, 0.42, 0.20, …) | (1.21, 0.40, 0.18, …) |
| Configuration | Episodes to Conv. | Final PPL | Stable? |
|---|---|---|---|
| No folding | 5.58 | Partial | |
| With folding | 150 | 5.54 |
| Reward | Episodes to Conv. | Final PPL | Variance |
|---|---|---|---|
| Naive (Acc - Bits) | 0.35 | ||
| Linear | 200 | 5.61 | 0.18 |
| Quality-first (asymmetric + cliff) | 150 | 5.54 | 0.05 |
| Algorithm | GPU Hours | Final PPL | Variance |
|---|---|---|---|
| PPO | 48 | 5.62 | 0.15 |
| SAC | 6 | 5.54 | 0.03 |
| Approach | Throughput | Portability / Effort |
|---|---|---|
| Custom mixed-precision kernels | Highest (hardware-specific) | Low (high engineering) |
| HALO / GGUF | Competitive | High (zero custom dev, broad hardware) |
| Deployment | Power (W) | Annual kWh | CO 2 (kg) | Cost ($) |
|---|---|---|---|---|
| Cloud A100 | 350 | 2,920 | 1,168 | 292 |
| RTX 3090 FP16 | 250 | 2,088 | 835 | 209 |
| RTX 3090 RAMP | 85 | 711 | 284 | 71 |
| Xeon CPU RAMP | 65 | 546 | 218 | 55 |
| M1 laptop RAMP | 12 | 101 | 40 | 10 |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Dim | Feature | Computation / Definition |
|---|---|---|
| 1 | Normalized depth | |
| 2 | Log input dimension | |
| 3 | Log output dimension | |
| 4 | Weight standard deviation | |
| 5 | Weight mean magnitude | |
| 6 | Layer-type scalar | 0.0 (Q/K/V proj.), 0.25 (output proj.), 0.5 (gate proj.), 0.6 (up proj.), 0.75 (down proj.), 1.0 (otherwise) |
| Parameter | Value | Notes |
|---|---|---|
| Learning rate | Shared across actor, critics, and temperature optimizer | |
| Optimizer | Adam | Applied to all components |
| Discount factor | 0.99 | Standard for episodic tasks |
| Target update rate | 0.005 | Ensures slow tracking of target networks |
| Gradient clipping norm | 1.0 | Prevents exploding gradients |
| Target entropy | For single-dimensional continuous action |
| Parameter | Value | Notes |
|---|---|---|
| Batch size | 128 | Used for all gradient updates |
| Replay buffer capacity | 30,000 transitions | Sufficient for 120 episodes 250 steps |
| Warm-up episodes | 20 | Purely random actions before policy gradients |
| Maximum episodes | 200–300 | Typical convergence budget in experiments |
| Component | Architecture | Notes |
|---|---|---|
| Actor | FC-512-LN-ReLU FC-512-LN-ReLU FC-256-ReLU FC-2 | Outputs mean and log-std of action |
| Critic (twin) | FC-512-LN-ReLU FC-512-LN-ReLU FC-256-ReLU FC-1 | Input is state concatenated with continuous action |
| Hidden activation | ReLU | Fast and effective for policy/value approximation |
| Normalization | LayerNorm | Applied after the first two hidden layers |