Skip to content

recipe(ms-marco-MiniLM-L12-v2): add CPU fp32 and fp16 recipes#1170

Open
codykk wants to merge 1 commit into
mainfrom
yongyue/add-ms-marco-MiniLM-L12-v2-support
Open

recipe(ms-marco-MiniLM-L12-v2): add CPU fp32 and fp16 recipes#1170
codykk wants to merge 1 commit into
mainfrom
yongyue/add-ms-marco-MiniLM-L12-v2-support

Conversation

@codykk

@codykk codykk commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Add verified CPU recipes (fp32 + fp16) for cross-encoder/ms-marco-MiniLM-L12-v2, a BERT-based cross-encoder fine-tuned on MS MARCO for passage reranking. Effort L0, Goal L1 (build + perf), Outcome L0 (recipe only). Complements existing L4-v2 and L6-v2 recipes in the same cross-encoder family.

Model metadata

What the model does: Cross-encoder reranker that scores query-passage relevance for information retrieval, fine-tuned from MiniLM-L12 on the MS MARCO passage ranking dataset.

Primary user stories:

  • User supplies a query-passage pair to obtain a relevance score for passage reranking in search pipelines.

Supported tasks:

  • text-classification — Optimum vendor-supported (BertForSequenceClassification); winml resolves via TasksManager.

Model architecture:

BertForSequenceClassification
├── Embeddings (vocab 30522 x 384)
├── Encoder stack x 12
│   ├── Self-attention (12 heads, 384 dim)
│   ├── Feed-forward (384 → 1536 → 384, GELU)
│   └── Residual + LayerNorm
└── Classification head (384 → 1: relevance logit, Tanh)
  • Source/confidence: pinned checkpoint config.json (architectures: ["BertForSequenceClassification"], model_type: "bert") (verified).

Validation and support evidence

Baseline

  • main commit: 5deebd42 | winml: 0.2.0
  • Optimum probe: VENDOR-ONLY — text-classification registered by Optimum for bert; winml adds nothing.
  • Build: ✅ PASS (auto-config, no recipe) — AutoModelForSequenceClassification / text-classification
  • Perf: ✅ PASS — CPU avg 68.10 ms, 14.68 samples/sec
  • Goal floor: L1 (build + perf inherited from main)

Goal

  • Effort: L0 — recipe only, no source edits.
  • Goal ceiling: L1 — baseline already demonstrates L0 + L1.
  • Outcome: L0 — recipe + report.

Outcome

Highest reached: L1 PASS. Coverage: full. Deferred tuples: none.

Shipped recipes:

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

Per-EP/device/precision results

Tier EP / Device Precision Verdict Mean p50 Throughput RAM Δ
L0 CPUExecutionProvider / cpu fp32 PASS
L1 CPUExecutionProvider / cpu fp32 PASS 57.86 ms 57.67 ms 17.55 samples/sec +178.4 MB
L0 CPUExecutionProvider / cpu fp16 PASS
L1 CPUExecutionProvider / cpu fp16 PASS 8.43 samples/sec

Delta

Recipe delta vs winml config: identical — filed for verified cpu/cpu coverage. Production recipe README unchanged.

Analyze summary — component level and op level

Static rule analysis completed; this is compatibility analysis, not runtime execution.

Component-level summary

Artifact Architecture coverage Mapping Actionable EP findings
fp32 embeddings (3x Gather); 12x encoder attention/FFN (Gemm, MatMul, Softmax, Gelu, LayerNorm); classification heas (after autoconf: gelu_fusion, matmul_add_fusion) None actionable — CPU is rule-less

Op-level summary

Artifact Graph Dominant ops EP roll-up
fp32 388 ops / 16 types Reshape 120; Gemm 74; Transpose 48; Add 38; LayerNormalization 25; Mul 24; MatMul 24 CPU: all 16 types unknown (rule-less EP)

Rule-less EPs (CPU): all operator types classified as unknown — no runtime check rules available.

Reproduce commands

# fp32
winml build -m cross-encoder/ms-marco-MiniLM-L12-v2 `
  -c examples/recipes/cross-encoder_ms-marco-MiniLM-L12-v2/cpu/cpu/text-classification_fp32_config.json `
  -o $OUT --ep cpu --device cpu
winml perf -m $OUT/model.onnx --ep cpu --device cpu

# fp16
winml build -m cross-encoder/ms-marco-MiniLM-L12-v2 `
  -c examples/recipes/cross-encoder_ms-marco-MiniLM-L12-v2/cpu/cpu/text-classification_fp16_config.json `
  -o $OUT_FP16 --ep cpu --device cpu -p fp16
winml perf -m $OUT_FP16/model.onnx --ep cpu --device cpu

@codykk
codykk marked this pull request as ready for review July 22, 2026 12:12
@codykk
codykk requested a review from a team as a code owner July 22, 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