Views
No views yet
escham_reconstruct
codebook lattice used by EschaLabs' 2-bit AQLM+Hadamard quantized checkpoint
EschaLabs/Qwen3.6-35B-A3B-Escha-W2.gate_up_proj (K=2) and
down_proj (K=3) projections as (in/16, out/16, 16·K) int16 codes plus per-row
and per-column scales. Decoding those codes into a dense fp16 weight matrix
requires two fixed codebook tables that ship inside the CUDA .so rather
than in the safetensors — they were previously inaccessible outside a Linux
GPU environment running the reference escha wheel.| File | Size | Description |
|---|---|---|
compact.pkl | 120 MB | The extracted codebook in sparse-compact form (fp16). See "Format" below. |
OP_SIGNATURE_AUDIT.md | 15 KB | Full Modal-side introspection of escha._C — every operator, its schema, and the linearity / (bi, bj)-invariance proofs. |
LAYOUT_NOTES.md | 5 KB | Notes on the structural regularities of the k_slot layout, the residual "baseline" question, and known limitations. |
modal_op_audit.py | 12 KB | Reproducible Modal script (~1 min A10G) that produces the audit report. |
modal_smart_probe.py | 11 KB | Reproducible Modal script (~2 min A10G) that produces compact.pkl. |
1import pickle
2d = pickle.load(open("compact.pkl", "rb"))
3# For each K in {2, 3}:
4for K in (2, 3):
5 positions = d[f"K{K}_positions"] # list of (n_nz, 2) int8 (row, col) positions
6 values = d[f"K{K}_values"] # list of (65536, n_nz) fp16 codebook values
7 # Reconstruct dense (k_max, 65536, 16, 16) fp16:
8 import numpy as np
9 k_max = len(positions)
10 dense = np.zeros((k_max, 65536, 16, 16), dtype=np.float16)
11 for k, (pos, val) in enumerate(zip(positions, values)):
12 for i, (r, c) in enumerate(pos):
13 dense[k, :, r, c] = val[:, i]1# code: int16 (in_f/16, out_f/16, 16*K)
2in_f = 2048 # or 512 for down_proj
3out_f = 1024 # or 2048 for down_proj
4K = 2 # or 3 for down_proj
5w = np.zeros((in_f, out_f), dtype=np.float32)
6bi_max, bj_max = in_f // 16, out_f // 16
7for k in range(16 * K):
8 idx = code[:, :, k].astype(np.int32) & 0xFFFF # int16 -> uint16
9 blocks = dense[k, idx] # (bi_max, bj_max, 16, 16)
10 w += blocks.transpose(0, 2, 1, 3).reshape(in_f, out_f)op(all-zeros code)) and
could not be extracted in this session — the Modal workspace hit its spend
limit after the codebook extraction completed. See LAYOUT_NOTES.md for
the 30-second follow-up probe that would resolve it.escham_reconstruct entirely (pre-
dequantized to fp16 on Modal, no runtime decode needed), see
KaedeTai/Qwen3.6-35B-A3B-Escha-W2-MLX.op(A+B) - op(0) = (op(A) - op(0)) + (op(B) - op(0))
holds exactly for up to 100 random slot activations.escham_reconstruct(Tensor packed, int in_f, int out_f, int K, bool cbA, bool mul1) -> Tensor — one default overload, accepts
leading batch dims on packed.EschaLabs/escha-runtime-qwen3moe wheel on
Hugging Face (public):1modal run modal_op_audit.py # ~1 min A10G, produces OP_SIGNATURE_AUDIT.md
2modal run modal_smart_probe.py # ~2 min A10G, produces compact.pkl