recipe(ms-marco-MiniLM-L2-v2): add CPU reranking recipes - #1344
Draft
ssss141414 wants to merge 1 commit into
Draft
Conversation
Contributor
Author
Independent reviewer verdict: APPROVEReviewed SHA: Stacked dependency: PR #1322 branch Coverage and engineering judgment
Independent evidence checks
Quality, checks, and threads
Blockers: none. This approval is full reviewer-contract coverage for the two reachable fp32/fp16 CPU tuples. It does not authorize changing the PR from draft. |
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
This adds CPU fp32 and fp16 reranking recipes for
cross-encoder/ms-marco-MiniLM-L2-v2, an English cross-encoder that emits one raw relevance logit per query-document pair. The shipped Effort and Outcome are L0, stacked on the generic reranking capability owned by dependency PR #1322. Candidate evidence reaches L3 PASS with full CPU fp32/fp16 coverage through L2 and a final-SHA fp32 CPU SciDocs L3 functional smoke.Model metadata
What the model does
An English cross-encoder passage reranker that jointly encodes one query-document pair and emits one raw scalar relevance logit; candidates are ordered by decreasing logit without softmax, sigmoid, or instruction prefixes.
BertForSequenceClassification,num_labels=1, and Identity as the SentenceTransformers cross-encoder activation; the exact-main ONNX build exposes float32 logits with shape[1,1]. Confidence:verified.Primary user stories
verified.mapped.Supported tasks
rerankingon the checkpoint and Transformers surfaces. Evidence: Hugging Facepipeline_tag=text-ranking, the pinned model-card pair-scoring example, andAutoModelForSequenceClassificationloading the pinned single-logit checkpoint. Confidence:verified.text-classificationon the Transformers, Optimum ONNX, and WinML surfaces. Evidence: the Optimum probe lists BERT text-classification as vendor support, and exact-main WinML inspect and recipe-free build resolve text-classification. Confidence:verified.Model architecture
BertForSequenceClassificationarchitecture, plus exact-main HTP metadata establishing 15,615,745 parameters, 51 modules, 19 traced modules, twoBertLayerchildren, and 131/131 tagged ONNX nodes (verified).Validation and support evidence
1. Baseline
main:0876e5ae1c98a169a6137e092e0d7b30bf9cee33.0.0.1.dev0.BertForSequenceClassification/text-classification, opset 17, with three INT32[1,512]inputs and FLOAT logits[1,1]; 15,615,745 parameters and 131/131 HTP nodes tagged. Build completed in12.8s(8.2sexport; the CLI also reported3.6soptimize despite the requested stage-bypass flag) and produced a 62,495,600-byte model.22.97 ms, p5022.38 ms, p9028.67 ms, p9530.83 ms, p9936.60 ms, min16.53 ms, max36.60 ms, throughput43.54 samples/s; RAM665.9 MBbefore and+79.2 MBinference/total.text-rankingandrerankingboth exit 2 as unsupported on main. On dependency PR Add WinML reranking support for cross-encoder/ms-marco-MiniLM-L6-v2 #1322, both aliases are byte-equivalent and differ from main auto-config only at/loader/task.rerankingEval exits 1 on main and emits no metric.VENDOR-ONLY. Vendor support includesfeature-extraction,fill-mask,multiple-choice,question-answering,text-classification, andtoken-classification; WinML adds no task. BERT sequence-classification export is vendor-covered, while PR Add WinML reranking support for cross-encoder/ms-marco-MiniLM-L6-v2 #1322 supplies canonical reranking semantics.2. Goal
3. Outcome
The shipped Outcome is L0: exactly two model-specific CPU reranking recipes declare verified fp32 and fp16 support. The highest reached Goal verdict is L3 PASS on final candidate
518dbc8c270e47ef3dfcfbd4c8218ba2d067ddcc, with full required-tuple coverage and no deferred tuples. Both CPU precision tuples pass L0-L2; L3 is the final-SHA fp32 CPU functional smoke only.The candidate is exactly one two-recipe commit whose parent is dependency SHA
3708969b731425b0c6d4b97920d1b5e6519bb013, the verified head of draft PR #1322. PR #1322 owns generic reranking task resolution, inference/evaluator dispatch, grouped dataset handling, and ranking metrics. This contribution is stacked on that dependency branch and does not claim to be based directly on currentmain; it must be restacked if #1322 changes.Exact-candidate quality gates passed: license PASS; Ruff
All checks passed!; mypySuccess: no issues found in 438 source files; focused regressions111 passed; analyze partition1526 passed, 45 skipped; models partition1534 passed, 6 skipped, 2 xfailed; optim partition848 passed, 16 skipped, 1 xfailed; commands partition3641 passed, 9 skipped, 1 warning; remaining partition871 passed, 2 skipped, 1 deselected.Learner findings
bert-017throughbert-023retain the resolved configuration, exact HTP profile, 76-operator/16-type analysis, artifact identities and I/O, CPU perf, raw-logit parity/order, and final-SHA SciDocs smoke. These are separate Lane A knowledge changes ine365af419859f287fd37e9a8631637f57437f46b(compare); no Lane A file is included in this model PR. The learner audit reports no methodology friction, no new contract gap, no new verdict shape, and no methodology finding or additional Lane A methodology commit required.4. Per-EP/device/precision results and Functional smoke Eval
input_ids,attention_mask, andtoken_type_idsare INT32[1,512]; FLOATlogitsare[1,1]; sample logit-11.001389503479004.-11.003010749816895; fp16/fp32 size ratio0.5002453777666285.55.468 msin addition to the table values.84.476 msin addition to the table values.[8.510398864746094, -4.8600850105285645, -11.681105613708496]; cosine0.999999999999931; max absolute difference0.000005245208740234375; reference and ONNX descending order[0,1,2].[8.50883960723877, -4.857270240783691, -11.681852340698242]; cosine0.9999999796576001; max absolute difference0.0028095245361328125; reference and ONNX descending order[0,1,2].[8.510400772094727, -4.860079765319824, -11.681106567382812]for the three frozen query-document pairs. Both precisions used namedattention_mask,input_ids, andtoken_type_ids, applied no score transform, and preserved descending relevance order.Functional smoke Eval: L3 PASS on final candidate
518dbc8c270e47ef3dfcfbd4c8218ba2d067ddcc, FP32 CPU, usingmteb/scidocs-reranking, splittest, pinned revision56a6d0140cf6356659e2a7c1413286a774468d44. Deterministic first-N streaming selection used no shuffle (recorded seed42) and selected/processed 2/2 groups, skipped 0, expanded/processed 20/20 pairs, and found 0 groups without a positive. Caps were 2 groups, 10 candidates per group, 20 total pairs, and sequence length 512; the candidate-label/prompt cap was 10, while beam and frame/crop caps were not applicable. Thequery,positive[], andnegative[]schema was verified; positives map to relevance 1 and negatives to 0; exactly one raw float logit is emitted per pair and higher logits rank first without softmax, sigmoid, label mapping, normalization, or instruction transforms. MRR@10 =0.75, Recall@1 =0.5, and Recall@10 =1.0. This proves end-to-end operability only and is not representative accuracy or benchmark quality. No fp16 or accelerator Eval claim is made. The former blocker was main's unsupportedrerankingtask; PR #1322 supplies canonical task normalization, paired-input inference, the raw scalar-logit evaluator, grouped-text adaptation, and MRR/Recall metrics.5. Delta
The candidate diff against its exact dependency parent contains only these two added files:
examples/recipes/cross-encoder_ms-marco-MiniLM-L2-v2/cpu/cpu/reranking_fp16_config.jsonexamples/recipes/cross-encoder_ms-marco-MiniLM-L2-v2/cpu/cpu/reranking_fp32_config.json/loader/tasktext-classificationreranking/quantnullnull/loader/tasktext-classificationreranking/quant/modefp16/quant/fp16_keep_io_typestrueParsed JSON and
WinMLBuildConfigschema semantics pass. Dependencytext-rankingandrerankinggenerated configs are byte-equivalent; dependency auto-config equals current-main default after changing only/loader/taskfromtext-classificationtoreranking. The fp16 precision block realizes true FP16 while preserving FLOAT I/O. Omitted compatibility and optimization fields materialize to the established defaults, including opset 17, hierarchy tags, GELU fusion, and MatMul-Add fusion.The recipes are identical to the approved L6/L12 family shape apart from the model path and precision realization:
AutoModelForSequenceClassification, model typebert, reranking task, three named INT32[1,512]inputs with ranges[0,30522],[0,2], and[0,2], and onelogitsoutput. Recipe-free dependency-head acceptance for both task aliases passes. The delta is reducibility-consistent with the charter, changes no source or tests, and does not duplicate dependency-owned generic behavior. The production recipe README is untouched.6. Analyze summary - component level and op level
Static rule analysis completed as
ANALYZE-PARTIAL-SUCCESSwith analyze exit code 1; the summarizer ran afterward and semantic validation succeeded. This is static compatibility analysis, not runtime execution.Component-level summary
mappedThe unresolved mapping gap is 27 root/helper nodes not attributable to one frozen semantic component; repeated encoder layers are collapsed above.
Op-level summary
OP/ai.onnx/Gather; no unsupported type reportedComplete seven-EP static classifications:
These are complete static classifications, not non-CPU runtime support claims.
7. Reproduce commands