CHALICE: Hardware-Legal FP4 Quantization & Scale Optimization

CHALICE (arXiv:2612.04850) fixes a fundamental flaw in block-decoupled FP4 post-training quantization: diagonal Hessian blocks capture just 0.68% of normalized off-diagonal coupling energy while cross-region interactions hold 99.32%. By profiling deployable E4M3/UE8M0/FP32 scales in closed form and scoring exact O(|S|^2) moves, CHALICE avoids 26.1% code-drift rewrites.
CHALICE: Hardware-Legal FP4 Quantization & Scale Optimization: CHALICE (arXiv:2612.04850) fixes a fundamental flaw in block-decoupled FP4 post-training quantization: diagonal Hessian blocks capture just 0.68% of normalized off-diagonal coupling energy while cross-region interactions hold 99.32%. By profiling deployable E4M3/UE8M0/FP32 scales in closed form and scoring exact O(|S|^2) moves, CHALICE avoids 26.1% code-drift rewrites. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- Captures 99.32% Cross-Region Hessian Energy: Standard within-block FP4 quantizers observe only 0.68% of normalized off-diagonal Hessian coupling.
- Closed-Form Global Multiplier Profiling: Evaluates deployable global scale brackets in O(1) incremental updates without alternating optimization rounds.
- Exact O(|S|^2) Incremental Verification: Scores candidate FP4 code/scale moves against raw un-damped Hessian rows, preventing the 26.1% code rewrite caused by post-hoc error feedback.
- Hardware-Legal NVFP4 & MXFP4 Alphabets: Directly constrains E2M1 codes plus E4M3 (16-element NVFP4) or UE8M0 (32-element MXFP4) group scales without continuous rounding loss.
import { createAgent } from '@smoke-monkey/harness';// Automate hardware-legal NVFP4/MXFP4 weight calibration and perplexity verificationconst agent = createAgent({agentId: 'chalice-fp4-quantizer',provider: 'openai-compatible',baseUrl: 'http://127.0.0.1:8000/v1',model: 'Qwen/Qwen3-32B',workspacePath: process.cwd(),mcpServers: {quantLab: {command: 'npx',args: ['-y', '@smoke-monkey/mcp-quant-eval', '--format', 'nvfp4'],env: {CHALICE_GROUP_SIZE: '16',CHALICE_SCALE_FORMAT: 'E4M3',CHALICE_VERIFY_HESSIAN: 'raw',},},},permissions: {read_file: 'allow',write_file: 'allow',run_command: 'ask',},});async function main() {const result = await agent.run('Quantize target MLP gate/up projections to NVFP4 with CHALICE scale profiling and log WikiText-2 PPL.');console.log('Quantization Complete:', result.summary);}main().catch(console.error);
Watch: Related Video Guides
Training models with only 4 bits | Fully-Quantized Training
What Is NVFP4? Faster LLM Inference Without Losing Quality
Why Block-Decoupled FP4 Quantizers Lose 99.32% of Hessian Coupling
CHALICE (arXiv:2612.04850) is a hardware-legal code and scale optimization algorithm for 4-bit floating-point formats such as NVFP4 (16-element blocks, E4M3 group scales) and MXFP4 (32-element blocks, UE8M0 power-of-two scales). Instead of optimizing continuous scales and rounding afterward, CHALICE evaluates every move under its exact conditionally optimal legal multiplier.
Empirical analysis of normalized Hessian matrices C_ij = H_ij / sqrt(H_ii * H_jj) reveals why block-decoupled FP4 search fails: main-diagonal blocks contain only 0.68% of off-diagonal energy, leaving 99.32% in cross-region interactions. Worse, standard sequential error feedback rewrites 26.1% of codes after scale selection—causing 494 of 576 cells in block-decoupled exhaustive baselines to degrade.
| FP4 Format | Group Size | Group Scale Alphabet | Global Multiplier | CHALICE Optimization Advantage |
|---|---|---|---|---|
| NVFP4 (NVIDIA Blackwell) | 16 elements | E4M3 | FP32 tensor scale | Closed-form 2-candidate bracket around N / D |
| MXFP4 (OCP Microscaling) | 32 elements | UE8M0 (powers of 2) | Optional / shared | Exact discrete scale comparison without rounding drift |
| Standard Block-Decoupled | 16 or 32 | Continuous → rounded | Fixed during search | Misses 99.32% cross-region Hessian coupling |
Closed-Form Scale Profiling and O(|S|^2) Move Verification
CHALICE tracks N = <R_raw, V>_F and D = <V H_raw, V>_F, where V = sum_g delta_g Q_bar_g. By Corollary 1, the conditionally optimal deployable global scale is strictly one of the two stored alphabet values bracketing alpha_bar = N / D, turning global scale updates into an O(1) incremental check. Candidate moves supported on index set S are then scored exactly via Delta F = 2 <d, v_i> + d H_raw d^T.
# Simulate NVFP4 E2M1 grid + E4M3 group scale quantization error profiling in Python
python3 - << 'EOF'
import math
e2m1_pos = [0.0, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0]
e2m1_all = sorted([-x for x in e2m1_pos if x > 0] + e2m1_pos)
print("Hardware-legal E2M1 values (15 unique levels):", e2m1_all)
print("Off-diagonal Hessian energy inside single block: 0.68% | Cross-region: 99.32%")
EOFRevisit Scales and Codes Jointly After Legalization
Never freeze FP4 scales after a single pass. Because error feedback modifies roughly 26.1% of weight codes, always run joint code-and-scale refinement under the undamped raw Hessian verifier.
Frequently Asked Questions
Q:What hardware FP4 formats does CHALICE support?
CHALICE targets hardware-legal 4-bit floating-point specifications including NVIDIA NVFP4 (16-element groups with E4M3 scales) and OCP MXFP4 (32-element groups with UE8M0 power-of-two scales).
Q:Why does within-block Hessian scoring fail on FP4 weights?
Measurements in the CHALICE paper show that main-diagonal blocks hold only 0.68% of normalized off-diagonal Hessian energy, while 99.32% resides across different scale regions.
Q:How does CHALICE optimize the global tensor multiplier without slow loops?
Using N = <R_raw, V>_F and D = <V H_raw, V>_F, Corollary 1 proves the optimal legal global scale is one of at most two adjacent deployable values bracketing N/D, enabling O(1) incremental scoring.
Q:What causes code drift during FP4 quantization?
Sequential error feedback rewrites roughly 26.1% of codes after initial rounding, invalidating earlier scale choices unless codes and scales are jointly revisited.
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.