Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
566a6c5
Consolidate TelemetryCacheHandler to single lock
bmehta001 Apr 9, 2026
2211d19
Fix concurrency issues in telemetry
bmehta001 Apr 9, 2026
276431e
Simplify telemetry cache and singleton patterns
bmehta001 Apr 9, 2026
cf1d641
Fix callback double-counting and multi-process cache overwrite
bmehta001 Apr 10, 2026
7d78e14
Track recipe telemetry in CI
bmehta001 May 4, 2026
c301071
Remove avoidable telemetry lint suppressions
bmehta001 May 4, 2026
d2dd0f3
Move service name handling into telemetry logger
bmehta001 May 4, 2026
c08c9f0
Scope service-name cleanup to Olive usage
bmehta001 May 4, 2026
d51a297
Revert unnecessary non-telemetry branch changes
bmehta001 May 4, 2026
056bf20
Address PR review feedback on telemetry changes
bmehta001 May 4, 2026
00e4076
Remove low-value service-name telemetry test
bmehta001 May 4, 2026
f07c49f
Address remaining GitHub Advanced Security comments
bmehta001 May 4, 2026
702bacf
Simplify telemetry utils responsibilities
bmehta001 May 4, 2026
6dd7a05
Store CI detection result once in telemetry init
bmehta001 May 4, 2026
c219866
Refine recipe telemetry semantics and config tracking
bmehta001 May 4, 2026
43afc4d
Replace package config hash with override values
bmehta001 May 4, 2026
0a17cb7
Guard Azure CI secret-dependent login steps
bmehta001 May 5, 2026
e2a9b21
Revert Azure CI secret login guards
bmehta001 May 5, 2026
4e1ccda
Address telemetry review comments
bmehta001 May 5, 2026
2577278
Fix telemetry pipeline test regressions
bmehta001 May 5, 2026
cbb3073
Log workflow exceptions as error telemetry
bmehta001 May 9, 2026
4c70c46
Reduce CLI import churn
bmehta001 May 9, 2026
28ef5b0
Simplify Docker recipe telemetry suppression
bmehta001 May 9, 2026
a99ef15
Keep platform imports local
bmehta001 May 9, 2026
8c1c726
Move recipe telemetry helpers out of runner
bmehta001 May 11, 2026
3717d9f
Move recipe telemetry helpers to telemetry package
bmehta001 May 11, 2026
b50423c
Address simple telemetry review comments
bmehta001 May 21, 2026
a756445
Refine recipe telemetry metadata
bmehta001 May 22, 2026
35d3552
Harden telemetry cache replay and flush wait
bmehta001 May 26, 2026
7347cf8
Migrate telemetry to stdlib SQLite pipeline with three-state opt-out
bmehta001 Jun 26, 2026
aca051b
Apply multi-agent review fixes: init race, redaction, privacy doc
bmehta001 Jun 26, 2026
a757f07
Make the device-id heartbeat durable for reliable device counting
bmehta001 Jun 26, 2026
9c33f0a
Align heartbeat field names with onnxruntime-genai
bmehta001 Jun 26, 2026
db4efc0
Keep telemetry inert in tests after durable-heartbeat change
bmehta001 Jun 26, 2026
a07ec96
Harden device-id store to owner-only permissions
bmehta001 Jul 7, 2026
8acd353
telemetry: address Copilot review on shutdown and recipe logging
bmehta001 Jul 15, 2026
57af124
telemetry: address Copilot opt-out isolation feedback
bmehta001 Jul 15, 2026
0b80b96
telemetry: address Copilot shutdown and duplicate-error feedback
bmehta001 Jul 15, 2026
fb3889b
telemetry: address Copilot uploader follow-ups
bmehta001 Jul 15, 2026
9b64bf0
telemetry: address Copilot lint follow-ups
bmehta001 Jul 15, 2026
1901806
telemetry: keep uploader reference until shutdown
bmehta001 Jul 15, 2026
fcec32d
telemetry: address Copilot finalizer and metadata feedback
bmehta001 Jul 15, 2026
3d3abfe
telemetry: address Copilot uploader drain edge cases
bmehta001 Jul 15, 2026
a3df0d2
telemetry: avoid releasing drain lock while uploader runs
bmehta001 Jul 15, 2026
cf6e695
telemetry: fix local review findings before Copilot loop
bmehta001 Jul 20, 2026
ff6f96e
Merge upstream/main into Olive telemetry branch
bmehta001 Jul 20, 2026
ea884a3
telemetry: address Copilot round 1
bmehta001 Jul 20, 2026
a06dcfb
telemetry: address Copilot round 2 fixture cleanup
bmehta001 Jul 20, 2026
0a9b557
telemetry: satisfy Python format checks
bmehta001 Jul 20, 2026
8836517
telemetry: satisfy Pylint checks
bmehta001 Jul 20, 2026
9584988
telemetry: guard empty permission paths
bmehta001 Jul 20, 2026
f6b2917
telemetry: address Copilot uploader wake race
bmehta001 Jul 20, 2026
7e02760
telemetry: use monotonic flush deadlines
bmehta001 Jul 21, 2026
518df1e
telemetry: address Copilot recipe metadata round
bmehta001 Jul 21, 2026
08f70d4
telemetry: close completed review threads
bmehta001 Jul 21, 2026
c333feb
Bound Olive telemetry lifecycle work
bmehta001 Jul 21, 2026
b521622
Align Olive telemetry tests with CI behavior
bmehta001 Jul 21, 2026
389858a
Harden Olive device ID and traceback handling
bmehta001 Jul 21, 2026
1eaa239
Limit Olive device ID registry access
bmehta001 Jul 21, 2026
fd296dc
Preserve safe Olive traceback context
bmehta001 Jul 21, 2026
ae89069
Reuse the Olive device store test import
bmehta001 Jul 21, 2026
8e3fa6b
Label Olive actions from function ownership
bmehta001 Jul 21, 2026
06bed4b
Keep the Olive telemetry value at its use site
bmehta001 Jul 21, 2026
68a7106
Scope Olive telemetry suppression to each run
bmehta001 Jul 21, 2026
01e0fdd
Keep Olive exporter diagnostics configurable
bmehta001 Jul 21, 2026
c94d15b
Use the ORT telemetry opt-out contract in Olive
bmehta001 Jul 21, 2026
93e1150
Recognize installed Olive traceback frames
bmehta001 Jul 21, 2026
6059701
Match ONNX Runtime telemetry redaction
bmehta001 Jul 21, 2026
3cd536c
Keep ORT telemetry disabled for the full Olive command
bmehta001 Jul 21, 2026
6afbfa3
Scrub Olive action metadata recursively
bmehta001 Jul 21, 2026
cb9e5be
Describe Olive traceback redaction accurately
bmehta001 Jul 21, 2026
8c16bb0
Preserve falsy Olive telemetry map keys
bmehta001 Jul 21, 2026
81b2c90
Scrub Olive metadata keys recursively
bmehta001 Jul 21, 2026
2c81424
Redact unknown Olive config object names
bmehta001 Jul 21, 2026
f2e5c05
Remove the stale Olive device ID comment
bmehta001 Jul 21, 2026
767129c
Close partially initialized Olive telemetry stores
bmehta001 Jul 21, 2026
8fd10ad
Retry failed Olive telemetry initialization
bmehta001 Jul 21, 2026
76f27d3
Keep live Olive drain locks with the uploader
bmehta001 Jul 21, 2026
126e9be
Keep telemetry reusable after shutdown
bmehta001 Jul 21, 2026
0e750f1
Remove stale telemetry app-name constant
bmehta001 Jul 21, 2026
fb4ff4b
Wake only the active telemetry drainer
bmehta001 Jul 22, 2026
f1a87e3
Make Olive telemetry opt-out complete
bmehta001 Jul 23, 2026
d471235
Raise Olive telemetry error messages to 40 KB
bmehta001 Jul 24, 2026
fb60a93
Keep Olive telemetry helpers best-effort
bmehta001 Jul 24, 2026
c481a76
Apply Olive test opt-out before initialization
bmehta001 Jul 24, 2026
cfc3162
Align Olive telemetry schema with ONNX Runtime
bmehta001 Jul 25, 2026
2413f16
Align Olive telemetry with native context
bmehta001 Jul 27, 2026
cec557e
Merge main into telemetry branch
bmehta001 Jul 28, 2026
4d457c5
fix: adapt model builder to latest genai behavior (#2601)
Copilot Aug 4, 2026
274cb8f
Skip CI for skills and MCP-only changes (#2604)
xiaoyu-work Aug 4, 2026
e6ecceb
Rename mobius-ai to mobius-onnx (#2597)
Copilot Aug 4, 2026
de9cde3
add fast test to check with bfloat16 (#2581)
xadupre Aug 5, 2026
5ccc4f0
Emit ORT-spec-compliant model packages from generate-model-package (#…
xiaoyu-work Aug 5, 2026
ffa14bd
skip ci for mcp and skills (#2607)
xiaoyu-work Aug 5, 2026
723286f
Use the full calibration split and surface sample shortfalls (#2609)
titaiwangms Aug 5, 2026
0615b3a
Bump cryptography from 48.0.1 to 50.0.0 in /mcp (#2606)
dependabot[bot] Aug 5, 2026
5da30f8
Improve olive skill recipe inference (#2603)
xiaoyu-work Aug 5, 2026
9319efc
add discrepancies for whisper models (#2590)
xadupre Aug 6, 2026
96fb44d
Extend PyTorch RTN weight quantization to MoE experts (#2584)
titaiwangms Aug 11, 2026
d2bc295
Guard RTN MoE quantization by expert layout (#2616)
titaiwangms Aug 12, 2026
4309161
Add MoE support to PyTorch KQuant (#2618)
titaiwangms Aug 13, 2026
185ac5d
Unpin transformers (#2622)
shaahji Aug 13, 2026
5623f5b
docs: document eager experts_implementation requirement for MoE-quant…
titaiwangms Aug 13, 2026
67b0a19
ci: show environment (pip list) before running tests (#2624)
titaiwangms Aug 13, 2026
20f407e
Support weight sharing in QNN GPU (#2325)
vjatoth-qti Aug 13, 2026
a03a14a
Fix DynamicLayer state leak after dynamo export (#2626)
titaiwangms Aug 14, 2026
afb3d23
lint and spellcheck (#2627)
jambayk Aug 14, 2026
5045ae0
Add GPTQ quantization support for K-last MoE architectures (#2610)
titaiwangms Aug 14, 2026
0cbcdd9
Add MoE GPTQ benchmark script and quantization onboarding docs (#2612)
titaiwangms Aug 14, 2026
9f62ca0
feat: add components_to_export filter to MobiusBuilder pass (#2456)
titaiwangms Aug 18, 2026
9253bbe
Support Qwen3.5/3.6-MoE VL checkpoints in PyTorch-side quantization (…
titaiwangms Aug 18, 2026
7c7577a
Consolidate TelemetryCacheHandler to single lock
bmehta001 Apr 9, 2026
30a5b66
Fix concurrency issues in telemetry
bmehta001 Apr 9, 2026
3430f9e
Simplify telemetry cache and singleton patterns
bmehta001 Apr 9, 2026
7d8f08d
Fix callback double-counting and multi-process cache overwrite
bmehta001 Apr 10, 2026
cf0fa08
Track recipe telemetry in CI
bmehta001 May 4, 2026
5827316
Remove avoidable telemetry lint suppressions
bmehta001 May 4, 2026
4bba938
Move service name handling into telemetry logger
bmehta001 May 4, 2026
6d1dda5
Scope service-name cleanup to Olive usage
bmehta001 May 4, 2026
2754ee4
Revert unnecessary non-telemetry branch changes
bmehta001 May 4, 2026
7028622
Address PR review feedback on telemetry changes
bmehta001 May 4, 2026
ec0051a
Remove low-value service-name telemetry test
bmehta001 May 4, 2026
f5f68b9
Address remaining GitHub Advanced Security comments
bmehta001 May 4, 2026
9c77c81
Simplify telemetry utils responsibilities
bmehta001 May 4, 2026
7b8900f
Store CI detection result once in telemetry init
bmehta001 May 4, 2026
cd7ee7a
Refine recipe telemetry semantics and config tracking
bmehta001 May 4, 2026
4e9335a
Replace package config hash with override values
bmehta001 May 4, 2026
f46f0c9
Guard Azure CI secret-dependent login steps
bmehta001 May 5, 2026
551fdfe
Revert Azure CI secret login guards
bmehta001 May 5, 2026
88bb918
Address telemetry review comments
bmehta001 May 5, 2026
eb0c7a9
Fix telemetry pipeline test regressions
bmehta001 May 5, 2026
4e92aae
Log workflow exceptions as error telemetry
bmehta001 May 9, 2026
9644b1b
Reduce CLI import churn
bmehta001 May 9, 2026
f60929e
Simplify Docker recipe telemetry suppression
bmehta001 May 9, 2026
d40e485
Keep platform imports local
bmehta001 May 9, 2026
da95656
Move recipe telemetry helpers out of runner
bmehta001 May 11, 2026
0b0b935
Move recipe telemetry helpers to telemetry package
bmehta001 May 11, 2026
feaed68
Address simple telemetry review comments
bmehta001 May 21, 2026
893a50a
Refine recipe telemetry metadata
bmehta001 May 22, 2026
47c73ba
Harden telemetry cache replay and flush wait
bmehta001 May 26, 2026
8f8038b
Migrate telemetry to stdlib SQLite pipeline with three-state opt-out
bmehta001 Jun 26, 2026
3b27e7b
Apply multi-agent review fixes: init race, redaction, privacy doc
bmehta001 Jun 26, 2026
50e11b6
Make the device-id heartbeat durable for reliable device counting
bmehta001 Jun 26, 2026
b56e108
Align heartbeat field names with onnxruntime-genai
bmehta001 Jun 26, 2026
dd34929
Keep telemetry inert in tests after durable-heartbeat change
bmehta001 Jun 26, 2026
baa48fe
Harden device-id store to owner-only permissions
bmehta001 Jul 7, 2026
b3aca97
telemetry: address Copilot review on shutdown and recipe logging
bmehta001 Jul 15, 2026
fd0f9d8
telemetry: address Copilot opt-out isolation feedback
bmehta001 Jul 15, 2026
e6fccdd
telemetry: address Copilot shutdown and duplicate-error feedback
bmehta001 Jul 15, 2026
f8af7aa
telemetry: address Copilot uploader follow-ups
bmehta001 Jul 15, 2026
4a2e564
telemetry: address Copilot lint follow-ups
bmehta001 Jul 15, 2026
bf73b40
telemetry: keep uploader reference until shutdown
bmehta001 Jul 15, 2026
5e3f2cb
telemetry: address Copilot finalizer and metadata feedback
bmehta001 Jul 15, 2026
c600e8a
telemetry: address Copilot uploader drain edge cases
bmehta001 Jul 15, 2026
c0407f5
telemetry: avoid releasing drain lock while uploader runs
bmehta001 Jul 15, 2026
246e38d
telemetry: fix local review findings before Copilot loop
bmehta001 Jul 20, 2026
a3bb024
telemetry: address Copilot round 1
bmehta001 Jul 20, 2026
cc9bcff
telemetry: address Copilot round 2 fixture cleanup
bmehta001 Jul 20, 2026
001bf3a
telemetry: satisfy Python format checks
bmehta001 Jul 20, 2026
c6ad99e
telemetry: satisfy Pylint checks
bmehta001 Jul 20, 2026
d35ffeb
telemetry: guard empty permission paths
bmehta001 Jul 20, 2026
a153c4f
telemetry: address Copilot uploader wake race
bmehta001 Jul 20, 2026
eb6f733
telemetry: use monotonic flush deadlines
bmehta001 Jul 21, 2026
8f66427
telemetry: address Copilot recipe metadata round
bmehta001 Jul 21, 2026
d8c7a54
telemetry: close completed review threads
bmehta001 Jul 21, 2026
5071eec
Bound Olive telemetry lifecycle work
bmehta001 Jul 21, 2026
2cc1385
Align Olive telemetry tests with CI behavior
bmehta001 Jul 21, 2026
3caf12b
Harden Olive device ID and traceback handling
bmehta001 Jul 21, 2026
20c95a8
Limit Olive device ID registry access
bmehta001 Jul 21, 2026
6b8f22a
Preserve safe Olive traceback context
bmehta001 Jul 21, 2026
c75d372
Reuse the Olive device store test import
bmehta001 Jul 21, 2026
9564e20
Label Olive actions from function ownership
bmehta001 Jul 21, 2026
edcd6af
Keep the Olive telemetry value at its use site
bmehta001 Jul 21, 2026
c8c26cb
Scope Olive telemetry suppression to each run
bmehta001 Jul 21, 2026
3334b99
Keep Olive exporter diagnostics configurable
bmehta001 Jul 21, 2026
4864c6d
Use the ORT telemetry opt-out contract in Olive
bmehta001 Jul 21, 2026
279cb0d
Recognize installed Olive traceback frames
bmehta001 Jul 21, 2026
38bec13
Match ONNX Runtime telemetry redaction
bmehta001 Jul 21, 2026
a287223
Keep ORT telemetry disabled for the full Olive command
bmehta001 Jul 21, 2026
9c8943d
Scrub Olive action metadata recursively
bmehta001 Jul 21, 2026
4ffe241
Describe Olive traceback redaction accurately
bmehta001 Jul 21, 2026
7cccf8d
Preserve falsy Olive telemetry map keys
bmehta001 Jul 21, 2026
d69e589
Scrub Olive metadata keys recursively
bmehta001 Jul 21, 2026
8397155
Redact unknown Olive config object names
bmehta001 Jul 21, 2026
cd43899
Remove the stale Olive device ID comment
bmehta001 Jul 21, 2026
3ae9ef2
Close partially initialized Olive telemetry stores
bmehta001 Jul 21, 2026
ba4e403
Retry failed Olive telemetry initialization
bmehta001 Jul 21, 2026
77bb231
Keep live Olive drain locks with the uploader
bmehta001 Jul 21, 2026
180bd24
Keep telemetry reusable after shutdown
bmehta001 Jul 21, 2026
f330166
Remove stale telemetry app-name constant
bmehta001 Jul 21, 2026
97ea483
Wake only the active telemetry drainer
bmehta001 Jul 22, 2026
51771e7
Make Olive telemetry opt-out complete
bmehta001 Jul 23, 2026
e1a83c3
Raise Olive telemetry error messages to 40 KB
bmehta001 Jul 24, 2026
481aa52
Keep Olive telemetry helpers best-effort
bmehta001 Jul 24, 2026
6c2fe39
Apply Olive test opt-out before initialization
bmehta001 Jul 24, 2026
1c2f9e5
Align Olive telemetry schema with ONNX Runtime
bmehta001 Jul 25, 2026
604e424
Align Olive telemetry with native context
bmehta001 Jul 27, 2026
1b0b95d
Harden telemetry privacy and durable delivery
bmehta001 Aug 19, 2026
30e3d41
Harden telemetry secret scanning
bmehta001 Aug 19, 2026
e796d49
Instrument the Olive init command
bmehta001 Aug 19, 2026
095ec78
Reconnect canonical telemetry history to PR #2443
bmehta001 Aug 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .azure_pipelines/job_templates/olive-test-cpu-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ jobs:
- script: |
python -m pip install pytest
python -m pip install -r $(Build.SourcesDirectory)/test/$(requirements_file)
displayName: Install test dependencies

- script: |
python -m pip list
displayName: Show environment (pip list)

- script: |
coverage run --source=$(Build.SourcesDirectory)/olive -m pytest -v -s -p no:warnings --disable-warnings --log-cli-level=WARNING --junitxml=$(Build.SourcesDirectory)/logs/test-TestOlive.xml -m "$(pytest_marker)" $(Build.SourcesDirectory)/$(test_path) --basetemp $(PYTEST_BASETEMP)
coverage xml
displayName: Test Olive
Expand Down
2 changes: 2 additions & 0 deletions .azure_pipelines/olive-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ trigger:
- mcp/**
- notebooks/**
- scripts/**
- skills/**
pr:
branches:
include:
Expand All @@ -27,6 +28,7 @@ pr:
- mcp/**
- notebooks/**
- scripts/**
- skills/**

variables:
runCodesignValidationInjection: false
Expand Down
2 changes: 2 additions & 0 deletions .azure_pipelines/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ BUILD_CUDA_EXT=0 pip install --no-build-isolation "git+https://github.com/PanQiW
pip install huggingface-hub
hf auth login --token "$7"

echo "===== Environment (pip list) ====="
pip list
echo "==================================="

# Step 4: Run tests with or without coverage tracking
XML_PATH="/logs/TestOlive.xml"
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/test-model-fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ on:
push:
branches:
- main
paths-ignore:
- "mcp/**"
- "skills/**"
pull_request:
branches:
- main
paths-ignore:
- "mcp/**"
- "skills/**"

jobs:
ubuntu-test-model-fast:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ The sample chat app to run is found as [model-chat.py](https://github.com/micros
- [Recipes](https://github.com/microsoft/olive-recipes)

## Data/Telemetry
Distributions of this project may collect usage data and send it to Microsoft to help improve our products and services. See the [privacy statement](docs/Privacy.md) for more details.

This project may collect usage data and send it to Microsoft to help improve our products and services. See the [privacy statement](docs/Privacy.md) for details.

## 🤝 Contributions and Feedback
- We welcome contributions! Please read the [contribution guidelines](./CONTRIBUTING.md) for more details on how to contribute to the Olive project.
Expand All @@ -133,4 +134,3 @@ Licensed under the [MIT](./LICENSE) License.
[![Build Status](https://dev.azure.com/aiinfra/PublicPackages/_apis/build/status%2FOlive%20CI?label=Olive-CI)](https://dev.azure.com/aiinfra/PublicPackages/_build/latest?definitionId=1240)
[![Build Status](https://dev.azure.com/aiinfra/PublicPackages/_apis/build/status%2FOlive-ORT-Nightly?label=Olive-ORT-Nightly)](https://dev.azure.com/aiinfra/PublicPackages/_build/latest?definitionId=1279)


21 changes: 19 additions & 2 deletions docs/Privacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,28 @@ The software may collect information about you and your use of the software and
***

## Technical Details
Olive uses the [OpenTelemetry](https://opentelemetry.io/) API for its implementation. Telemetry is turned ON by default. Based on user consent, this data may be periodically sent to Microsoft servers following GDPR and privacy regulations for anonymity and data access controls. Application, device, and version information is collected automatically.
Telemetry is turned ON by default. Based on user consent, this data may be periodically sent to Microsoft servers following GDPR and privacy regulations for anonymity and data access controls. Application, device, and version information is collected automatically.

In addition, Olive may collect additional telemetry data such as:
- Invoked commands
- Performance data
- Exception information

Collection of this additional telemetry can be disabled by adding the `--disable_telemetry` flag to any Olive CLI command, or by setting the `OLIVE_DISABLE_TELEMETRY` environment variable to `1` before running. Telemetry is also automatically disabled when a CI/CD environment is detected (e.g., GitHub Actions, Azure Pipelines, Jenkins). If telemetry is enabled, but cannot be sent to Microsoft, it will be stored locally and sent when a connection is available. You can override the default cache location by setting the `OLIVE_TELEMETRY_CACHE_DIR` environment variable to a valid directory path.
You can fully disable telemetry by adding the `--disable_telemetry` flag to any Olive CLI command, setting `OLIVE_DISABLE_TELEMETRY=1` or `ORT_DISABLE_TELEMETRY=1` before running, or calling `olive.telemetry.disable_telemetry()`. Each option suppresses every subsequent Olive telemetry event for the remainder of the process, including Olive workflow containers started by that process. When the opt-out is active before first telemetry use, Olive does not construct the telemetry singleton or create the telemetry queue, uploader, or persistent device identifier. Disabling at runtime stops this process's uploader, retains already queued unsent rows unchanged for a later telemetry-enabled process, and does not enqueue another Heartbeat. The environment variables accept `1`, `true`, `yes`, `on`, or `y` after trimming and without regard to case.

In CI/CD environments (e.g., GitHub Actions, Azure Pipelines, Jenkins), Olive suppresses the device-id heartbeat and the action/error events and only emits the `OliveRecipe` event. Any full opt-out takes precedence and sends nothing. The `OliveRecipe` event may include recipe metadata such as pass types, explicitly configured target settings, the host system type (including the default `LocalSystem` host) and any explicitly configured host accelerator settings, whether a custom package config was provided, a redacted snapshot of custom package-config overrides, and a redacted snapshot of explicitly supplied config overrides.

Telemetry is implemented using only the Python standard library. In enabled local runs, one `OliveHeartbeat` per process and detailed events are written to a local per-user SQLite queue before a background uploader sends them to Microsoft over HTTPS. Olive first reserves a minimal Heartbeat durably, then adds available operating-system metadata before making it eligible for upload; if enrichment is interrupted, the minimal Heartbeat remains eligible for a later delivery attempt. CI recipe events use a separate recipe-only queue and receive a bounded shutdown delivery attempt. Events that cannot be sent remain in the applicable queue for a later run. The transmitted `deviceId` is the `c:`-prefixed SHA-256 hash of a shared persistent UUID; the raw UUID is not transmitted.

### Event schemas

All events include Olive-assigned `appName`, `LibraryVersion`, and `AppSessionGuid` values that event callers cannot override; `initTs` is included when supplied by the caller. Olive emits only the following event-specific fields:

| Event | Fields |
| --- | --- |
| `OliveHeartbeat` | `deviceId`, `deviceIdStatus`; `os`, `osVersion`, `osRelease`, and `osArchitecture` when enrichment succeeds |
| `OliveAction` | `invokedFrom`, `actionName`, `durationMs`, `success` |
| `OliveError` | `exceptionType`, `exceptionMessage` |
| `OliveRecipe` | `recipeName`, `recipeHash`, `recipeSource`, `recipeFormat`, `recipeCommand`, `executionMode`, `workflowId`, `configOverrides`, `success`, `inputModelType`, `inputModelSource`, `modelTask`, `targetSystemType`, `targetDevice`, `targetExecutionProvider`, `targetExecutionProviders`, `hostSystemType`, `hostDevice`, `hostExecutionProvider`, `hostExecutionProviders`, `passTypes`, `passCount`, `dataConfigCount`, `searchEnabled`, `packageConfigProvided`, `packageConfigOverrides`, `isCI` |

Free-text values, paths, URLs, query secrets, credential-bearing configuration keys, environment-variable values, and nested configuration metadata are recursively redacted at the serialization boundary and capped at 40,960 UTF-8 bytes. `recipeHash` is computed only after credential, environment-value, and path redaction. Error messages may contain sanitized exception and frame metadata but never source-code lines.
156 changes: 155 additions & 1 deletion docs/source/features/quantization.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,161 @@ This pass supports ONNX models and can quantize `MatMul` and `Gather` nodes to 4
}
```

## PyTorch Native RTN

The `Rtn` pass applies RTN weight quantization directly to a PyTorch (Hugging Face) model, before any ONNX
export. Unlike `OnnxBlockWiseRtnQuantization` (which operates on an already-exported ONNX graph), `Rtn` runs on
the `HfModelHandler` and replaces the weight *storage* of quantizable parameters in place with a quantized
tensor representation, while keeping the surrounding modules (`nn.Linear` / `nn.Embedding`, and MoE experts)
otherwise unchanged. This lets you compose it with other PyTorch quantization passes (see the `Gptq` example
below) and share settings via per-module `overrides`.

By default `Rtn` quantizes `nn.Linear` weights and leaves the embeddings, the language-model head, and any
Mixture-of-Experts (MoE) experts at full precision. Three independent category flags opt those groups in:

| Flag | Default | Effect when `true` |
| --- | --- | --- |
| `lm_head` | `false` | Also quantize the language-model head. |
| `embeds` | `false` | Also quantize the input embeddings. |
| `moe` | `false` | Also quantize MoE expert weights: classic per-expert `nn.ModuleList` experts (e.g. Mixtral, PhiMoE on older `transformers`) are always supported, and fused-expert modules are supported whenever the resolved experts class reports `is_transposed=False` (the K-last `(E, OUT, K)` layout used by most fused-experts architectures). Architectures that store a transposed `(E, K, OUT)` layout, such as gpt-oss, are rejected. Architectures whose experts class does not report `is_transposed` at all -- either because it predates the `transformers` fused-experts refactor, or because it has not adopted it (e.g. llama4, aria) -- are also rejected, since Olive cannot independently verify their layout. |

The `moe` flag is **fail-closed**: when `moe` is `false`, every module under an experts subtree is skipped even
if it looks like a plain `nn.Linear`. If the model config indicates an MoE architecture but Olive cannot resolve
the experts subtree for that (unrecognized) architecture, the pass raises a clear error *before* modifying any
parameter, rather than silently quantizing the experts.

Only weight parameters are quantized. Fused expert 2D bias parameters, when present, remain in full precision.

### `moe` and ONNX export

MoE quantization in Olive is **storage-only**: Olive does not export 3D fused-expert `QuantTensor`s to ONNX.
Attempting to `torch.onnx.export` a model with 3D-quantized experts raises a clear error directing you to
Mobius / ORT GenAI `ModelBuilder` for the experts. Non-MoE parts (attention projections, router/gate,
embeddings, lm_head) still export through the existing `MatMulNBits` / `GatherBlockQuantized` path.

### `moe` and native PyTorch inference: force the `"eager"` experts implementation

`transformers` lets a loaded MoE model pick its runtime forward strategy independently of the
checkpoint's on-disk layout, via `model.set_experts_implementation(...)` / `config._experts_implementation`
(`"eager"`, `"grouped_mm"`, `"batched_mm"`, ...). Some non-`"eager"` strategies (e.g. `"grouped_mm"`, which
`transformers` may auto-select even on CPU) call `weight.transpose(-2, -1)` on the fused-experts weight
before dispatching to their matmul kernel. Because Olive's 3D fused-expert `QuantTensor` is storage-only
(see above) and cannot represent a transpose without a lossy unpack/re-quantize round trip, this raises a
`RuntimeError` at inference time -- even for architectures whose checkpoint layout (`is_transposed=False`)
is fully supported for quantization.

**Workaround**: after loading a `moe=True`-quantized checkpoint for native PyTorch inference (as opposed to
consuming it via Mobius / ORT GenAI `ModelBuilder`), force the eager path once, before running any forward
pass:

```python
model.set_experts_implementation("eager")
```

This is tracked as a follow-up in [#2619](https://github.com/microsoft/Olive/issues/2619).

### `modules_to_not_convert` and `overrides`

`modules_to_not_convert` lists module-name patterns to exclude entirely, and `overrides` maps module-name
patterns to per-module `{"bits", "symmetric", "group_size"}` settings. Both accept two key styles:

- **Plain strings** keep the existing Hugging Face semantics (substring match for `modules_to_not_convert`,
literal match for `overrides`).
- **`re:`-prefixed keys** are treated as regular expressions matched with `re.fullmatch` (e.g.
`"re:model\\.layers\\.\\d+\\.mlp\\..*"`).

For safety, `re:` patterns are validated before use: overly long patterns and patterns with nested unbounded
quantifiers (catastrophic-backtracking / ReDoS shapes such as `(a+)+`) are rejected with a clear error.

### Resolution order and override precedence

When multiple rules could apply to the same target, the **first** rule that matches wins, in this order:

1. `modules_to_not_convert` (hard exclude)
2. category flags (`lm_head` / `embeds` / `moe`) — hard excludes; `overrides` can never re-include what a
category flag skipped
3. `overrides`
4. pass-level defaults (`bits` / `group_size` / `sym`)

When several `overrides` entries match the same target, precedence is **insertion order in the config, first
match wins** — not "longest / most specific pattern". Order your `overrides` from most specific to least
specific accordingly.

### Example Configuration
```json
{
"type": "Rtn",
"bits": 4,
"group_size": 128,
"sym": false,
"embeds": true,
"moe": true,
"overrides": {
"re:.*\\.experts\\..*": { "bits": 4, "group_size": 32 }
}
}
```

### Composing with `Gptq`

`Rtn` can run on an already-quantized model, so you can quantize the transformer `nn.Linear` layers with a
calibration-based pass such as `Gptq` first, then cover the parts `Gptq` doesn't handle (embeddings, lm_head,
MoE experts) with `Rtn`:

```json
[
{ "type": "Gptq" },
{ "type": "Rtn", "moe": true, "embeds": true }
]
```

The reverse order is not supported: calibration-based passes assume a clean full-precision starting point and
will reject an already-quantized model.

### Migration note: removal of `QuantLinear` / `QuantEmbedding`

The previous `nn.Module` wrappers `olive.common.quant.nn.QuantLinear` and `QuantEmbedding` have been **removed**
as a sanctioned breaking change. Quantized weights are now stored as a `QuantTensor` on the parameter itself
rather than by swapping the parent module. **Checkpoints produced by the old `QuantLinear` / `QuantEmbedding`
classes cannot be reloaded through Olive's own HF quantizer** — this includes both:

- models persisted with `torch.save(model)` (pickling live `QuantLinear` / `QuantEmbedding` instances), and
- safetensors/state-dict checkpoints, since the buffer naming convention changed from bare `<module>.qweight` /
`.scales` / `.qzeros` to `<module>.weight_qweight` / `weight_scales` / `weight_qzeros`.

There is no migration shim for either case (consistent with every prior packing-format change to this module).
Re-run the `Rtn` pass on the original full-precision model to regenerate a checkpoint in the current format.

### 2-bit quantization is not exportable to ONNX

`Rtn` supports `bits` in `{2, 4, 8}` for the PyTorch quantized-checkpoint path, but the ONNX export-compat path
(`QuantLinearNbit`) only supports 4-bit and 8-bit packing. Attempting to export a 2-bit `QuantTensor` to ONNX
raises a clear `ValueError` at export time rather than silently producing an incorrect graph; 2-bit quantization
remains usable for PyTorch-only workflows.

## PyTorch Native KQuant

The `KQuant` pass is a calibration-free weight quantizer that applies llama.cpp's
iterative weighted-least-squares k-quant search to PyTorch (Hugging Face) model
weights. It supports the same `lm_head`, `embeds`, and `moe` category flags as
`Rtn`; all default to `false`.

With `moe=true`, classic per-expert `nn.ModuleList` layouts are supported, as are
fused expert weights whose experts module reports `is_transposed=false` (K-last
`(E, OUT, K)`). Transposed `(E, K, OUT)` layouts and fused implementations with a
missing or non-boolean `is_transposed` attribute are rejected rather than risking
quantization along the wrong dimension. Only direct 3D expert weight parameters
are quantized; expert biases remain in full precision.

```json
{
"type": "KQuant",
"bits": 4,
"group_size": 32,
"moe": true
}
```

## HQQ
`HQQ (Half-Quadratic Quantization)` is a fast, calibration-free weight quantization method that enables low-bit quantization of large models without relying on gradient-based optimization. Unlike data-dependent approaches like GPTQ, [HQQ](https://dropbox.github.io/hqq_blog/) uses half-quadratic splitting to minimize weight quantization error efficiently.

Expand Down Expand Up @@ -365,4 +520,3 @@ Configurations:
```

Please refer to [AimetQuantization](aimet_quantization) for more details about the pass and its config parameters.

Loading
Loading