Add mxbai reranking recipes and exact FP16 boundary exclusions - #1354
Conversation
Independent post-PR review: REQUEST_CHANGESReviewed exact head Blocking findings
Independently verified
This is a fixable evidence/shipment return, not a rejection of the implementation. I made no review-state mutation, thread reply/resolution, body/title/label/readiness/base change, or branch push. |
Independent post-PR review: APPROVEReviewed exact head Final gates
Exact-SHA checks
Workflow runs are exact-head successes: CodeQL Opinion: APPROVE. Full reviewer checklist coverage is green with no deferred item. The PR intentionally remains DRAFT; this opinion does not authorize or perform a readiness change. I made no GitHub review-state mutation, metadata/body/base/branch change, thread reply/resolution, or other PR write beyond this one normal comment. |
Summary
This contribution adds canonical CPU fp32/fp16 reranking support for
mixedbread-ai/mxbai-rerank-base-v1, an English cross-encoder that scores query-document pairs with one raw relevance logit. The re-issued charter shipped at EffortL1with planned OutcomeL1: two task-canonical recipes plus a shared, opt-in exact-node FP16 conversion fix. Tester validation reached the full Goal ceiling,L3 PASS, on final candidateec130eaaf71bce478ca0792afc0c19e9c1ffd614with full coverage and no deferred tuples.Depends on #1322. Closes #1353.
Model metadata
What the model does
An English cross-encoder reranker that jointly tokenizes one query-document pair and emits one raw relevance logit used to order candidate documents for search (
verified). The pinned model card demonstratesCrossEncoder.rank(query, documents), Hub metadata declarespipeline_tag=text-ranking, and the pinned config declaresDebertaV2ForSequenceClassificationwithnum_labels=1.Primary user stories
verified).Supported tasks
rerankingon checkpoint, Transformers, and WinML surfaces (verified): pinned Hub metadata reportstext-ranking, the one-label Transformers head emits one logit, and dependency #1322 maps text-ranking to canonical reranking and provides the evaluator surface.text-classificationon Transformers, Optimum ONNX, and WinML surfaces (verified): current-main inspection resolves the stock sequence-classification head and the Optimum vendor registry covers DeBERTa-v2 text classification.Model architecture
DebertaV2ForSequenceClassificationin Transformers 5.14.1 (verified).Validation and support evidence
Baseline
main:774dd6e0811f6947eaf2bd8fb721d5f6e718b0c0. The baseline used the WinML CLI 0.3.0 source tree; the source-only runtime reported0.0.1.dev0because an editable install was skipped.mainis nowe28b128f5c2f69ecb2d73b63d2aea0a5ee8bddd0; the measured baseline evidence remains honestly anchored to774dd6e0811f6947eaf2bd8fb721d5f6e718b0c0. The complete old-to-current-main diff is one modified file,src/winml/modelkit/models/hf/vision_encoder_decoder.py. Its composite VisionEncoderDecoder-only change has no import, registration, dependency, recipe, workflow, or runtime reach into this DeBERTa-v2 encoder-only reranking contribution, shared quantization/FP16, CPU execution, parity, Eval, Analyze, or quality gates. Planner therefore sealedREUSEwith an empty invalidation closure: config, build, perf, parity, eval, analyze, and quality-gate stages were reused and no stage was rerun. Virtual merge comparison proves candidate patch equivalence: all 11 candidate-owned source, recipe, and test blobs are unchanged, with no overlap with the moved-main file; the candidate remains exact SHAec130eaaf71bce478ca0792afc0c19e9c1ffd614on its authorized dependency base and no rebase or candidate change is required.text-classificationwithDebertaV2OnnxConfig. Auto-config passed with opset 17, batch 1, sequence length 512,input_ids:int32[1,512],attention_mask:int32[1,512],logits, andtransformers_attention=eager.90.6 s: 804 ONNX nodes, co-located external data of627425280bytes, and a loadable graph.448.001 ms, p50450.468 ms, p90471.502 ms, throughput2.23 samples/s, RSS total delta326.29 MB, and RSS checkpoint peak1187.61 MB.EXPECTED_UNSUPPORTED_TASK: current main resolved requested reranking and rejected it because reranking was absent from supported evaluators. Source-only analyze exited 2 withEXACT-ENVIRONMENT-INCOMPATIBILITYbecause packaged rule parquet files were unavailable; component and ONNX evidence were captured independently.VENDOR-ONLYfor DeBERTa-v2. Vendor tasks were feature extraction, fill mask, multiple choice, question answering, text classification, and token classification; WinML added no tasks, and aliasdeberta_v2was unregistered.Goal
L0, GoalL3, planned OutcomeL0forcpu/cpu/fp32andcpu/cpu/fp16.L1, GoalL3, planned OutcomeL1. Recipe-only repair was exhausted when the fp16 graph could not load; the bounded shared FP16 config/pass/converter capability and focused regressions required an L1 code fix. The Goal ceiling was preserved, not downgraded.Outcome
L3.L3 PASS.full.[]).reranking_fp32_config.jsonandreranking_fp16_config.json.quant/config.py,quant/fp16.py, andquant/passes/fp16.py, with focused config, converter, pass, and recipe regressions.deberta-003,deberta-004,deberta-005,deberta-006,deberta-007,deberta-008, anddeberta-009; existingdeberta-001anddeberta-002were preserved. No skill/meta finding or Lane A PR was required.NO_STEP_4B_TRIGGER_1_THROUGH_8;local_friction_observed=true. Reason: "The run had overt PowerShell encoding, dependency hydration, artifact recovery, validator, and immutable-root harness friction, but none was a qualifying CLI-flag discovery, doc-code drift, successful-but-wrong output, genuinely missing verdict vocabulary, reviewer-identified contract gap, effort mis-estimate, PR-mined behavior, or Goal under-reach. The provisional ENVIRONMENT-BLOCKED-BEFORE-L0 row was already representable as HOST-BLOCKED and was not institutionalized as a new verdict."Per-EP/device/precision results and Functional smoke Eval
627425280payload bytes, and initializersFLOAT16=5,FLOAT=223,INT64=16. fp16 has 926 nodes,437262336payload bytes, initializersFLOAT16=228,INT64=16, and all 74 frozen boundaries.input_idsandattention_mask. fp32: cosine0.9999999999999999, max absolute0.0, mean absolute0.0, PyTorch order[0,1], ONNX order[0,1], ranking agreementtrue. fp16: cosine0.9999999153288317, max absolute0.00390625, mean absolute0.001953125, PyTorch order[0,1], ONNX order[0,1], ranking agreementtrue.Functional smoke Eval: final candidate
ec130eaaf71bce478ca0792afc0c19e9c1ffd614,CPUExecutionProvider/cpu, fp32 only. The tester-owned deterministic MS MARCO-style query/document group used splitsynthetic-bounded-functional-smoke: one English query, one relevant document, and one irrelevant document. It selected and processed 1 sample / query group and processed exactly 2 query-document pairs with seed 0. Fan-out caps were 2 candidate documents, 1 beam, and sequence length 512. Schema, label semantics, and prediction semantics were all verified; each prediction is one raw relevance logit sorted descending. The relevant document ranked first, producingMRR@2=1.0.This is end-to-end operability evidence only. It is not representative accuracy or a benchmark-quality claim. Current-main reranking eval was formerly unsupported; dependency #1322 supplies canonical reranking task/evaluator semantics, while this bounded Tester smoke verifies final-candidate scalar-score fan-out and ranking behavior.
Delta
Recipes
examples/recipes/mixedbread-ai_mxbai-rerank-base-v1/cpu/cpu/reranking_fp32_config.jsonandreranking_fp16_config.json; deleted the parallel historicaltext-classification_fp32_config.jsonandtext-classification_fp16_config.jsonso this checkpoint has one canonical user-facing task./loader/taskfrom"text-classification"to"reranking",/loader/model_classfrom"AutoModelForSequenceClassification"to"DebertaV2ForSequenceClassification",/optimfrom{"clamp_constant_values":true}to{}, and add/export/compatibility/transformers_attention = "eager";/loader/model_typeremains"deberta-v2"./quant = null. The fp16 recipe changes/quantfromnullto an fp16 configuration with/quant/mode = "fp16",/quant/task = "reranking",/quant/model_id = "mixedbread-ai/mxbai-rerank-base-v1",/quant/model_type = "deberta-v2",/quant/fp16_keep_io_types = true,/quant/fp16_op_block_list = null, and/quant/fp16_nodes_to_excludeequal to the exact ordered 74-name graph-derived list.1 + (12 x 6) + 1 = 74: embeddings LayerNormInsertedPrecisionFreeCast_/deberta/embeddings/LayerNorm/LayerNormalization_output_0; for every encoder layer0..11, exactlyTranspose_3,Reshape_1,Reshape_3,Transpose_8,Reshape_5, andReshape_13underInsertedPrecisionFreeCast_/deberta/encoder/layer.<layer>/attention/self/<boundary>_output_0; and poolerInsertedPrecisionFreeCast_/pooler/Gather_output_0.InsertedPrecisionFreeCast_/deberta/embeddings/Cast_output_0is deliberately absent because it is INT32-to-FLOAT, not FP16-to-FLOAT.Shared code and reducibility
WinMLQuantizationConfig.fp16_nodes_to_excludeis an optional exact-name list. It validates a list of non-empty strings, de-duplicates stably in declaration order, serializes only for fp16 mode, and participates in cache identity for distinct non-empty lists; absent and null remain equivalent.FP16Pass.runforwards the list unchanged toconvert_to_fp16(node_block_list=...).convert_to_fp16forwards the same list to both normal anddisable_shape_infer=TrueORT conversion calls._validate_converted_types(..., required=False)is the bounded input capability preflight. Strict-capable inputs require the same checker/strict-inference/checker sequence after conversion; onlyAttributeError,EncodeError,checker.ValidationError, andshape_inference.InferenceErrormay disable that generic converted-model sequence. Specialized external-data, sparse, container, initializer-output, topological, blocked-subgraph, and local-function safeguards remain active.Bug fix explanation
LayerNormalizationbecause the emittedtensor(float16)did not match the retainedtensor(float)contract.node_block_list, but WinML did not expose it through config or the FP16 pass.fp16_op_block_list=[LayerNormalization]cannot control the separate Cast, and broad Cast blocking would alter unrelated INT32-to-FLOAT and ordinary FP16 conversion semantics. Conditional strict validation also allowed an ordinary top-level type mismatch to survive until session creation.WinMLQuantizationConfig.fp16_nodes_to_exclude,FP16Pass.run,convert_to_fp16, and_validate_converted_typesadd exact-list validation/serialization/cache identity, unchanged normal/fallback forwarding, and bounded strict pre/post validation. The fp16 recipe supplies the 74 exact ONNX node names.nodes_to_exclude,fp16_op_block_list, andfp16_keep_io_typessemantics are unchanged. The intentional changes are exact-node preservation for recipes that opt in and earlier failure for incompatible strict-capable converted graphs.All checks passed!); mypy PASS (Success: no issues found in 438 source files). Five pytest partitions passed: analyze1526 passed, 45 skipped; models1534 passed, 6 skipped, 2 xfailed; optim858 passed, 16 skipped, 1 xfailed; commands3645 passed, 9 skipped; remaining871 passed, 2 skipped, 1 deselected. Aggregate:8434 passed,78 skipped,3 xfailed,1 deselected. Exact selected/neighbor/unknown-name, normal/fallback forwarding, capability-exception, strict mismatch, no-mutation, recipe-list, cache, and specialized-safeguard regressions are included in the changed tests. Feature-gap tracking is #1353.Analyze summary - component level and op level
Static analysis completed with
ANALYZE-PARTIAL-SUCCESS:winml analyze --ep allexited 1 because some targets had no rule data, while seven EP rows and complete rule-backed classifications were parsed. This is static compatibility analysis, not runtime execution.Component-level summary
mapped-with-gapsGatherElements,Erf; unsupported noneThe unresolved mapping gap is exactly 186 graph-root/generated nodes that lack a frozen semantic scope.
Op-level summary
GatherElements,Erf, unsupported none; no EP group was classified fully supported because rule-backed Cast remained unknown; targets without rule data produced no classificationReproduce commands