File size: 24,467 Bytes
a1aff72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6390ee4
 
a1aff72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1c5db53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1aff72
 
1c5db53
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Oscillation-Driven Precision Expansion: Growing Neural Network Precision from 1-Bit to FP32 via Neuron Block Reallocation

**Author:** Левон Гиносян (Levon Ginosyan / `Logn001`)

## Abstract

Most neural network quantization methods start from full-precision (`FP32`/`BF16`) models and compress weights *downward* via Post-Training Quantization (PTQ) or Quantization-Aware Training (QAT). We investigate the inverse paradigm—**Oscillation-Driven Precision Expansion (ODPE)**—in which neurons initialize at ultra-low precision (`1-bit` scaled binary or tier-protected `2/4-bit`) and selectively grow along a progressive bit-width ladder (`1 → 2 → 4 → 8 → 16 → 32 [FP32]`) during training. A `PrecisionRouter` monitors parameter oscillations near quantization decision boundaries, promotes unstable neurons, physically reallocates them into contiguous homogeneous bit-width compute blocks, and verifies each upgrade on the current mini-batch.

We evaluate five progressive variants against an identical `FP32` baseline (`46.85%` test accuracy, `2.0297` test cross-entropy loss) on a controlled bilingual Natural Language Inference task (`facebook/xnli`, Russian and English, `50,000` training pairs, `10,020` test pairs, `10.85M` parameters per model):
- **ODPE V1 (No Penalty):** Reaches `45.12%` test accuracy at `15.71` mean linear bits (`2.04×` compression), with `40.92%` of weights reaching `FP32` and exhibiting mid-training instability from late block migrations.
- **ODPE V2 (Causal Rollback + Excess-Bit Penalty):** Reverts `18,305` unjustified promotions via deterministic `eval()`/`no_grad` verification, slashing mean bit-width to `5.82` bits (`5.50×` compression; only `7.64%` at `FP32`) while improving test accuracy over V1 to `45.87%`.
- **ODPE V3 (Two-Stage Discovery + Fixed-Structure Regularized Calibration):** Discovers precision structure during Stage 1 (`Epochs 1–4`), then freezes blocks in Stage 2 (`Epochs 5–8`) with regularization (`dropout=0.15`, `label_smoothing=0.08`). V3 matches `FP32` at Epoch 8 (`46.75%`) with **43% lower test loss** (`1.1599`) at `3.92×` compression (`8.15` bits), reaching `47.95%` on its Epoch 5 validation checkpoint.
- **ODPE V4 (Attention/Head Protection + Adaptive Freeze + EMA):** Protects attention (`2-bit`) and classifier (`4-bit`), eliminating V3's Epoch 1 cold start (`44.06%` vs. `35.12%` val) and peaking early at `47.95%` val (Epoch 2), reaching `46.83%` at Epoch 8 EMA (`8.57` bits, `3.73×`). However, an unmatched Stage-1 cosine horizon and missing Stage-1 best-checkpoint restoration degraded its Stage-2 start (`47.24%` best checkpoint).
- **ODPE V5 (Strict Verify-Loop Rollback + Best-S1 Restore + EMA Calibration):** Closes the verify-loop causal-rollback bypass, requires continuous cross-entropy justification (`strict_loss_gain_rollback`), aligns Stage-1 LR decay, restores Stage 1's best validation checkpoint (`Epoch 3`, `49.44%` val) into regularized Stage-2 calibration (`cal_lr=1.2e-4`, `dropout=0.15`, `weight_decay=0.03`, `label_smoothing=0.08`), and evaluates RAW vs. EMA (`0.99`) on validation. **V5 cuts mean linear bit-width to `3.39` bits (`9.44×` compression; only `1.82%` at `FP32`) while beating `FP32` on BOTH Epoch 8 final test accuracy (`48.11%` vs. `46.85%`, `+1.26` pp; `1.1441` test loss) and its Epoch 6 validation checkpoint (`48.76%`, `+1.91` pp over `FP32`).**

