Skip to content

Preserve BatchNorm running state in composable quantizer#21056

Open
denizkilinc wants to merge 1 commit into
pytorch:mainfrom
denizkilinc:export-D112989631
Open

Preserve BatchNorm running state in composable quantizer#21056
denizkilinc wants to merge 1 commit into
pytorch:mainfrom
denizkilinc:export-D112989631

Conversation

@denizkilinc

@denizkilinc denizkilinc commented Jul 21, 2026

Copy link
Copy Markdown

Summary:
Quantization-aware training with the composable PatternQuantizer incorrectly observed BatchNorm affine parameters and running-state buffers as activation inputs. The inserted fake-quant nodes broke the connection between aten.batch_norm.default and the registered running_mean and running_var buffers, so training used batch statistics while evaluation consumed stale running statistics.

Keep aten.batch_norm.default arguments 1-4 directly connected to registered state by excluding them from activation observation while retaining activation and output quantization. Add Arm and Sleep/ModAI regression tests that verify the state operands remain registered and the running statistics update during QAT.

Differential Revision: D112989631

@denizkilinc
denizkilinc requested a review from digantdesai as a code owner July 21, 2026 08:52
@pytorch-bot

pytorch-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21056

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 1 New Failure, 1 Cancelled Job, 1 Unrelated Failure

As of commit b0fcdc3 with merge base 667c91b (image):

NEW FAILURE - The following job has failed:

CANCELLED JOB - The following job was cancelled. Please retry:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 21, 2026

Copy link
Copy Markdown

CLA Not Signed

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 21, 2026
@meta-codesync

meta-codesync Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@denizkilinc has exported this pull request. If you are a Meta employee, you can view the originating Diff in D112989631.

@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels Jul 21, 2026
@pytorch-bot

pytorch-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@denizkilinc

Copy link
Copy Markdown
Author

/easycla

@denizkilinc
denizkilinc force-pushed the export-D112989631 branch 3 times, most recently from fc10724 to 7b0a3ba Compare July 21, 2026 13:39
Summary:
Quantization-aware training with the composable `PatternQuantizer` incorrectly observed BatchNorm affine parameters and running-state buffers as activation inputs. The inserted fake-quant nodes broke the connection between `aten.batch_norm.default` and the registered `running_mean` and `running_var` buffers, so training used batch statistics while evaluation consumed stale running statistics.

Keep `aten.batch_norm.default` arguments 1-4 directly connected to registered state by excluding them from activation observation while retaining activation and output quantization. Add Arm and Sleep/ModAI regression tests that verify the state operands remain registered and the running statistics update during QAT.

Differential Revision: D112989631

@rascani rascani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but you'll need to sign EasyCLA. Let me know if you need any help with that.

@denizkilinc

Copy link
Copy Markdown
Author

@rascani thank you for the review. I signed EasyCLA, now waiting for approval. If don't get approval today, I'll let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported module: arm Issues related to arm backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants