Local & Offline
~8 min readUpdated: December 2026

CHALICE: Hardware-Legal FP4 Quantization & Scale Optimization

CHALICE hardware-legal NVFP4 and MXFP4 quantization kernels in Smoke Monkey

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.

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

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.

Key Architectural Takeaways
Quick Implementation Examplechalice-fp4-quant-agent.ts
chalice-fp4-quant-agent.tstypescript
import { createAgent } from '@smoke-monkey/harness';
// Automate hardware-legal NVFP4/MXFP4 weight calibration and perplexity verification
const 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);
Video Guides

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 FormatGroup SizeGroup Scale AlphabetGlobal MultiplierCHALICE Optimization Advantage
NVFP4 (NVIDIA Blackwell)16 elementsE4M3FP32 tensor scaleClosed-form 2-candidate bracket around N / D
MXFP4 (OCP Microscaling)32 elementsUE8M0 (powers of 2)Optional / sharedExact discrete scale comparison without rounding drift
Standard Block-Decoupled16 or 32Continuous → roundedFixed during searchMisses 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.

bash
# 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%")
EOF

Revisit 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.

Google Search Questions & Answers

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 guides

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness