Fit more model into your hardware. Keep more of what makes it useful.
MagicQuant is an open-source, benchmark-driven mixed-precision GGUF discovery engine for llama.cpp. Instead of accepting the precision assignments of a stock quantization as the final answer, it learns from existing recipes, tests which parts of a model tolerate compression, and discovers new combinations worth keeping.
The goal is simple: get the best measured fidelity you can for the storage you're willing to spend. MagicQuant builds and benchmarks real models, not just theoretical bit allocations. It exports a curated set of GGUFs, measurements and reusable tensor recipes so you can choose the trade-off that fits your hardware.
- Better trade-offs: a historical 4B hybrid achieved 32.6% lower measured divergence for just 5.5% more storage than a smaller external-derived recipe (worked example).
- Protect what matters: a packed NVFP4 research model was reduced by approximately 40% while retaining every protected encoded payload (results below).
- Reuse the work: an entire ten-recipe 35B release was cloned onto a related fine-tune and benchmarked against its own weights (published example).
Download models on Hugging Face · See measured results · Install MagicQuant · Read the plain-English guide · Explore the research
A model is not equally sensitive to compression everywhere. Two GGUFs with a similar size can behave very differently depending on which tensors retain precision. Why settle for a single named recipe when a better combination might exist?
| What you want | What MagicQuant does |
|---|---|
| More fidelity at a similar size | Discovers hybrids by combining measured strengths of compatible tensor recipes. |
| Fit a tighter storage budget | Measures actual file sizes and fidelity across useful compression levels. |
| Make use of expert quantizations | Learns actual tensor assignments from llama.cpp and compatible external GGUFs, including Unsloth recipes. |
| Preserve a carefully optimized representation | Opt in to exact tensor freezing for supported prepared GGUFs, while still optimizing eligible tensors in partially frozen groups. |
| Target an aggressive compression region | Choose a discovery anchor and independently configure the maximum ordinary candidate bit family. |
| Quantize a related fine-tune | Clone a published tensor recipe set onto compatible source weights and benchmark the results locally. |
| Understand and reproduce the result | Export model cards, measured outcomes, exact maps and manifests; reuse compatible measurement evidence. |
MagicQuant is not another inference runtime or a guarantee that every model can be made smaller without a loss of capability. It is a tool for discovering, measuring and sharing better numerical trade-offs on the models and toolchains it supports.
The Qwen3.6-35B-A3B release contains eight MagicQuant hybrids and two baseline recipes. Selected measured options:
| Recipe | File size (GB) | KLD ↓ |
|---|---|---|
| llama.cpp Q8_0 | 36.90 | 0.004654 |
| MQ-Q6_K_1 | 31.59 | 0.005149 |
| MQ-Q5_K_1 | 29.19 | 0.005523 |
| MQ-Q4_K_M_1 | 24.82 | 0.007799 |
| MQ-IQ3_M_1 | 17.60 | 0.026330 |
| Unsloth-derived IQ3_S | 13.68 | 0.068376 |
The 29.19 GB hybrid is about 21% smaller than the Q8 baseline on this campaign, with a measured increase in divergence. The full release includes choices down to 9.59 GB. Complete measured table and pinned evidence.
In a controlled Qwen3-1.7B NVFP4 campaign, MagicQuant's exact-map research preserved all 701 untouched tensor payloads, including 588 packed NVFP4 weights and associated scales, while changing only embeddings and the output head.
| Candidate | File size (GB) | KLD to packed source ↓ |
|---|---|---|
| Original packed source | 2.044 | 0 |
| Q8 embedding / Q8 head | 1.460 | 0.002389 |
| Q4_K embedding / Q6_K head | 1.229 | 0.005499 |
| IQ4_XS embedding / Q5_K head | 1.178 | 0.008382 |
The 1.229 GB candidate saves approximately 40% of the original packed file without changing any of those protected payloads. These are recorded research candidates, not a claim that the automatic pipeline selected every point or that the original runtime's activation behavior is identical. Method and independent confirmation.
The LFM3-1.7B study evaluated 36 unique artifacts on a frozen panel. Under a 900 MB ceiling, an 877 MB research candidate was the best measured General-domain option in the tested set. Under 1,000 MB a reconstructed external recipe won; at other ceilings MagicQuant hybrids or stock baselines won. That is the point: let the evidence decide, even when a stock or external recipe is the strongest choice. Complete size-ceiling table and domain results.
For more published examples, including a 14.98 GB specialized MXFP4 adaptation and cloning ten recipes onto a related fine-tune, see the model showcase.
All figures are existing campaign measurements, not new benchmarks for this README. Sizes are decimal GB/MB; KLD measures output-distribution divergence from a particular reference (lower is closer), not task accuracy. Compare scores only under compatible reference and evaluation conditions. Validate practical quality and actual runtime memory on your workload.
- Learn. Read the real tensor assignments inside stock and optional external quantizations, grouping them according to the model architecture.
- Measure. Test isolated changes and learn which assignments offer useful size/fidelity trades in the selected discovery context.
- Predict. Prioritize promising combinations instead of exhaustively building every possible model. Bounded contextual and rescue mechanisms can explore missed opportunities.
- Validate. Build actual GGUFs and benchmark them. Keep useful measured trade-offs, including improvements between conventional quantization sizes.
- Share. Export a curated release with model cards, measurements and tensor manifests that others can reuse.
Predictions guide the search. Measured results decide what survives. A release can include stock baselines, external-derived recipes and MagicQuant hybrids. Understand the workflow in plain English.
Linux is the tested campaign platform. Windows has automated build, regression and packaged CLI checks; full Windows campaigns have not been validated. Support depends on the model, tensor-group mappings and installed llama.cpp toolchain.
Install the .NET 10 SDK, then:
dotnet tool install --global MagicQuant
magicquant --version
magicquant init-config --output config.yamlEdit the generated profile for your model, architecture and storage. For example:
paths:
model_dir: /data/models/my-model
scratch_roots:
- /mnt/nvme-a/magicquant-scratch
- /mnt/nvme-b/magicquant-scratch
identity:
architecture_family_name: my-model-family
output:
output_dir: /data/exports/my-model-MagicQuant
output_name_prefix: MyModel
learning:
confirm_tensor_group_profile: truePrepare the native toolchain, validate the local configuration and launch discovery:
magicquant initialize-llama-cpp
magicquant pipeline --config ./config.yaml --check-config --strict-config
magicquant pipeline --config ./config.yamlInitialization may download/build llama.cpp and install Python dependencies. Use dedicated scratch space; discovery involves repeated large writes and real inference benchmarks. MagicQuant measures GPU execution topologies and reuses compatible evidence to avoid unnecessary work. Read the setup guide, configuration guide and hardware and storage best practices.
Update with dotnet tool update --global MagicQuant. Pin a package version with --version X.Y.Z for reproducible campaigns. The README describes the current main branch; check your installed version before using newer options.
Use the full pipeline when you want to learn a model's own trade-offs. Standard llama.cpp recipes are available as starting points; optional compatible external recipes (Unsloth is the maintainer's recommended starting point) broaden the search. Commands · External-provider example.
Reuse a published manifest rather than repeating full discovery. Configure the target model and run:
magicquant clone-repository-quants \
--config ./clone.yaml \
--source-repo magiccodingman/Qwen3.6-35B-A3B-MagicQuant-GGUFCloning transfers tensor assignments, not numerical weights or proof of optimality. It builds and benchmarks the target model locally. Publishing and cloning guide.
On supported prepared GGUF inputs, freeze original formats while eligible members of the same tensor group remain discoverable. The configured protected payloads must match exactly, including recognized companion scales and options.
source:
gguf_path: /path/to/prepared-model.gguf
freeze_formats: [NVFP4, MXFP4]
discovery:
anchor_baseline: Q4_K_M
candidate_max_bit_range: 6These are independent opt-ins; the normal model directory and architecture configuration are still required. Q8 remains the default discovery anchor. A family ceiling limits nominal recipes, not every tensor's actual type. The prepared source remains the production evaluation reference. Arbitrary native-map anchors, independent primary optimization references and mixed-source weight transplantation are not supported production workflows in this version. Prepared-source and anchor configuration.
| I want to… | Start here |
|---|---|
| Understand MagicQuant without reading research papers | Plain-English guide |
| Download a model or see measured comparisons | Hugging Face collection · Model showcase |
| Run, configure or publish my own quantizations | Application guides |
| Understand prediction, selection and evidence | Technical and research wiki |
| Inspect exact experiments, failures and limitations | Research campaigns and ledger |
| Extend the engine | Architecture · Contributor guide |
I build and maintain MagicQuant on the side, for free. Developing it and experimenting with quantizations has put a frankly ridiculous amount of terabytes written (TBW) on my drives! My Hugging Face storage is also creeping toward its cap, so there will eventually be more storage to fund. If this project helps you, supporting the work helps with those costs. Anything helps and is always appreciated. ❤️
MagicQuant is open source under GNU AGPL version 3 only (AGPL-3.0-only). Commercial use is permitted subject to its terms; distribution and remote interaction with modified versions carry source-availability obligations. See the license.
Model weights, generated GGUFs, datasets, and external dependencies retain their applicable licenses. See third-party notices.