Skip to main content
Back

LookAtMyQuant Squeezes a 27B Model Into 7.2 GB While Matching the Original

A new quantization compiler squeezes 27B models into 7.2 GB and fits a capable 4B model onto an iPhone, with KL divergence 12x lower than Q4_K_M at matched file size.

Pro

  • New quantization compiler LookAtMyQuant hits 12x lower KL than Q4_K_M at matched size
  • Qwen3.8-27B in 7.2 GB matches the full model on 540-problem math benchmark
  • Inkling-2-Mini sweep spans 3.85 GB to 12.76 GB, including 8 GB iPhone-sized build
  • 12.76 GB Inkling build matches BF16 teacher on 349/349 pooled benchmark problems
  • Apple Silicon MLX runtime with 4-bit DSpark drafter hits 112 tok/s on M5 Max
  • Full recipe runs for about $34 of GPU time on Modal, MIT licensed

LookAtMyQuant has released an open-source model-compression compiler, an MLX runtime, and packed checkpoints for Apple Silicon. The project reports a 1.23 GB Qwen3.5-4B build and a 7.2 GB Qwen3.8-27B build while retaining strong results on math, coding, and knowledge benchmarks.

Smaller weight files reduce storage, download time, and the memory required for local inference. Runtime memory also includes the key-value cache, temporary buffers, and the inference engine, so a 7.2 GB checkpoint still needs more than 7.2 GB of available memory.

On Gemma 4 E2B, the project reports 12 times lower KL divergence than llama.cpp’s Q4_K_M at the same file size. Q4_K_M is a widely used 4-bit-class format. KL divergence measures how far the compressed model’s next-token probability distribution moves from the original distribution, with lower values indicating a closer match. It captures distribution fidelity, although benchmark testing remains necessary for task-level quality.

A compiler with a byte budget

The project calls itself a compiler because it searches for a compression plan under a fixed size budget. It estimates each row’s sensitivity using Fisher information, assigns more bits to rows whose errors would affect outputs most, and applies trellis codes that select weight representations jointly along each row. Learned e-means codebooks represent values with small symbol sets ranging from 1 to 4 bits.

The version 2 recipe calibrates the model on its own worked math solutions and gives digit tokens 10 times the normal weight. It then runs 4,000 distillation steps, using the original model as the teacher. Each layer is quantized once from the original weights, which avoids repeatedly compressing already modified values. The author reports a total compute cost of about $34 on Modal, subject to hardware choice and cloud pricing.

From 1.23 GB to teacher parity

The published results cover exact-answer math, HumanEval code generation, MMLU multiple-choice knowledge, and GSM8K grade-school word problems. All figures below come from the project’s evaluation harness.

Release Size Reported results
Qwen3.5-4B 1.23 GB
2.3 bits per weight
  • 330 of 540 problems on the project’s exact-answer math suite
  • Bonsai 2 Ternary 4B: 328 at 1.20 GB
  • Original model: 359
  • Held-out-text KL: 0.45 nats, compared with 0.59 for Bonsai
Qwen3.8-27B 7.2 GB
2.1 bits per weight
  • 401 of 540 math problems, matching the original model
  • Unsloth UD-IQ2_XXS at the same size: 348
  • HumanEval: 73.8% versus 67.1%
  • MMLU: 78.8% versus 75.0%
  • GSM8K: 94.5% versus 92.7%
Inkling-2-Mini Six builds from 3.85 GB to 12.76 GB Targets range from 8 GB phones to benchmark parity with the uncompressed BF16 teacher.

The 12.76 GB Inkling-2-Mini build matches the BF16 teacher’s published score on every tested benchmark, with the same 349-of-349 pooled result, while using 32.5% less memory for text weights. That “parity” describes this benchmark suite; it does not establish identical behavior on other prompts.

The 4.72 GB build is designed to keep the process below a reported 12 GB iOS jetsam ceiling, where the operating system may terminate memory-heavy applications. At 1.45 bits per weight, it scores 94.0% on the project’s 200-question GSM8K set, or 188 correct answers, and 68.9% on strict HumanEval, or 113 of 164 tasks. The project reports 97.4% retention of the teacher’s GSM8K score and a 90.6% mean retention across three tasks.

Inside the sub-2-bit recipe

Sub-ternary compression means the average storage falls below 2 bits per weight, although sensitive buckets may use higher-precision formats. The author reports that a static post-training baseline at 1.18 bits per weight scores 1.0% on GSM8K and 1.8% on HumanEval. LookAtMyQuant combines several mechanisms to preserve more capability at that density:

  • Hashed trellis codes: 4 KB SRAM block-vector codes, labeled ht2 and ht3, plus row-level trellis codes represent sequences of weights jointly.
  • Fisher-guided outliers: sensitivity estimates allocate additional capacity within 128-row groups.
  • Precision floors: attention projections and the final lm_head bucket receive minimum bit allocations.
  • NVFP4 passthrough: larger builds preserve the most sensitive expert buckets in their native 4-bit floating-point format.
  • On-policy distillation: two DAgger passes train on prefixes generated by the compressed student, followed by hundreds of optimization steps against exact targets.

The smallest 3.85 GB Inkling build reaches 89.5% on GSM8K and 59.1% on strict HumanEval. Its reported decode peak is 4.57 GiB, which the project targets at devices with 8 GB of memory.

M5 Max: 2,016 tok/s prefill

The bundled lamq runtime uses Apple’s MLX framework, custom Metal kernels for mixed NVFP4 and trellis-coded experts, FlashAttention-2 scaled dot-product attention, and speculative decoding. Speculative decoding lets a small drafter propose several tokens, which the main model then verifies before accepting them.

Build Prefill Serial decode Drafted decode
12.8 GB 2,016 tokens/s at a 512-token prompt 60.5 tokens/s 112.7 tokens/s median
5.4 GB Not reported Not reported 124.4 tokens/s median

A separate M5 Max test used 30 held-out prompts and generated up to 256 tokens per prompt. The drafter doubled throughput from 88 to 176 tokens per second. Its 4-bit checkpoint occupies 464 MB in addition to the main model. These figures depend on prompt length, generation settings, thermal conditions, and hardware configuration.

Run it with MLX or llama.cpp

Apple Silicon users can install the repository directly and run generation, chat, or speculative decoding against the packed Hugging Face checkpoints:

pip install git+https://github.com/ShinMegamiBoson/lookatmyquant.git
lamq generate shinmegamiboson/Qwen3.8-27B-LookAtMyQuant-7.2GB \
    --drafter shinmegamiboson/Qwen3.8-27B-LookAtMyQuant-7.2GB-drafter \
    -p "Write a Python function that merges overlapping intervals." --stats

For Python applications, runtime_mlx.load returns a model and tokenizer compatible with mlx_lm.generate and mlx_lm.stream_generate. A higher-level Runtime class provides streaming and speculative decoding through one interface.

The repository also includes gguf_compiler.py, which creates compression plans using tensor types supported by llama.cpp. That path lets developers run generated GGUF artifacts through the existing llama.cpp ecosystem.

Useful artifacts, incomplete reproduction

The MIT-licensed repository includes the compiler, packed releases, compression plans, and e-means codebooks. These artifacts support local inference experiments, comparisons with Q2 and Q4 GGUF files, and research into quantization below 3 bits per weight. The six-size Inkling sweep also provides several operating points for studying memory and quality trade-offs.

All benchmark and throughput results are self-reported by the project’s sole author. Dense weights for LookAtMyQuant 2, per-problem result files, and the 16-bit drafter remain unpublished, which prevents exact reproduction of the full distillation process and reported evaluations. The math-focused calibration set and 10-times digit weighting may also favor numerical tasks, so deployment decisions require tests on the intended prompts, context lengths, and sampling settings.