Phi-lattice 4-bit packed archive of unsloth/gemma-3-270m-it, rebuilt with GPTQ error feedback.
Same container format and size as gemma-3-270m-it-phi-lattice-v2 (371.0 MiB), but the lattice assignment is now optimized column-wise against calibration activations (GPTQ-style error feedback weighted by the inverse-Hessian Cholesky).
PyTorch only. This release intentionally ships no GGUF — load it with phi_loader.py (see below).
| Archive | SQNR | PPL | Size |
|---|---|---|---|
| FP32 reference | — | 90.8 | 1.07 GB |
| v2 (plain lattice) | 19.48 dB | 161.5 | 371.0 MiB |
| v2-GPTQ (this repo) | 16.17 dB | 139.85 | 371.0 MiB |
| Q4_K_M (llama.cpp standard, reference) | 26.80 dB | 99.3 | 0.25 GB |
Honest reading:
provenance.json).docs/Q4KM_VS_PHI_LATTICE.md).import importlib.util, torch
from transformers import AutoTokenizer
spec = importlib.util.spec_from_file_location("phi_loader", "phi_loader.py")
loader = importlib.util.module_from_spec(spec); spec.loader.exec_module(loader)
model = loader.load_gemma3_from_packed_4bit(mode="unrolled_bf16", device="cpu")
# or: mode="low_vram_4bit" (~2.6 GB footprint on the 4B sibling), mode="triton_4bit" on CUDA
tok = AutoTokenizer.from_pretrained(".", use_safetensors=False)
ids = tok.apply_chat_template([{"role": "user", "content": "Hello!"}],
tokenize=True, add_generation_prompt=True, return_tensors="pt")
print(tok.decode(model.generate(ids, max_new_tokens=64)[0]))
phi_loader.py in this repo is pre-wired to this archive
(DEFAULT_ARCHIVE_FILENAME = "gemma3_270m_phi_gptq_v2_packed_4bit.pt").
provenance.json records the archive SHA-256 (767bf5acb6ab8825…), the quantizer
(PhiLatticeQuantizer + GPTQ, damp 1e-2) and the calibration setup. The archive
unpacks onto the 15-level golden-ratio ladder — verify with any loader that
checks codebook[idx] * scales reconstruction.
evals/); broader lm-eval pending.