recipe(multilingual-e5-small): add CPU fp32/fp16 feature-extraction and sentence-similarity recipes#1182
Open
DingmaomaoBJTU wants to merge 1 commit into
Open
recipe(multilingual-e5-small): add CPU fp32/fp16 feature-extraction and sentence-similarity recipes#1182DingmaomaoBJTU wants to merge 1 commit into
DingmaomaoBJTU wants to merge 1 commit into
Conversation
…nd sentence-similarity recipes intfloat/multilingual-e5-small is a BertModel sentence embedder. The default build fails at quantize (calibration reader omits token_type_ids); these quant:null float recipes skip that step and build a working float model. L2 PyTorch-vs-ONNX embedding cosine 1.000000, retrieval ranking preserved. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Collaborator
Author
|
APPROVE coverage: partial Checklist evidence:
Residual note: the |
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
Adds curated CPU float recipes for
intfloat/multilingual-e5-small— a multilingualBertModelsentence embedder (E5) used for retrieval / semantic similarity (configmodel_type = bert,architectures = [BertModel], hidden 384, vocab 250037,type_vocab_size = 2→ hastoken_type_ids). Ships fp32 + fp16 for both feature-extraction and sentence-similarity undercpu/cpu/(allquant: null; no CPU quantized variant per repo convention).This is not a catalog clone: the default
winml build(no recipe) FAILS at quantize for this model — the static-quant calibration reader feeds onlyinput_ids+attention_mask, soquantize_staticraisesValueError: Required inputs (['token_type_ids']) are missing. Thequant: nullfloat recipes skip that broken pass and build a working float model, and add an L2 numeric + retrieval-ranking parity proof that the trained embedding head is preserved end-to-end. Claimed tiers: Effort L0★ · Goal ceiling L2 · Outcome L0.1. Recipe path(s)
examples/recipes/intfloat_multilingual-e5-small/cpu/cpu/feature-extraction_fp32_config.jsonexamples/recipes/intfloat_multilingual-e5-small/cpu/cpu/feature-extraction_fp16_config.jsonexamples/recipes/intfloat_multilingual-e5-small/cpu/cpu/sentence-similarity_fp32_config.jsonexamples/recipes/intfloat_multilingual-e5-small/cpu/cpu/sentence-similarity_fp16_config.jsonPer task, fp32 and fp16 are byte-identical (git blob OID
49f99b77…for feature-extraction,cda4592e…for sentence-similarity;quant: nullfloat bucket — on CPU both realize as fp32, fp16 materializes on GPU/NPU). opset 17, batch 1, inputsinput_ids[1,512]+attention_mask[1,512]+token_type_ids[1,512](all int32), outputlast_hidden_state[1,512,384].2. README row
None. Recipe-only, CPU-only — deliberately not added to the "passes fp16 eval on all 10 (EP, device) buckets" table, which would overclaim for a CPU-only recipe (consistent with #1084 / #1112 / #1117 / #1170).
3. Build output dir
temp/e5_fe/(feature-extraction) andtemp/e5_ss/(sentence-similarity) — scratch, gitignored.model.onnx+model.onnx.data(448.25 MB float).4. Build log
✅ Build complete in 109.4s(Export 50.5 + Optimize 58.0; no quantize —quant: null).✅ Build complete in 98.3s(same graph, outputlast_hidden_state[1,512,384]).5. Appended findings
model_knowledge/bert.json→ new family file,bert-001(baseline quantize-fails → quant:null fix; E5token_type_idsgotcha; L2 parity numbers). Lane A (skill repo); not part of this model PR's diff.6. Optimum-coverage probe
bertfeature-extractionis VENDOR-ONLY (added_by_winml = []; vendor onnx tasks[feature-extraction, fill-mask, multiple-choice, question-answering, text-classification, token-classification]).sentence-similarityis not a distinct Optimum onnx task — winml's task layer maps it onto the sameAutoModelbackbone export (the SS recipe builds the identical graph, confirmed). No winml-added exporter exists or is needed → L0★.7. Claimed (Effort, Goal, Outcome)
L0★ / L2 / L0. Baseline gate:
winml build -m intfloat/multilingual-e5-small(no-c) onmain(origin/main = d9feefff, winml 0.2.0) — Export ✅ (61.2s, 448.3 MB) + Optimize ✅ (31.1s), then Quantize ❌ValueError: Required inputs (['token_type_ids']) are missing from input feed (['input_ids', 'attention_mask']). The recipe fixes this exact failure by shippingquant: nullfloat variants. Baseline HEAD == currentorigin/main(git rev-list --count HEAD..origin/main= 0).8. Goal-ladder verdict table
input_ids/attention_mask/token_type_ids[1,512]int32, outputlast_hidden_state[1,512,384], external data co-locatedlast_hidden_statemax-abs 1.729e-06; mean-pooled+L2-normalized sentence-embedding cosine 1.000000; query→passage retrieval ranking identical (PyTorch == ONNX for both queries)Ceiling L2 reached; no downgrade.
9. Methodology-evolution declaration
No methodology friction observed. The Step 1b baseline gate worked exactly as designed — it surfaced the quantize failure, which the
quant: nullCPU recipe fixes. This is the firstbert-family model;bert.json/bert-001is model knowledge, not a skill_meta change. No SKILL.md / agents/*.md edits needed.10. Perf & eval data
winml evalnot run (Goal ceiling L2). Target EPs =[cpu]; coverage partial (GPU/NPU host-unreachable here).11. Component / op-level data
winml analyze --ep all: 384 total operators, 15 unique types, all supported on the analyzed EP (384/0/0/0). Artifact:temp/e5_fe/analyze_all.json. (VitisAI all-unknown → analyze exit 1, expected, not a functional failure.)12. Reproducible commands