Skip to content

fix(models): make the MLperf Tiny exporters match the reference models - #24

Merged
runwangdl merged 1 commit into
develfrom
fix/mlperf-tiny-compliance
Sep 17, 2026
Merged

runwangdl merged 1 commit into
develfrom
fix/mlperf-tiny-compliance

Conversation

@runwangdl

Copy link
Copy Markdown
Collaborator

What

Three of the five MLperf Tiny benchmark exporters did not build the reference model. Checked against the int8 reference graphs already shipped in TrainDeeploy (Tests/Models/MLPerf/):

Benchmark Reference Before After
KWS DS-CNN, 1x49x13→12, 22,160 par 1x25x10, 2,732 par 1x49x10, 23,180 par, 2.657M MACs
AD Deep AE, 640→640, 10 Gemm, 265,106 par 128→128, 29,120 par 640→640, 267,928 par, 0.264M MACs
VWW MobileNetV1-0.25, 3x96x96→2, 209,126 par no exporter at all 213,586 par, 7.490M MACs
IC ResNet-8, 77,712 par 78,042 par unchanged ✅
— CCT-2/3x2 283,979 par unchanged ✅

Details

DS-CNN. The KWS export defaulted to the xs PULP variant. The registry already had a DSCNN-S entry, but its stem used valid padding and emitted a 20x4 map against the reference's 25x5 — the reference stem is Conv2D(64,(10,4),strides=2,padding='same'). Adds stem_padding="same", computed as the smallest symmetric padding reproducing Keras' output size so no separate Pad node appears. MACs go 1.701M → 2.657M, the published figure. The legacy xs default is untouched.

Autoencoder. The AD export was a 128-dim toy; the pre-existing mlperf variant (128→[128,128,128]→128) was not the reference either. Adds MLPerfADAutoencoder behind variant="mlperf_ad" and an Autoencoder-AD registry entry.

BatchNorm1d over an (N,C) tensor is undefined at N=1 — zero variance, and PyTorch refuses outright — but on-device training runs at batch 1. FrozenStatsBatchNorm1d keeps the layers and their learnable affine parameters and normalizes with randomized running statistics instead, so the training graph carries the reference's 9 BatchNormInternal + 9 BatchNormalizationGrad nodes and its parameter count.

MobileNetV1. The MLperf Tiny VWW reference is MobileNetV1-0.25, not the MobileNetV2-0.35 the registry described as such. There was no V1 exporter, so the mobilenetv1_train fixture deployed in TrainDeeploy could not be regenerated from this repo — even though README.md:185 and scripts/make_single_step.py:42 both use --model MobileNetV1 as an example. Module names match that fixture's parameters (stem_*, blocks_N_{dw,bn_dw,pw,bn_pw}_*, fc_*) so regenerated graphs stay drop-in.

Registry descriptions. DSCNN-S claimed ~270K params (it is ~23K); MobileNetV2-VWW claimed to be the MLperf VWW reference.

Testing

  • pytest tests/ → 154 passed, 4 skipped
  • Regenerating ResNet-8 reproduces the committed TrainDeeploy fixture node for node (114 nodes, identical op histogram, 78,042 params) — i.e. the toolchain is unchanged for models that were already correct.
  • All numbers above measured from the generated ONNX with onnxruntime-training==1.19.2 under the pinned versions.
  • black / isort clean; no new flake8 findings.

Follow-up (not in this PR)

The regenerated DS-CNN and Autoencoder fixtures still have to land in TrainDeeploy, where the DS-CNN graph is ~8x and the AE ~9x their previous size — test_gap9_tiled_config.py L1/L2 budgets will need re-tuning.

🤖 Generated with Claude Code

https://claude.ai/code/session_012vb2GVs3qbiyLV1KkV2baN

Three of the five benchmark exporters did not produce the MLperf Tiny
reference model. Checked against the int8 reference graphs the repos
already ship in TrainDeeploy (Tests/Models/MLPerf/).

DS-CNN. The KWS export defaulted to the "xs" PULP variant (16 channels,
25x10 MFCC, 2,732 params) where the reference is DS-CNN-S (64 channels,
49x10, ~24.9K). The registry already had a DSCNN-S entry, but its stem
used valid padding and emitted a 20x4 map against the reference's 25x5,
because the reference stem is Conv2D(64,(10,4),strides=2,padding='same').
Adds stem_padding="same" (symmetric padding computed to reproduce Keras'
output size, so no separate Pad node): 23,180 params, 2.657M MACs, which
is the published figure.

Autoencoder. The AD export was a 128-dim toy (128->64->32->64->...,
29,120 params). The reference is 640 -> 128x4 -> 8 -> 128x4 -> 640 with
BatchNorm on every hidden layer, ~268K params; the pre-existing "mlperf"
variant (128->[128,128,128]->128) was not it either. Adds
MLPerfADAutoencoder behind variant "mlperf_ad" and an Autoencoder-AD
registry entry: 267,928 params, 264,192 MACs, 10 Gemm.

BatchNorm1d over an (N,C) tensor is undefined at N=1 -- zero variance,
and PyTorch refuses outright -- but on-device training runs at batch 1.
FrozenStatsBatchNorm1d keeps the layers and their learnable affine
parameters and normalizes with randomized running statistics instead, so
the training graph carries the reference's 9 BatchNormInternal and 9
BatchNormalizationGrad nodes and its parameter count.

MobileNetV1. The MLperf Tiny VWW reference is MobileNetV1-0.25, not the
MobileNetV2-0.35 the registry described as such. There was no V1
exporter at all, so the mobilenetv1_train fixture deployed in
TrainDeeploy could not be regenerated from this repo, although
README.md and scripts/make_single_step.py both use "--model
MobileNetV1" as an example. Adds the model and its exporter, with
module names matching that fixture's parameters so regenerated graphs
stay drop-in: 213,586 params, 7.490M MACs.

Also corrects two registry descriptions that misstated what the entry
builds: DSCNN-S claimed ~270K params (it is ~23K), and MobileNetV2-VWW
claimed to be the MLperf VWW reference.

Verified with onnxruntime-training 1.19.2 under the pinned versions;
regenerating ResNet-8 reproduces the committed fixture node for node.
tests/: 154 passed, 4 skipped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vb2GVs3qbiyLV1KkV2baN
@runwangdl
runwangdl merged commit 8c3a6ff into devel Sep 17, 2026
22 checks passed
@runwangdl
runwangdl deleted the fix/mlperf-tiny-compliance branch September 17, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant