Add documentation and example of arbitrary QAT flow used with recipe-based export. - #22408
Open
MartinPavella wants to merge 1 commit into
Conversation
MartinPavella
requested review from
JakeStevens,
novak-vaclav,
rascani,
robert-kalmar and
roman-janik-nxp
September 1, 2026 12:29
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22408
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New Failures, 2 Unrelated FailuresAs of commit 993330f with merge base a822ab2 ( NEW FAILURES - The following jobs have failed:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
This PR needs a
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a runnable example and documentation showing how to run an arbitrary Quantization-Aware Training flow in the middle of the declarative export recipe, by splitting the recipe around the
QUANTIZEstage.The declarative
ExportRecipe/ExportSessionpath runs the whole pipeline as oneexport()call, which is fine for simple calibration but cannot host complex QAT — real training runs involve iterative loops, checkpointing, job restarts, validation-accuracy evaluation, rollback on regression, and possibly separate machines. The recipe'spipeline_stagesattribute is used to run the pre-quantize stages, hand the graph off to an out-of-band QAT flow as a.pt2, and resume the recipe fromTORCH_EXPORTonward.New example under
examples/export/qat_pipeline_split/: four independently-invokable stages driven byrun.sh.1_prepare.pycaptures up to the quantize boundary,2_qat.pyprepares withprepare_qat_pt2eand does a stand-in train + checkpoint round-trip beforeconvert_pt2e,3_lower.pylowers tomodel.ptevia the recipe, and4_run.pyruns the.ptethrough the runtime. Each stage asserts its own invariants, so the example doubles as a smoke test.The example shows one method with optional simplifications: the full split sets
pipeline_stagesexplicitly on both halves, while the simplified path skips the pre-quantize slice and lets the recipe auto-skipSOURCE_TRANSFORM/QUANTIZE/TORCH_EXPORTforExportedPrograminput (default pipeline only).New doc
docs/source/using-complex-qat-flows-with-recipe-based-lowering.md, registered in theusage.mdtoctree and cross-linked fromquantization-overview.md.using-executorch-export.mdwas left untouched since it documents only the imperative API.Authored with Vero Code.
cc @mergennachin @nil-is-all @iseeyuan @lucylq @helunwencser @tarun292 @kimishpatel @jackzhxng