add-llm-example
Skill2.7k starsChanged 13 days agoApache-2.0View on GitHub
Add a new LLM quantization example under examples/pytorch/llm (quantize.py, run_quant.sh, run_benchmark.sh, README). Use when onboarding a new model family such as Qwen, DeepSeek, Llama, MiniMax, Kimi or GLM, or when an existing example's scripts need to follow the shared CLI conventions.
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Every example under examples/pytorch/llm/<model>/ exposes the same CLI so that users and CI can drive any model the same way.
- Very specific: line 22
All shell scripts accept only --key=value form.
- Very specific: line 117
Do not re-implement argument parsing, tensor-parallel detection, server lifecycle, or the --scheme environment matrix — the shared driver …
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add a new LLM quantization example
Every example under examples/pytorch/llm/<model>/ exposes the same CLI so that
users and CI can drive any model the same way. Follow the layout below.
examples/pytorch/llm/<model>/
├── quantize.py # AutoRoundConfig presets + prepare/convert
├── run_quant.sh # quantization entry point
├── run_benchmark.sh # thin wrapper over the shared lm-eval driver
├── requirements.txt
└── README.mdCLI conventions
All shell scripts accept only --key=value form. Do not add --key value
variants. Unknown flags must print usage and exit non-zero.
run_quant.sh
| Flag | Default | Notes |
--dtype= | required | preset key, e.g. mxfp4, mxfp8, nvfp4 |
--input_model= | required | HF model ID or local path |
--output_model= | required | output directory |
--export_format= | llm_compressor | auto_round or llm_compressor |
--static_kv_dtype= | auto | fp8 enables static KV quantization |
--static_attention_dtype= | auto | fp8 enables static attention quantization |
auto means "not set" — only forward the flag to quantize.py when the value
differs from auto. Collect optional flags in a bash array, never a string:
EXTRA_ARGS=()
if [[ "$STATIC_KV_DTYPE" != "auto" ]]; then
EXTRA_ARGS+=(--static_kv_dtype "$STATIC_KV_DTYPE")
fi
python quantize.py ... "${EXTRA_ARGS[@]}"Under set -e, do not use [[ cond ]] && CMD as the last statement of a block —
a false condition exits the script. Use if.
Variable naming: DTYPE, INPUT_MODEL, OUTPUT_MODEL, EXPORT_FORMAT,
STATIC_KV_DTYPE, STATIC_ATTENTION_DTYPE.
quantize.py
Argument names mirror the rest of the repo, not the shell flag names:
| Shell flag | quantize.py argument |
--input_model= | --model_name_or_path |
--output_model= | --export_path |
--dtype= | --dtype |
--export_format= | --export_format |
Static quantization dtypes use choices=["fp8", "float8_e4m3fn"] and
default=None.
Structure: a module-level preset dict keyed by --dtype, a build_config(args)
returning AutoRoundConfig, then prepare / convert.
_PRESET_CONFIG = {
"mxfp4": {"scheme": "MXFP4", "layer_config": None},
"mxfp8": {"scheme": "MXFP8", "layer_config": None},
}Notes:
llm_compressorexport does not support_RCEILschemes — strip the suffix whenexport_format != "auto_round".- Set
iters=0for model-free / RTN-style presets. - Static KV or attention quantization needs the real model, so
model_freemust beFalsewhen either is set.
run_benchmark.sh
This is a thin wrapper (20–40 lines) over
benchmark/lm_eval/run_lm_eval.sh. It must not parse user arguments — pass
"$@" straight through. It only exports model-family specific settings:
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
REPO_ROOT=$(cd -- "${SCRIPT_DIR}/../../../.." && pwd)
export DEFAULT_SCHEME="mxfp8"
export ATTENTION_BACKEND_FP8KV="FLASHINFER"
bash "${REPO_ROOT}/benchmark/lm_eval/run_lm_eval.sh" "$@"Hooks understood by the shared driver:
| Variable | Purpose |
DEFAULT_SCHEME | default value for --scheme |
ATTENTION_BACKEND_FP8KV | backend when --static_kv_dtype=fp8 (MLA models use FLASHINFER_MLA) |
ATTENTION_BACKEND_FP8ATTN | backend when --static_attention_dtype=fp8 (TRITON_ATTN takes a different code path) |
FLASHINFER_WORKSPACE_SIZE | VLLM_AR_FLASHINFER_WORKSPACE_BUFFER_SIZE |
EXTRA_SERVE_ARGS | extra flags for vllm serve |
EXTRA_LM_EVAL_MODEL_ARGS | extra ,key=value pairs for --model_args |
ROPE_SCALING_JSON | enables rope scaling on vllm serve |
SKIP_ROPE_SCALING_PATTERN | model name substring that disables rope scaling |
Anything task-driven (new benchmark suite, chat-template task, long-context routing) belongs in the shared driver, not in the wrapper. Anything that depends on the model architecture belongs in the wrapper.
Do not re-implement argument parsing, tensor-parallel detection, server
lifecycle, or the --scheme environment matrix — the shared driver owns them.
Tensor parallel size is always inferred from CUDA_VISIBLE_DEVICES.
README
Mirror the structure of examples/pytorch/llm/qwen/README.md: quantization
commands per dtype, then evaluation commands. Use --key=value in every example
command, and prefix eval commands with CUDA_VISIBLE_DEVICES=....
Validation
bash -n examples/pytorch/llm/<model>/run_quant.sh
bash -n examples/pytorch/llm/<model>/run_benchmark.sh
python -c "import ast; ast.parse(open('examples/pytorch/llm/<model>/quantize.py').read())"Smoke-test argument routing without a GPU by putting a stub lm_eval on PATH:
mkdir -p /tmp/fakebin && printf '#!/bin/bash\necho "[lm_eval] $*"\n' > /tmp/fakebin/lm_eval
chmod +x /tmp/fakebin/lm_eval
PATH=/tmp/fakebin:$PATH CUDA_VISIBLE_DEVICES=0,1 bash run_benchmark.sh --model_path=<dir>New files under neural_compressor/ need the Apache 2.0 header; example files
follow the same convention. Run pre-commit run --files <changed files> before
committing.
Trending
Quiet since July.about the whole repository
Who's talking about intel/neural-compressor
- vllm-project/llm-compressor“docs(autoround): clarify MXFP8 Qwen3-32B note and update example batch_size guidance”GitHub · May 25, 2026 · 2 reactions
- vllm-project/llm-compressor“Fix AutoRound ignore-layer metadata handling and add Qwen3-30B to mxfp8 example.”GitHub · May 11, 2026 · 2 reactions
- Starnodes2024/comfyui-starnodes-modelconverter“Add MXFP8 Support”GitHub · Jul 5, 2026 · 1 reactions
- onnx/steering-committee“Neural compressor Proposal - to add port the repo under Intel to ONNX organization”GitHub · May 9, 2022 · 1 reactions
- Stack Overflow“"ValueError: numpy.ndarray size changed " while trying Intel lpot in tensorflow model”Stack Overflow · Oct 4, 2021 · 1 votes
The biggest 5 of 45 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 45
Talked about on GitHub and Stack Overflow (45 times).
On GitHub · 44
- May 25, 2026docs(autoround): clarify MXFP8 Qwen3-32B note and update example batch_size guidance — vllm-project/llm-compressor2 reactions · 8 comments
- May 11, 2026Fix AutoRound ignore-layer metadata handling and add Qwen3-30B to mxfp8 example. — vllm-project/llm-compressor2 reactions · 8 comments
- Jul 5, 2026Add MXFP8 Support — Starnodes2024/comfyui-starnodes-modelconverter1 reaction · 2 comments
- May 9, 2022Neural compressor Proposal - to add port the repo under Intel to ONNX organization — onnx/steering-committee1 reaction · 16 comments
- Jun 18, 2026Withdraw MAL-2026-1035 neural-compressor-jax (false positive — legitimate Intel package) — ossf/malicious-packages0 reactions · 8 comments
39 more on GitHub
- Jun 18, 2026Withdraw MAL-2026-1035 neural-compressor-jax false positive — ossf/malicious-packages0 reactions
- May 19, 2026[Add] neural-compressor (intel/neural-compressor) — PyTorchKR/landscape0 reactions · 4 comments
- Apr 3, 2026[Bug]: Quantized MXFP model export in llmc format failed with inference — intel/auto-round0 reactions · 3 comments
- Mar 30, 2026PEP 541 Request: neural-compressor-jax — pypi/support0 reactions · 6 comments
- Mar 4, 2026[Task]: Extend XPU CI test — intel/auto-round0 reactions
- Jan 8, 2026Bump neural-compressor from 3.6 to 3.7 — Vaksth/02476_exercises0 reactions
- Dec 22, 2025Ensure padding not exceeds VLLM_HPU_FSDPA_SLICE_CHUNK_SIZE — HabanaAI/vllm-hpu-extension0 reactions · 5 comments
- Dec 19, 2025NVFP4 tuning got device mismatch — intel/auto-round0 reactions · 3 comments
- Dec 1, 2025Ensure seq_len padding less than VLLM_HPU_FSDPA_SLICE_CHUNK_SIZE — HabanaAI/vllm-hpu-extension0 reactions
- Aug 28, 2025[DeepSeek R1] add chunk moe args on deepseek_r1 — HabanaAI/vllm-fork0 reactions · 7 comments
- May 16, 2025[DeepSeek][G2] Use naive scaling and full pile — HabanaAI/vllm-fork0 reactions · 1 comment
- May 13, 2025[DeepSeek] Update Docs for Setting Measurement Results Path — HabanaAI/vllm-fork0 reactions · 1 comment
- Apr 22, 2025Revert to old way of calling fused_scaled_dot_product_attention — HabanaAI/vllm-fork0 reactions · 1 comment
- Apr 4, 2025Update deepseek modeling file for PatchedVLLMKVCache — HabanaAI/vllm-fork0 reactions
- Mar 5, 2025Skip `mlp.gate` (MoE only) — yiliu30/vllm-fork0 reactions
- Feb 25, 2025[P22 rebase][Enabled MLA][Enable KVCache] — yiliu30/vllm-fork0 reactions
- Feb 24, 2025[2/24] [P22 Rebase][MLA] — yiliu30/vllm-fork0 reactions
- Feb 21, 2025[2/21-2] Quantize BF16 Model on Single Node — yiliu30/vllm-fork0 reactions
- Feb 20, 2025[2/20] Inference/Prepare/Quantize BF16 R1 — yiliu30/vllm-fork0 reactions
- Feb 13, 2025Exclude node quantization in RTN — microsoft/onnxruntime0 reactions
- Nov 27, 2024[HPU]Enhance `numba` check — intel/auto-round0 reactions
- Nov 5, 2024HPU only release binary — intel/auto-round0 reactions · 2 comments
- Oct 24, 2024Fix bias update in scoped all reduce — huggingface/optimum-habana0 reactions · 8 comments
- Sep 11, 2024[New Feature Request] layer wise sensitivity analysis — intel/auto-round0 reactions
- Sep 9, 2024Bump the tensorflow group across 1 directory with 2 updates — intel/ai-containers0 reactions · 3 comments
- Sep 2, 2024Bump neural-compressor from 3.0 to 3.0.1 in /tensorflow in the tensorflow group — intel/ai-containers0 reactions · 4 comments
- Aug 16, 2024Bump the tensorflow group across 1 directory with 8 updates — intel/ai-containers0 reactions · 3 comments
- Aug 12, 2024Bump the tensorflow group across 1 directory with 9 updates — intel/ai-containers0 reactions · 2 comments
- Jun 18, 2024Enable autoround quantization — huggingface/optimum-intel0 reactions · 2 comments
- Apr 19, 2024[oneDNN] QuantizeV2 with bfloat16 Input — tensorflow/tensorflow0 reactions · 12 comments
- Jan 17, 2024Intel Neural Compressor — he-y/Awesome-Pruning0 reactions · 1 comment
- Jan 11, 2024[Feature Request] Support for TEQ — unslothai/unsloth0 reactions · 2 comments
- Jan 3, 2024Is this pass flow possible for Stable Diffusion?: OrtTransformersOptimization → IncDynamicQuantization or IncStaticQuantization — microsoft/Olive0 reactions · 46 comments
- Jan 1, 2024Update neural-compressor requirement from ~=2.1.1 to ~=2.4.1 — intel/visual-quality-inspection0 reactions
- Nov 1, 2023Intel NNCF functions for Pruning, Distilling and Quantizing for Seq2Seq Task — huggingface/optimum-intel0 reactions · 1 comment
- Sep 12, 2023New submissions for Tue, 12 Sep 23 — zoq/arxiv-updates0 reactions
- May 11, 2023Cannot convert serving signature function to concrete function for Large Language Models (Protobuf error) — tensorflow/tensorflow0 reactions · 11 comments
- Jul 15, 2022Feat: Prune/Compress the nnUNet models for performance gains. — ENHANCE-PET/MOOSE0 reactions · 5 comments
- Feb 1, 2022Error executing tensorflow resnet50 — mlcommons/inference_results_v1.00 reactions · 1 comment
On Stack Overflow · 1
- Oct 4, 2021"ValueError: numpy.ndarray size changed " while trying Intel lpot in tensorflow model1 vote · 1 answer
In this repositoryOne other file it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