---

## 1. Introduction

Low-bit Quantization-Aware Training (QAT) commonly suffers from **weight oscillation**, where parameters near zero or quantization thresholds repeatedly flip across adjacent grid points under Straight-Through Estimator (STE) gradients. Prior work largely suppresses oscillations via regularization or freezes oscillating parameters at fixed low precision.

Instead of forcing every neuron into a uniform bit-width or suppressing oscillations uniformly, we ask whether a router can use oscillations as a bottom-up capacity demand signal—starting neurons at ultra-low precision and expanding only where needed—and how causal rollback inside verification, two-stage checkpoint handoff, structural protection, and Weight EMA govern accuracy, calibration loss, and compression.

Our contributions are:
1. **Bottom-Up Progressive Bit Ladder (`1 → 2 → 4 → 8 → 16 → 32`):** Starting linear neurons at `1-bit` scaled binary values with a 4-level non-zero `2-bit` grid preventing small-weight zero-collapse.
2. **Neuron-Level Homogeneous Block Reallocation:** Grouping output neurons into contiguous homogeneous bit-width buckets (`reallocate_blocks`) so metadata scales per neuron and execution separates cleanly by precision tier.
3. **Causal Rollback & Verify-Loop Bit Accounting (V2 → V5):** Measuring exact `old_bits` vs. `new_bits` prediction gain in deterministic `eval()` mode, closing secondary verify-loop upgrade cascades (`enforce_rollback_in_verify`), and preventing 1-sample metric noise from bypassing cross-entropy bit-cost penalties (`strict_loss_gain_rollback`).
4. **Two-Stage Fixed-Structure Calibration with Best-S1 Handoff (V3 → V5):** Protecting sensitive attention/head initialization (`protect_attention_and_head`), stopping Stage 1 upon router convergence or validation-loss rise, restoring Stage 1's peak checkpoint into regularized Stage-2 calibration, and selecting RAW vs. Weight EMA (`0.99`) via validation.

---

## 2. Related Work

- **Multi-Precision & Nested Checkpoints:** *Any-Precision Deep Neural Networks* (Yu et al., arXiv:1911.07346), *AdaBits* (Jin et al., arXiv:1912.09666), and *MatQuant* (Nair et al., arXiv:2502.06786) allow a single checkpoint to execute at multiple bit-widths at runtime, generally switching precision globally or slicing downward from higher-bit integers.
- **Bit-Plane & Residual Binarization:** *AnyBCQ* and *RaBiT* decompose weights into binary codes or residual `{-1, +1}` paths to refine precision progressively.
- **Content-Aware & Salient Mixed Precision:** *CADyQ* (Hong et al., arXiv:2207.10345) allocates per-input precision in super-resolution; *LLM.int8()*, *AWQ*, *SpQR*, and *PB-LLM* show that protecting only `~0.1%–5%` of salient/outlier weights preserves performance when compressing large models to `1–4` bits. Notably, ODPE V5 autonomously converges to protecting `1.82%` of linear weights at `FP32` and keeping `87.58%` in `1–4` bits.
- **QAT Weight Oscillations:** Nagel et al. (ICML 2022, *"Overcoming Oscillations in Quantization-Aware Training"*) characterized weight flipping across low-bit (`≤4`-bit) grids and mitigated it via oscillation dampening and iterative freezing. ODPE turns oscillation into a precision-expansion trigger with causal rollback.

---

## 3. Method

### 3.1 Progressive Mixed-Precision Quantization
For each output neuron row `w` with assigned bit-width `b ∈ {1, 2, 4, 8, 16, 32}`, forward quantization uses Straight-Through Estimation (`w_eff = w + (q_b(w) − w).detach()`):
- **`b = 1` (Scaled Binary):** `q_1(w) = α · sign_+(w)`, where `α = mean(|w|)` per neuron row.
- **`b = 2` (4-Level Symmetric Non-Zero Grid):** `q_2(w) = (clamp(round(w / Δ − 0.5), −2, 1) + 0.5) · Δ`, with `Δ = max(|w|) / 1.5`, yielding `{−1, −1/3, +1/3, +1} · max(|w|)`.
- **`b ∈ {4, 8, 16}` (Uniform Symmetric):** `q_b(w) = clamp(round(w / Δ_b), −q_max, q_max) · Δ_b`, where `q_max = 2^(b−1) − 1` and `Δ_b = max(|w|) / q_max`.
- **`b = 32` (`FP32`):** Exact identity `q_32(w) = w`.

### 3.2 Momentum-Aware Oscillation Routing & Block Reallocation
At step `t`, let `Δw_t = w_t − w_{t−1}`. An element is flagged oscillating if its update direction reverses (`Δw_{t−1} · Δw_t < 0`, both exceeding `min_delta`) or crosses zero (`w_{t−1} · w_t < 0`) inside `|w| ≤ 0.1`. Neuron `i` oscillates when at least fraction `τ` (`neuron_osc_threshold`) of its weights oscillate. Using `score_t[i] = decay · score_{t−1}[i] + 1{oscillating[i]}`, neurons exceeding `patience + penalty_boost[i]` (after `warmup_steps` and outside `cooldown`) advance on `BIT_LADDER` and trigger `reallocate_blocks()`.

### 3.3 Causal Rollback & Excess-Bit Penalty (V2)
Whenever `num_promoted > 0`, the router switches the model to deterministic `eval()` mode (`no_grad`) and evaluates the same weights on batch `B_t` under `old_bits` (`pre_loss, pre_metric`) and `new_bits` (`post_loss, post_metric`). V2 keeps the promotion if `pre_loss − post_loss ≥ min_loss_gain + bit_cost_weight · Δb_norm` (with `Δb_norm = (avg_bits_after − avg_bits_before) / 31.0`) or `post_metric > pre_metric`. Unjustified promotions revert to `old_bits` with `cooldown = 12` steps and `penalty_boost += 0.5`.

### 3.4 Two-Stage Fixed-Structure Calibration (V3) & V4 Ablation
V3 splits the 8-epoch budget into Stage 1 (`Epochs 1–4`, V2 routing on 4-epoch cosine LR) and frozen Stage 2 (`Epochs 5–8`, `cal_lr = 1.5e-4`, `dropout = 0.15`, `weight_decay = 0.03`, `label_smoothing = 0.08`). V4 added attention/head initialization protection (`attn=2`, `head=4`), auto-freeze in Epochs 3–5, `bit_cost_weight = 0.007`, softer Stage-2 regularization (`label_smoothing = 0.03`), and `ema_decay = 0.995`. Auditing V4 exposed an 8-epoch Stage-1 cosine LR horizon that kept Stage 1 too hot through Epoch 5, no restoration of Epoch 2's `47.95%` peak before freezing, weak Stage-2 regularization, and an unchecked verify-loop cascade bug shared across V1–V4.

### 3.5 Strict Verify Rollback & Best-S1 Handoff Calibration (V5)
V5 retains `protect_attention_and_head=True` (`attn_init_bits=2`, `head_init_bits=4`, FFN `1-bit`) and resolves every V1–V4 failure mode:
1. **Closed Verify-Loop Rollback Bypass (`enforce_rollback_in_verify=True`):** Secondary promotions triggered inside `while verify_iters` undergo the same deterministic `eval()` causal check instead of ascending unchecked toward `FP32`.
2. **Strict Continuous Loss Justification (`strict_loss_gain_rollback=True`):** Promotions must strictly satisfy `pre_loss − post_loss ≥ min_loss_gain + 0.008 · Δb_norm`, blocking 1-sample (`1/256`) discrete batch accuracy flips from excusing higher loss.
3. **Matched Stage-1 Cosine LR & Overfit-Aware Freeze:** Stage 1 schedules LR over `max_stage1_epochs = 5` with gentle `warmup_ratio = 0.14` (`137` warmup steps) and freezes inside Epochs 3–5 upon routing convergence (`promo_rate < 0.008, bits_delta < 0.05`) or early validation-loss rise (`val_loss > prev_val_loss + 0.025`). In our run, structure settled at `3.39` bits by Epoch 3 and froze cleanly after **Epoch 4** (`promo = 1`).
4. **Best Stage-1 Checkpoint Restoration:** Immediately upon freezing, V5 restores `best_s1_state` (Epoch 3: `val_acc = 49.44%`, `val_loss = 0.9981`, `avg_bits = 3.39`) together with its exact block permutations before entering Stage 2.
5. **Regularized Stage-2 Calibration with Validation-Selected EMA:** Stage 2 trains inside the frozen `3.39`-bit layout at `cal_lr = 1.2e-4`, `dropout = 0.15`, `weight_decay = 0.03`, `label_smoothing = 0.08`, maintaining `ema_decay = 0.99` and selecting between RAW and EMA weights each epoch strictly on `val_loader` (`EMA` won all 4 Stage-2 epochs).

---

## 4. Experimental Setup

- **Dataset (`10M` Benchmark, `facebook/xnli`, `ru` + `en`):** `50,000` training pairs (`25,000 ru + 25,000 en`), `4,980` validation (`2,490` per language), `10,020` held-out test (`5,010` per language), `2,000`-pair seen-training probe, plus an untouched `20,000`-pair disjoint stress split (`[50k..60k)` per language).
- **Dataset (`100M` Expanded Multi-Source Benchmark, `200,000` training pairs):** `60k` RU + `60k` EN non-stress `facebook/xnli`, `40k` RU + `15k` EN disjoint `MoritzLaurer/multilingual-NLI-26lang-2mil7` (`ANLI/FEVER/LingNLI/WANLI`), and `25k` EN `stanfordnlp/snli`, evaluated on the exact same `4,980` validation, `10,020` test, and `20,000` disjoint stress splits.
- **Shared Tokenizer & Model (`BilingualNLITransformer`):** ByteLevel BPE (`vocab_size = 10,000`, `max_len = 128`), `6` Pre-LN Transformer blocks, `d_model = 320`, `n_heads = 8`, `d_ff = 1280`, `dropout = 0.1` (Stage 2 V3/V5: `0.15`; V4: `0.12`), CLS + mean pooling head (`10,846,723` total parameters; `7,578,560` adaptive linear parameters across 38 `ProgressiveLinear` layers).
- **Training Parity:** Identical initial `state_dict` (`seed = 42`), identical shuffled batch order (`batch_size = 256`), `8` total epochs, `AdamW`, gradient clipping `1.0`, on one NVIDIA GeForce RTX 5070 Ti (`16,303 MiB`).
- **Router Hyperparameters:** `oscillation_band = 0.1`, `min_delta = 1e-5`, `osc_decay = 0.70`, `oscillation_patience = 1.95`, `warmup_steps = 30`, `neuron_osc_threshold = 0.11`, `max_verify_iters = 2`; `rollback_min_loss_gain = 1e-4`, `rollback_cooldown_steps = 12`, `rollback_patience_penalty = 0.5`; `rollback_bit_cost_weight` = `0.005` (V2/V3), `0.007` (V4), `0.008` (V5).

---

## 5. Results

### 5.1 6-Way Performance & Compression Comparison

| Metric | Classical FP32 | Adaptive V1 | Adaptive V2 | Adaptive V3 (Ep. 8 / Best Ep. 5) | Adaptive V4 (Ep. 8 / Best Ep. 7) | Adaptive V5 (Ep. 8 / Best Ep. 6) |
| --- | :---: | :---: | :---: | :---: | :---: | :---: |
| Peak Val Accuracy | **49.88%** (Ep. 4) | 46.77% (Ep. 2) | 47.81% (Ep. 5) | 47.89% (Ep. 4) | 47.95% (Ep. 2 S1) | **49.88%** (Ep. 6 EMA) |
| Final Val Accuracy (Ep. 8) | 48.31% | 44.46% | 45.80% | 46.77% | 46.10% | **49.26%** |
| Test Accuracy (`n=10,020`) | 46.85% | 45.12% | 45.87% | 46.75% / 47.95% | 46.83% / 47.24% | **48.11%** / **48.76%** |
| Test Accuracy (`ru`, `n=5,010`) | 46.19% | 44.07% | 45.37% | 45.71% / 47.09% | 45.99% / 46.45% | **46.99%** / **47.68%** |
| Test Accuracy (`en`, `n=5,010`) | 47.50% | 46.17% | 46.37% | 47.78% / 48.82% | 47.66% / 48.02% | **49.24%** / **49.84%** |
| Test Cross-Entropy Loss | 2.0297 | 1.8084 | 1.6734 | 1.1599 / **1.0561** | 1.3855 / 1.3095 | **1.1441** / 1.0790 |
| Seen-Train Probe (`n=2,000`) | 94.60% | 88.65% | 87.20% | 71.20% / 63.70% | 83.50% / 80.50% | 75.50% / 70.75% |
| Mean Linear Bit-Width | 32.00 | 15.71 | 5.82 | 8.15 | 8.57 | **3.39** |
| Linear Parameter Footprint | 28.91 MB | 14.19 MB (`2.04×`) | 5.26 MB (`5.50×`) | 7.37 MB (`3.92×`) | 7.74 MB (`3.73×`) | **3.06 MB (`9.44×`)** |
| Training Wall Time | **198.8s** | 682.1s | 646.8s | 535.2s (`46.8s`/ep S2) | 589.7s (`~46.2s`/ep S2) | 547.5s (`~48.4s`/ep S2) |
| Peak VRAM | **4,662 MB** | 5,049 MB | 5,053 MB | 5,178 MB | 5,262 MB | 5,310 MB |

### 5.2 Bit-Width Distribution & Router Telemetry (`7,578,560` Linear Parameters)

| Tier / Telemetry | Adaptive V1 | Adaptive V2 | Adaptive V3 | Adaptive V4 | Adaptive V5 |
| --- | :---: | :---: | :---: | :---: | :---: |
| `1-bit` | `16.47%` (`1,248,000`) | `33.06%` (`2,505,280`) | `28.51%` (`2,160,640`) | `24.86%` (`1,883,840`) | **`38.87%` (`2,945,920`)** |
| `2-bit` | `15.89%` (`1,204,480`) | `25.45%` (`1,928,960`) | `21.85%` (`1,655,680`) | `23.27%` (`1,763,520`) | **`31.31%` (`2,372,800`)** |
| `4-bit` | `12.46%` (`944,320`) | `17.21%` (`1,304,320`) | `16.46%` (`1,247,680`) | `16.61%` (`1,258,560`) | **`17.40%` (`1,318,720`)** |
| `8-bit` | `8.11%` (`614,400`) | `10.21%` (`774,080`) | `11.06%` (`838,080`) | `11.86%` (`898,880`) | `7.50%` (`568,320`) |
| `16-bit` | `6.15%` (`465,920`) | `6.43%` (`487,040`) | `7.44%` (`563,520`) | `7.78%` (`589,760`) | `3.10%` (`234,880`) |
| `FP32` (`32-bit`) | `40.92%` (`3,101,440`) | `7.64%` (`578,880`) | `14.69%` (`1,112,960`) | `15.62%` (`1,184,000`) | **`1.82%` (`137,920`)** |
| Net Promotions / Rollbacks | `57,250` / `0` | `28,628` / `18,305` | `36,043` / `14,090` | `37,599` / `16,859` | **`19,813` / `31,673`** |
| Block Reallocations | `10,671` | `9,966` | `6,051` | `9,617` | `8,014` |

### 5.3 Analysis
1. **Explaining V1's Dual-Jump Instability:** In V1, `48,381` promotions and `270` extra verification steps in Epoch 1 yielded an early lead (`44.58%` val vs. `43.73%` `FP32`), but `2,862` late promotions in Epochs 3–4 shifted quantization grids under `AdamW` momentum, dropping validation accuracy to `44.72%` before partial recovery in Epoch 5.
2. **Impact of Causal Rollback (V2):** V2 rejected `18,305` unjustified upgrades, dropping `FP32` occupancy to `7.64%` (`5.50×` compression, `5.82` bits) and curing V1's mid-training dip (`45.87%` test).
3. **Impact of Two-Stage Calibration (V3) & V4 Diagnosis:** Freezing weights at Epoch 4 and calibrating with `dropout = 0.15` and `label_smoothing = 0.08` gave V3 `46.75%` test accuracy at Epoch 8 (`1.1599` loss) and `47.95%` on its Epoch 5 checkpoint. V4 solved Epoch 1 cold start (`44.06%`) and hit `47.95%` validation at Epoch 2, but an 8-epoch Stage-1 schedule kept LR hot through Epoch 5 (`val_loss = 1.2095`), entered Stage 2 without restoring Epoch 2 weights, and under-regularized (`label_smoothing = 0.03`), stalling at `46.83%` Ep. 8 / `47.24%` Best.
4. **Pareto Dominance of V5:** Enforcing causal rollback inside verify iterations (`enforce_rollback_in_verify`) and requiring continuous loss improvement (`strict_loss_gain_rollback`) raised total rollbacks to `31,673`, pruning `FP32` weights down to **`1.82%`** and leaving **`87.58%`** at `1–4` bits (**`3.39` mean bits = `9.44×` compression**). Structurally, `protect_attention_and_head=True` initialized the `24` attention projections (`2,457,600` params, `32.43%`) and `head_proj` (`204,800` params, `2.70%`) at non-zero `2-bit`, `head_out` (`960` params, `0.01%`) at `4-bit`, and the `12` FFN matrices (`4,915,200` params, `64.86%`) at `1-bit`; because V5's final `1-bit` count is `2,945,920`, **`59.94%` of all FFN parameters remained at `1-bit`**. Paired with matched Stage-1 LR, best-S1 checkpoint restoration (`Epoch 3`, `49.44%` val, `0.9981` val loss), V3-strength Stage-2 regularization, and validation-checked EMA (`decay = 0.99`, outperforming raw Stage-2 weights in all 4 Stage-2 epochs: `49.70%`, `49.88%`, `49.16%`, `49.26%`), V5 achieved **`48.11%` Test Accuracy at Epoch 8** (`+1.26` pp above `FP32`) and **`48.76%` at its Epoch 6 checkpoint** (`+1.91` pp above `FP32`) across both Russian and English.

