Skip to content

recipe(cross-encoder/ms-marco-MiniLM-L6-v2): add text-classification fp32/fp16 recipes#1120

Open
codykk wants to merge 1 commit into
mainfrom
yongyue/add-cross-encoder-ms-marco-MiniLM-L6-v2-recipe
Open

recipe(cross-encoder/ms-marco-MiniLM-L6-v2): add text-classification fp32/fp16 recipes#1120
codykk wants to merge 1 commit into
mainfrom
yongyue/add-cross-encoder-ms-marco-MiniLM-L6-v2-recipe

Conversation

@codykk

@codykk codykk commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Recipe-only contribution (Effort L0). Adds fp32 and fp16 recipe configs for
cross-encoder/ms-marco-MiniLM-L6-v2 (BertForSequenceClassification, task text-classification)
on two verified EP/device combinations: CPU and DML (GPU). Goal L1 (perf) PASS on all 4 configs.


1. Recipe path(s)

  • examples/recipes/cross-encoder_ms-marco-MiniLM-L6-v2/cpu/cpu/text-classification_fp32_config.json
  • examples/recipes/cross-encoder_ms-marco-MiniLM-L6-v2/cpu/cpu/text-classification_fp16_config.json
  • examples/recipes/cross-encoder_ms-marco-MiniLM-L6-v2/dml/gpu/text-classification_fp32_config.json
  • examples/recipes/cross-encoder_ms-marco-MiniLM-L6-v2/dml/gpu/text-classification_fp16_config.json

2. README row

N/A — README not modified in this PR. The model has not yet passed fp16 eval on all 10 (EP, device) buckets; only cpu/cpu and dml/gpu are verified.

3. Build output dir

  • temp/minilm_cpu_fp32/ (cpu/cpu fp32)
  • temp/minilm_cpu_fp16/ (cpu/cpu fp16)
  • temp/minilm_dml_fp32/ (dml/gpu fp32)
  • temp/minilm_dml_fp16/ (dml/gpu fp16)

4. Build log

All 4 configs completed successfully:

  • cpu/cpu fp32: ✅ Build complete in 20.1s (Export 4.4s, Optimize 15.2s)
  • cpu/cpu fp16: ✅ Build complete in 21.3s (Export 4.3s, Optimize 15.6s, FP16 0.8s)
  • dml/gpu fp32: ✅ Build complete in 19.9s (Export 4.3s, Optimize 15.0s)
  • dml/gpu fp16: ✅ Build complete in 20.6s (Export 4.3s, Optimize 15.0s, FP16 0.8s)

5. Appended findings

N/A — no model_knowledge/ or skill_meta/ entries added (recipe-only L0 contribution; skill repo is separate from this working repo).

6. Optimum-coverage probe

bert architecture is fully supported by Optimum's BertOnnxConfig and winml's BertIOConfig. No custom OnnxConfig needed. winml inspect confirms all components at "Default" status.

7. Claimed (Effort, Goal, Outcome)

Axis Tier
Effort L0 (recipe-only, no per-architecture code)
Goal L1 (build + perf)
Outcome L0 (recipe + report)

8. Goal-ladder verdict table

Tier Verdict Evidence
L0 (build) PASS All 4 configs (cpu/cpu fp32, cpu/cpu fp16, dml/gpu fp32, dml/gpu fp16) build successfully with winml build
L1 (perf) PASS All 4 configs produce valid latency/throughput numbers via winml perf (see item 10)
L2 (numeric vs PyTorch) N/A Not attempted (Goal ceiling = L1)
L3 (task metric) N/A Not attempted (Goal ceiling = L1)

9. Methodology-evolution declaration

No methodology friction observed during this contribution.

10. Perf & eval data

EP / Device Precision Verdict Mean p50 p90 Throughput RAM Δ VRAM Δ (local)
OpenVINOExecutionProvider / cpu fp32 PASS 21.110 ms 21.980 ms 24.710 ms 47.38 samples/s +195.70 MB
OpenVINOExecutionProvider / cpu fp16 PASS 21.440 ms 21.850 ms 25.760 ms 46.64 samples/s +196.00 MB
DmlExecutionProvider / gpu fp32 PASS 16.350 ms 15.920 ms 19.070 ms 61.16 samples/s +314.00 MB +184.80 MB
DmlExecutionProvider / gpu fp16 PASS 47.800 ms 46.470 ms 51.710 ms 20.92 samples/s +262.80 MB +107.80 MB
QNNExecutionProvider / npu * HOST-BLOCKED No NPU hardware available on test host

Model size: fp32 = 86.7 MB; fp16 = 43.4 MB (50% size reduction).

Note: DML fp16 is slower than fp32 on this model (47.8ms vs 16.4ms). This is a known characteristic of small models where fp16 conversion overhead on GPU outweighs the compute savings.

11. Component / op-level data

From winml analyze (post-optimization):

  • Total operators: 202 (after fusion)
  • Fusion patterns applied: gelu_fusion, matmul_add_fusion (autoconf converged in 2 iterations)
  • Model architecture: 6 hidden layers, 12 attention heads, hidden size 384
  • Artifact: temp/minilm_cpu_fp32/analyze_result.json

12. Reproducible commands

# Build (cpu/cpu fp32)
winml build -c examples/recipes/cross-encoder_ms-marco-MiniLM-L6-v2/cpu/cpu/text-classification_fp32_config.json -m cross-encoder/ms-marco-MiniLM-L6-v2 -o temp/minilm_cpu_fp32

# Build (cpu/cpu fp16) — --precision fp16 required to override auto-precision when --device is passed
winml build -c examples/recipes/cross-encoder_ms-marco-MiniLM-L6-v2/cpu/cpu/text-classification_fp16_config.json -m cross-encoder/ms-marco-MiniLM-L6-v2 -o temp/minilm_cpu_fp16 --precision fp16

# Build (dml/gpu fp32)
winml build -c examples/recipes/cross-encoder_ms-marco-MiniLM-L6-v2/dml/gpu/text-classification_fp32_config.json -m cross-encoder/ms-marco-MiniLM-L6-v2 -o temp/minilm_dml_fp32 --ep dml --device gpu

# Build (dml/gpu fp16) — --precision fp16 required to override auto-precision when --device is passed
winml build -c examples/recipes/cross-encoder_ms-marco-MiniLM-L6-v2/dml/gpu/text-classification_fp16_config.json -m cross-encoder/ms-marco-MiniLM-L6-v2 -o temp/minilm_dml_fp16 --ep dml --device gpu --precision fp16

# Perf (cpu fp32)
winml perf -m temp/minilm_cpu_fp32/model.onnx --device cpu --iterations 20

# Perf (cpu fp16)
winml perf -m temp/minilm_cpu_fp16/model.onnx --device cpu --iterations 20

# Perf (dml/gpu fp32)
winml perf -m temp/minilm_dml_fp32/model.onnx --device gpu --ep dml --iterations 20

# Perf (dml/gpu fp16)
winml perf -m temp/minilm_dml_fp16/model.onnx --device gpu --ep dml --iterations 20

@codykk codykk marked this pull request as ready for review July 16, 2026 03:40
@codykk codykk requested a review from a team as a code owner July 16, 2026 03:40
…MiniLM-L6-v2

Recipe-only contribution. Adds fp32 and fp16 recipe configs for
cross-encoder/ms-marco-MiniLM-L6-v2 (BertForSequenceClassification)
on two verified EP/device combinations: cpu/cpu and dml/gpu.

Goal ladder (verified on local hardware):
- L0 (build): PASS on all 4 configs
- L1 (perf):
  - cpu/cpu fp32: 21.11ms avg, 47.38 samples/s, 86.7MB
  - cpu/cpu fp16: 21.44ms avg, 46.64 samples/s, 43.4MB (50% size reduction)
  - dml/gpu fp32: 16.35ms avg, 61.16 samples/s
  - dml/gpu fp16: 47.80ms avg, 20.92 samples/s
@codykk codykk force-pushed the yongyue/add-cross-encoder-ms-marco-MiniLM-L6-v2-recipe branch from 9498c12 to 91a818c Compare July 16, 2026 04:11
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