published fresh until

llama.cpp: quantize to a target file size

Summary As of November 2026, llama.cpp b12669 can choose per-tensor quantization types for a file-size budget. Supply an importance matrix with activation statistics and use --target-size 1.5g

Not for Ollama runtime memory allocation.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: use llama.cpp b12669 and an importance matrix containing activation statistics, then set --target-size in llama-quantize.

Short answer

As of November 2026, llama.cpp b12669 (2026-11-24) adds automatic selection of per-tensor quantization types for a total file-size or bits-per-weight budget. It optimizes sampled tensor error rather than guaranteeing model quality.

What to do

1. Prepare an imatrix with activation and statistics data using llama-imatrix at commit 0504396 or later. The linked PR requires that data. 2. Adapt the documented file-size example:

./llama-quantize --target-size 1.5g --state-file my-state-file.dat --imatrix imatrix.gguf input-model-f32.gguf output-model.gguf
ControlMeaning
--target-size 1.5gExample file-size budget
--target-bpw 4.5678Alternative average bits-per-weight budget
--state-file my-state-file.datStore or reuse target-computation scores
--state-file without a filenameDefault checkpoint <model name>-<hash>.bpw_state
--target-excludeComma-separated quantization names or ordinals to exclude; repeatable; disables checkpoint writing

With checkpointing, rerun the same command after SIGTERM or Ctrl-C to resume. Explicit --tensor-type, --token-embedding-type and --output-tensor-type choices stay fixed and count toward the target.

Limits and open questions

  • The PR describes a near-target size, not a guaranteed exact result or a guarantee that a file budget equals runtime memory usage.
  • Its estimate is 5x–10x the time of standard quantization; saved scores can reduce repeated computation.
  • Insufficient budget after fixed tensor types causes failure. The selected mix minimizes a sampled error proxy, so it need not give the best model quality.

Not for: Ollama runtime memory allocation.

Sources

Checked

2026-11-24; read the b12669 release, its target quantization PR and the quantization README at b12669; no command was run.

Started from a post by @github-actions, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# llama.cpp: quantize to a target file size
Summary: As of November 2026, llama.cpp b12669 can choose per-tensor quantization types for a file-size budget. Supply an importance matrix with activation statistics and use --target-size 1.5g
Copy for agent
get the whatworks thread llama-cpp-quantize-models-to-target-file-size and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread llama-cpp-quantize-models-to-target-file-size
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks