olive
Skill2.4k starsChanged 15 months agoMITView on GitHub
Use Microsoft Olive through its native CLI and YAML/JSON workflow configuration files to optimize, export, quantize, fine-tune, tune, evaluate, and package AI models for ONNX Runtime. Use when a user mentions Olive, olive-ai, olive optimize, Olive passes, model conversion, ONNX optimization, execution providers, or asks to create, explain, validate, or run an Olive workflow config.
Trending
Quiet since September.about the whole repository
Who's talking about microsoft/Olive
- A Hacker News story“Microsoft Olive: an easy-to-use hardware-aware model optimization tool”Hacker News · May 26, 2024 · 12 points
- microsoft/onnxruntime-inference-examples“js/ort-whisper example is broken due to missing operator, ai.onnx.contrib:BpeDecoder.”GitHub · May 8, 2025 · 2 reactions
- microsoft/onnxruntime-genai“KeyError for torch.uint8 in make_tensor_proto_from_tensor due to missing dtype mapping”GitHub · Jun 16, 2025 · 1 reactions
- microsoft/onnxruntime-inference-examples“whisper web example fails setup due to missing olive dependency”GitHub · May 23, 2025 · 1 reactions
- microsoft/onnxruntime“[DmlEP] BeamSearch node is not supported for DmlEP?”GitHub · Dec 13, 2023 · 1 reactions
The biggest 5 of 17 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 17
Talked about on GitHub and Hacker News (17 times).
On GitHub · 16
- May 8, 2025js/ort-whisper example is broken due to missing operator, ai.onnx.contrib:BpeDecoder. — microsoft/onnxruntime-inference-examples2 reactions · 1 comment
- Jun 16, 2025KeyError for torch.uint8 in make_tensor_proto_from_tensor due to missing dtype mapping — microsoft/onnxruntime-genai1 reaction
- May 23, 2025whisper web example fails setup due to missing olive dependency — microsoft/onnxruntime-inference-examples1 reaction
- Dec 13, 2023[DmlEP] BeamSearch node is not supported for DmlEP? — microsoft/onnxruntime1 reaction · 6 comments
- Sep 23, 2026docs(js/ort-whisper): add olive installation instructions and fix broken Olive link — microsoft/onnxruntime-inference-examples0 reactions
11 more on GitHub
- Sep 1, 2026revert qnn gpu — microsoft/olive-recipes0 reactions
- Jul 24, 2026Add defensive ndim==2 guard in preprocess_olive_weights to reject Olive moe=True 3D expert checkpoints — onnxruntime/mobius0 reactions · 2 comments
- Jul 14, 2026update amd again - revert previous update — microsoft/olive-recipes0 reactions
- Jun 11, 2026ModelBuilder support use_cache=False and hidden_states_layers — microsoft/onnxruntime-genai0 reactions
- May 29, 2026[AMD] Add RyzenAI token-fusion recipes; Restore legacy VitisAI eager recipes — microsoft/olive-recipes0 reactions · 7 comments
- May 5, 2026Gemma4 ONNX + CUDA support: all PRs tracker — onnxruntime/mobius0 reactions · 6 comments
- Apr 8, 2025Incorrect output shape for logits output returned from get_output("logits") — microsoft/onnxruntime-genai0 reactions · 6 comments
- Dec 8, 2024auto quantization of big arrays on computation — beehive-lab/TornadoVM0 reactions · 1 comment
- Feb 26, 2024【任务】模型量化 — NascentCore/3k0 reactions · 4 comments
- Aug 10, 2023Error Node (BeamSearch_node) has input size 12 not in range [min=5, max=10] — onnxruntime/Whisper-HybridLoop-Onnx-Demo0 reactions · 1 comment
- Jul 2, 2023Add DirectML Support on Windows — painebenjamin/app.enfugue.ai0 reactions
On Hacker News · 1
- May 26, 2024Microsoft Olive: an easy-to-use hardware-aware model optimization tool12 points
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
The file
Show its rules and text
We split this skill into the rules it gives an agent
34 rules. About 0 are common, 16 are distinctive, and 18 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈16
Distinctive · estimate
This author's own choices. Worth a look.
18
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Use the native olive command and Olive workflow files.
- Very specific: line 16
Treat the installed Olive version as the source of truth.
- Very specific: line 23
Do not invent command flags, pass names, pass parameters, model types, or execution providers.
- Very specific: line 29
Before searching recipes, generating a workflow, inspecting candidate pass chains, or running an Olive command, confirm the target …
- Distinctive: line 33
Always confirm the requested output precision.
- Distinctive: line 41
Ask for every missing or ambiguous value before continuing.
- Very specific: line 48
Do not require the user to understand Olive precision names, execution-provider internals, QNN backends, SoC IDs, or runtime versioning.
- Distinctive: line 52
Ask one plain-language question at a time.
- Distinctive: line 69
If a required target fact cannot be detected and the user cannot provide it, do not invent it.
- Very specific: line 88
Do not use olive auto-opt.
- Distinctive: line 90
Read the CLI guide for installation, command examples, dry runs, test mode, and provider selection.
- Very specific: line 99
Check olive <command> --help in the active environment.
- Very specific: line 100
Use an explicit output directory and --log_level 1 for meaningful progress logs.
- Distinctive: line 103
Run the requested operation.
- Very specific: line 108
Use --save_config_file when the user wants both execution and a saved recipe.
- Distinctive: line 115
Use a YAML or JSON workflow when the user needs multiple passes, reusable configuration, custom data, evaluation, search, custom scripts, …
- Distinctive: line 118
Read the workflow configuration guide before creating or editing a workflow.
- Very specific: line 121
Read each selected recipe's README, executable workflow JSON, requirements, and version or commit pins.
- Very specific: line 124
If the exact model and provider are absent, derive a candidate from prior recipes instead of stopping at an exact-name search or merely …
- Distinctive: line 144
Use a high-level dry run as an installed-version compatibility scaffold after studying the reference recipes, not as the final inferred …
- Distinctive: line 161
When authoring a workflow:
- Very specific: line 163
Keep input_model, passes, and output settings explicit.
- Very specific: line 166
Use a unique name for every data config.
- Very specific: line 169
Use the bundled workflow template only as a generic Hugging Face-to-ONNX example.
- Very specific: line 172
Never copy a model's Hugging Face config.json and treat it as an Olive workflow.
- Distinctive: line 173
Never place tokens, credentials, or secrets in a workflow file.
- Distinctive: line 175
Before using a nontrivial pass, inspect its installed schema from this skill's root:
- Distinctive: line 219
Use one ONNX Runtime variant per environment.
- Distinctive: line 226
Do not select fp16 for CPU merely to reduce model size.
- Very specific: line 232
Use --trust_remote_code only when the user explicitly trusts the model repository or existing project configuration already requires it.
- Very specific: line 234
Use HF_TOKEN or the Hugging Face credential store for gated models.
- Very specific: line 236
Do not enable clean_cache, delete outputs, overwrite a nonempty output directory, or remove generated artifacts without user intent.
- Distinctive: line 240
Do not claim quality, latency, memory, or size improvements without comparing actual outputs or metrics.
- Distinctive: line 241
If network access or hardware is unavailable, complete local config and dry-run validation and state exactly what remains unverified.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Microsoft Olive
Use the native olive command and Olive workflow files. This skill does not require or assume an MCP
server.
Treat the installed Olive version as the source of truth. Before using unfamiliar options, run:
olive --help
olive <command> --helpDo not invent command flags, pass names, pass parameters, model types, or execution providers. If an existing project already has an Olive config, preserve its conventions and make the smallest necessary change.
Required target questions
Before searching recipes, generating a workflow, inspecting candidate pass chains, or running an Olive command, confirm the target requirements with the user. Do not infer them from the model, provider defaults, installed hardware, or the source checkpoint:
- Always confirm the requested output precision. For quantized workflows, confirm weight precision and activation precision separately when both apply.
- Confirm the execution provider if the user has not specified it.
- For QNN, confirm the target device or backend, such as QNN GPU versus HTP/NPU, and the target Qualcomm SoC or product.
Derive and confirm the corresponding ORT
soc_modelsetting when the workflow requires it. - For OpenVINO, confirm the target device, such as CPU, GPU, or NPU, and the target OpenVINO runtime or toolkit version.
Ask for every missing or ambiguous value before continuing. These values are recipe-search constraints: include the model or architecture, provider, device, precision, and, when applicable, SoC model or runtime version in the search. A recipe for the wrong device, SoC, precision, or runtime version is reference material, not a drop-in starting point.
Guide users who do not know the target details
Do not require the user to understand Olive precision names, execution-provider internals, QNN backends, SoC IDs, or runtime versioning. If the user does not know a required value, switch to guided discovery before searching for a final recipe:
- Ask one plain-language question at a time. For precision, first ask whether the priority is quality, balanced quality and resource use, or minimum model size and highest feasible speed.
- Determine whether the target is the current machine or another device. Inspect local hardware, available execution providers, SDKs, and runtime versions when the actual target is accessible; otherwise ask for the target product or chip name.
- Inspect the source model configuration and existing weight format so unsupported or redundant precision conversions are not offered.
- Map the user's goal and detected target to only the combinations supported by the installed Olive version, exporter, provider, and relevant model family.
- Present a small set of valid choices with short tradeoffs, mark a recommended choice, and get explicit confirmation before searching recipes or generating a workflow.
For QNN, translate a product or chip name into QNN GPU versus HTP/NPU and the required SoC setting; do not
ask a non-expert for a numeric soc_model value when it can be derived from authoritative QNN or ONNX
Runtime documentation. For OpenVINO, detect the installed version and available target devices when
possible, then ask the user to confirm the intended device.
If a required target fact cannot be detected and the user cannot provide it, do not invent it. Explain which decision remains unresolved. Produce a portable non-AOT or experimental scaffold only if the user explicitly chooses that fallback, and do not label it as a hardware-specific final recipe.
Choose the right interface
| User goal | Preferred interface |
| Wants guided setup or does not know which operation to choose | olive init |
| Wants an end-to-end optimized model | olive optimize |
| Wants only ONNX export | olive capture-onnx-graph |
| Wants only quantization | olive quantize |
| Wants text LoRA or QLoRA training | olive finetune |
| Wants diffusion LoRA training | olive diffusion-lora |
| Wants one known Olive pass | olive run-pass |
| Wants a repeatable multi-pass pipeline, evaluation, search, or custom data | olive run --config ... |
| Wants ONNX Runtime session tuning | olive tune-session-params |
| Wants lm-eval benchmarking | olive benchmark |
Do not use olive auto-opt; it is deprecated in favor of olive optimize.
Read the CLI guide for installation, command examples, dry runs, test mode, and provider selection.
Execution workflow
- Identify the input model format and path or Hugging Face ID.
- Identify the desired output: optimized ONNX, quantized model, adapter, benchmark, or reusable workflow.
- Complete the required target questions above. Do not search recipes or generate a config while a required value is missing or ambiguous.
- Check
olive <command> --helpin the active environment. - Use an explicit output directory and
--log_level 1for meaningful progress logs. - For expensive or unfamiliar high-level commands, add
--dry_run. Inspect the generated<output_path>/config.json, then run it witholive run --config <path>after it is correct. - Run the requested operation. Do not claim success until the process exits successfully and the expected output exists.
- Report the output path, selected provider and precision, passes that ran, and metrics that Olive actually returned.
Use --save_config_file when the user wants both execution and a saved recipe. It saves
olive_config.json while the command continues. Use --dry_run when the user wants configuration
generation without optimization; it saves config.json and stops. It does not perform full workflow or
pass-schema validation.
Write workflow configuration
Use a YAML or JSON workflow when the user needs multiple passes, reusable configuration, custom data, evaluation, search, custom scripts, remote systems, or settings not exposed by a high-level command.
Read the workflow configuration guide before creating or editing a
workflow. For a model- and provider-specific workflow, search
microsoft/olive-recipes before generating a generic config.
Read each selected recipe's README, executable workflow JSON, requirements, and version or commit pins;
info.yml and info.yaml are recipe catalog metadata, not files for olive run --config.
If the exact model and provider are absent, derive a candidate from prior recipes instead of stopping at an
exact-name search or merely replacing model_path in one recipe. Triangulate from:
- The same architecture or model family on any provider for model type, exporter, component layout, and architecture-specific graph transformations.
- The same provider and device for systems, lowering, static-shape, compilation or AOT passes, environment boundaries, and provider options.
- The same source weight format and quantization scheme for compatible quantization, calibration, and data settings.
Inspect the target model's Hugging Face configuration and repository metadata before merging those
references. Check its architecture, task, context and cache design, modality, parameter and checkpoint size,
and existing quantization_config. Do not schedule dequantization or a second quantizer for a pre-quantized
checkpoint unless the selected exporter explicitly supports that conversion.
Preserve multi-stage workflows from the provider recipe, such as separate quantization and QNN AOT environments. Copy a pass or setting only when its model format, graph, precision, device, and runtime preconditions still hold. Never infer that two models are compatible from repository names alone; a distilled model can use a different base architecture than its name suggests.
Use a high-level dry run as an installed-version compatibility scaffold after studying the reference recipes, not as the final inferred recipe:
olive optimize \
--model_name_or_path Qwen/Qwen2.5-0.5B-Instruct \
--precision int4 \
--provider CPUExecutionProvider \
--output_path olive-output \
--dry_runCompare its output with the reference pass chains, inspect every nontrivial pass schema, and explain which recipe supplied each model-specific or provider-specific decision. If the installed exporter or a required pass does not support the target architecture, report the recipe as blocked rather than presenting a structurally valid config as runnable.
When authoring a workflow:
- Keep
input_model,passes, and output settings explicit. - Define pass entries in execution order; mapping order is pipeline order.
- Reference systems, data configs, and evaluators by their declared names.
- Use a unique
namefor every data config. - Olive accepts JSON and YAML. Recipes normally use JSON for executable workflows; YAML remains useful for hand-maintained workflows with comments.
- Use the bundled workflow template only as a generic Hugging Face-to-ONNX example.
Current generative LLM recipes often use
ModelBuilder; follow the closest recipe instead of substitutingOnnxConversion. - Never copy a model's Hugging Face
config.jsonand treat it as an Olive workflow. - Never place tokens, credentials, or secrets in a workflow file.
Before using a nontrivial pass, inspect its installed schema from this skill's root:
python scripts/inspect_pass.py OnnxConversionValidate a workflow without running model optimization:
python scripts/validate_config.py workflow.yaml
olive run --config workflow.yaml --list_required_packagesThe second command writes olive_requirements.txt in the current directory. Review it, install the listed
packages into the intended environment, and check model-loader and exporter requirements described in the
CLI guide before running:
olive run --config workflow.yamlStructural validation cannot prove that remote models are accessible, local data is semantically correct, the model is supported by every pass, or the target hardware has enough memory. Surface those constraints instead of presenting validation as execution success.
Deep dives for quantization work
For PyTorch/Hugging Face weight quantization (RTN, GPTQ, and related passes), read these before making nontrivial changes or answering detailed questions:
- Quantization onboarding -- pass overview, shared config surface, RTN vs. GPTQ trade-offs, calibration data and split-hygiene notes.
- MoE GPTQ onboarding -- per-expert calibration mechanics, the K-last layout requirement and architecture allow-list, the dual fallback-threshold design (routing skew vs. statistical sufficiency), and what a three-model benchmark showed about fallback rates and quantization wall-time.
- Profiling/benchmark example -- how to use
scripts/quantize_and_compare_perplexity.pyto compare a pass against baseline on a real model, with a worked three-model example table.
Dependency and hardware rules
- Reuse the user's active environment when it already contains the required Olive and runtime packages.
- Install dependencies only when Olive or a required optional package is missing.
- Use one ONNX Runtime variant per environment. Do not combine CPU, CUDA, DirectML, OpenVINO, or QNN runtime packages in the same environment unless the installed package documentation explicitly supports it.
- Match
device, execution provider, and runtime: CPU withCPUExecutionProvider, NVIDIA GPU withCUDAExecutionProvider, WebGPU withWebGpuExecutionProvider, Windows DirectX GPU withDmlExecutionProvider, and Qualcomm NPU withQNNExecutionProvider. Configure only one execution provider per accelerator. - Do not select fp16 for CPU merely to reduce model size. Prefer int4 or int8 when supported.
- Calibration-based quantization and fine-tuning may require datasets and substantial compute. Do not silently replace the user's dataset or algorithm.
Safety and correctness
- Use
--trust_remote_codeonly when the user explicitly trusts the model repository or existing project configuration already requires it. - Use
HF_TOKENor the Hugging Face credential store for gated models. Never write a token into a command, config, script, log, or committed file. - Do not enable
clean_cache, delete outputs, overwrite a nonempty output directory, or remove generated artifacts without user intent. - A
--testrun uses a small randomly initialized model with the same architecture. It checks pipeline compatibility, not real model quality. - Do not claim quality, latency, memory, or size improvements without comparing actual outputs or metrics.
- If network access or hardware is unavailable, complete local config and dry-run validation and state exactly what remains unverified.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