### 5.4 Independent Disjoint-Fold & Calibration Validation (`seed=123`)
To verify generalization independently of `seed=42`, [`validate_fp32_vs_v5.py`](validate_fp32_vs_v5.py) trained Classical `FP32` and `ODPE V5` on `50,000` strictly non-overlapping `facebook/xnli` training pairs (`[25k..50k]` per language) and evaluated **both** Epoch 8 and Best-Validation checkpoints symmetrically on `Test (10,020)` and an untouched **`20,000`-pair Stress Split** (`[50k..60k]`):
- **Extreme Compression Confirmed (`2.61` bits = `12.27×`):** Only **`1.25%`** of V5 linear weights reached `FP32` (`92.07%` remained at `1–4` bits: `54.69%` `1-bit`, `26.27%` `2-bit`, `11.11%` `4-bit`), cutting footprint from `28.91 MB` to **`2.36 MB`**.
- **Epoch-8 Endpoint Superiority:** V5 beat `FP32` on both `Test (10,020)` (`47.69%` vs. `47.48%`, Macro-F1 `0.4752` vs. `0.4708`) and `Stress 20k` (`46.04%` vs. `45.96%`, long-seq `44.45%` vs. `44.38%`), while cutting stress cross-entropy loss by **31%** (`1.3014` vs. `1.8998`), `10-bin ECE` by **32%** (`0.2623` vs. `0.3871`), Brier score (`0.7482` vs. `0.8766`), and wrong-prediction confidence (`69.87%` vs. `82.75%`).
- **Symmetric Best-Val Comparison:** On `Test (10,020)`, V5 (`Best@4`) virtually matched `FP32` (`Best@3`) on accuracy (`48.98%` vs. `49.14%`) while achieving higher balanced **Macro-F1** (`0.4881` vs. `0.4770`, where `FP32` class-0 F1 dropped to `0.3629`). When `FP32` stopped at its calibrated `Epoch 3` minimum (`1.0300` stress loss, `0.1018` stress ECE), `FP32 Best@3` outperformed V5 `Best@4` on `Stress 20k` (`48.76%` vs. `47.33%`) because `_val_score` in V5 selected Epoch 4 (`val_acc=47.69%`, `val_loss=1.1228`) over Epoch 3 (`val_acc=47.37%`, `val_loss=1.0334`) due to higher raw `val_acc` despite rising `val_loss`.

---

### 5.5 Systematic 10M Refinements: `Adaptive V5.1 → V5.8`
To resolve the V5 checkpoint-selection and calibration limitations before scaling up, [`adaptive_v5_series.py`](adaptive_v5_series.py) evaluated eight calibrated iterations on the `seed=42` `50k` XNLI split with symmetric `20,000`-pair out-of-sample stress testing:
- **V5.3–V5.5 (Cost Shaping, Learnable Tier Scales, Salience Pruning, EMA Self-Distillation):** Differentiating verify costs by tier (`attn=0.35`, `head=0.25`, `ffn=1.15`), learning per-tier LSQ scales (`log_tier_scales`), clipping STE gradients cleanly, and consolidating low-salience neurons (`consolidate_down`) compressed `10.85M` models to `2.10–2.24` bits (`14.29×–15.21×`) while raising Test BestVal to `50.10%` and Stress BestVal to `49.36%`.
- **V5.6 (`Group64 + RMSNorm + RoPE + QK-Norm + SwiGLU`, `10.67M`):** Switching to `group_size=64` scaling and modern quantization-friendly transformer blocks jumped Test BestVal by `+2.38` pp to **`52.48%`** (`51.14%` Stress BestVal), but left Attention at `5.94b` (`3.22b` total) and raised late-epoch ECE (`0.0887/0.1017`).
- **V5.7 (`BitNet 1.58-bit Ternary + Cosine Curriculum + 2-Batch Verify`):** Introducing the `1.585-bit` (`log2(3)`) ternary rung `(1.0 → 1.585 → 2 → 4 → 8 → 16 → 32)`, starting attention at `1.585b` (`attn_cost=0.65`), scheduling verify cost via cosine curriculum, and evaluating rollbacks on 2 micro-batches reached **`53.14%` Test BestVal** and **`51.67%` Stress BestVal** at **`2.58` bits (`12.41×`)**.
- **V5.8 (`8b/16b` Ceiling + Stage-2 `SAM` + Asymmetric Embedding Reg + S1 Label Smoothing):** Capping backbone layers at `8-bit` (head at `16-bit`), perturbing weights via Sharpness-Aware Minimization (`rho=0.035`) around quantization thresholds during Stage 2, damping embedding memorization (`lr×0.35`, `wd=0.08`), and smoothing Stage-1 labels (`0.05`) achieved **`1.94` mean weight bits (`16.48×`, `1.73 MB` vs `28.44 MB`; `2.19b / 14.60×` including g64 scales)** with `0%` FP32 weights, **`52.04%` Stress Ep. 8** (`+5.68` pp above FP32 Ep. 8 `46.36%`), `52.99%` Test BestVal, and `0.0522/0.0568` BestVal ECE.

### 5.6 Scaling to 100M Parameters (`200k` Multi-Source NLI: `FP32` vs. `V5` vs. `V6`)
Scaling raw `Adaptive V5` from `10M` to `100.5M` initially suffered from row-width dilution across `d_ff=3424`, stalling at `1.38b` (`48.89%` test vs. `50.34%` FP32). Applying the complete **`V5.8`** technology stack onto **`Adaptive V6 100M` (`99.17M` params, `d_model=768`, `n_layers=12`, `n_heads=12`, `d_ff=2240`, `sam_interval=3`)** across `200,000` multi-source NLI pairs cleanly inverted this gap:

| Metric (`100M`, `200k` Multi-Source, `4` Epochs) | Classical FP32 (`100.51M`) | Adaptive V5 (`100.51M`) | **Adaptive V6 (`99.17M`, V5.8 Stack)** |
| --- | :---: | :---: | :---: |
| Mean Weight Bit-Width / Memory | `32.00b` / `353.26 MB` (`1.00×`) | `1.38b` / `15.29 MB` (`23.11×`) | **`1.23b` / `13.38 MB` (`26.07×`)** (`1.48b / 21.66×` w/ g64 scales) |
| Peak Validation (`4,980`) | `50.20%` (Ep. 3) | `48.43%` (Ep. 3) | **`53.41%`** (Ep. 3, `val_loss=0.9419`) |
| Test (`10,020`, `Final / BestVal`) | `50.34% / 49.70%` | `48.38% / 48.89%` | **`52.10% / 52.61%`** (`+2.91` pp BestVal) |
| Unseen Stress `20,000` (`Final / BestVal`) | `50.39% / 50.31%` | `50.83% / 50.03%` | **`54.51% / 54.22%`** (`+4.12` pp Ep. 4) |
| Macro-F1 (`Test Best / Stress Final`) | `0.4858 / 0.5054` | `0.4755 / 0.5096` | **`0.5224 / 0.5444`** |
| `10-bin ECE` (`Test Ep. 4 / BestVal`) | `0.0278 / 0.0216` | `0.0372 / 0.0243` | **`0.0173 / 0.0116`** |

Crucially, `Adaptive V6` allocated `92.31%` of Attention and `92.40%` of Head parameters to `1.585-bit` ternary (`1.67b` and `1.69b` averages) and `98.16%` of SwiGLU FFN parameters to `1.0-bit` (`1.02b` average) with **zero parameters in `16-bit` or `FP32`**, packing cleanly into a **`31.30 MB`** standalone `.safetensors` checkpoint (`pack_quantized_state_dict`) with exact accuracy parity (`52.61%` Test / `53.43%` Val).

---

## 6. Limitations & Future Work

1. **Emulated Mixed-Precision Training Speed vs. Native Kernels:** Although Stage 2 inference unpacks seamlessly (`prequantized=True`) into zero-overhead linear calls and fused block concatenation reduces GEMM passes during Stage 1, custom CUDA/Triton sub-byte ternary/binary kernels are needed to realize native wall-clock speedups proportional to `26.07×` bit compression.
2. **Pretraining Scale:** While `Adaptive V6` establishes strong scaling from `10M/50k` to `100M/200k` scratch NLI, evaluating ODPE `V5.8/V6` on billion-parameter (`1B–2B`) causal language modeling over trillion-token corpora remains an important next milestone.