feat(eval): add translation quality evaluation#1213
Draft
ssss141414 wants to merge 3 commits into
Draft
Conversation
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 follow-up to merged PR #1115 turns
translationevaluation from an explicit CLI blocker into a supported, task-meaningful path for WinML encoder-decoder models. It adds a generalized translation dataset adapter, deterministic static-shape generation, corpus SacreBLEU/chrF2 metrics, precise sample accounting, and regression coverage without branching on a checkpoint name. CPU fp32 and fp16 both complete a pinned, shuffled 100-row WMT14 French-to-English evaluation with identical quality scores.Model metadata
What the model does
Helsinki-NLP/opus-mt-fr-enis a text-to-text Marian encoder-decoder checkpoint that translates French input text into English output text. The encoder produces contextual hidden states; the autoregressive decoder produces vocabulary logits and updated key/value-cache tensors. Evidence: pinned checkpoint revisionc4aed37b318c763fd177aa449b44e3b783cc6c02, checkpoint configuration, and exported encoder/decoder interfaces. Confidence: verified.Primary user stories
Supported tasks
translation: checkpoint, Transformers, and WinML composite inference. Confidence: verified.text2text-generation: Transformers, Optimum ONNX, and the decoder component. Confidence: verified.feature-extraction: Optimum ONNX and the encoder component. Confidence: verified.Model architecture
MarianMTModel/WinML wrapper source, traced module hierarchy, and ONNX graph interfaces (mapped).Validation and support evidence
Baseline
origin/maincommit67169d45c40ed8326065e87ed29d19623b79cbb4.winml eval --schema --task translationexits 2 becausetranslationis absent from the evaluator registry.winml_build_config.jsonpayloads equal the current checked-in recipes after removing the build-generatedauto: falsefield.Goal
translationregistry/schema/adapter/generation/metric support, not checkpoint-specific behavior.Outcome
translationchanged from CLI-unsupported to supported.num_beams=1) and bounded by the graph's static KV-cache capacity.13atokenization and standard character-only chrF2 (n_word_order=0,beta=2), both reported on the conventional 0ΓÇô100 scale.Per-EP/device/precision results ΓÇö including perf and eval data
Goal ladder
0.9999999999995187, max abs3.337860107421875e-06; fp16 cosine0.999999184734255, max abs0.004638791084289551. Decoder parity is not claimed because the harness does not reconstruct identical dynamic-cache state.fr-en/test, deterministic shuffled 100-row subset, 100/100 evaluated for both precisions.Perf
These are per-component CPU measurements from the semantically identical #1115 recipe artifacts (10 measured iterations after 3 warmups). Composite autoregressive wall time depends on generated sequence length, so component figures are retained rather than combined into a misleading constant latency.
Eval
Dataset:
wmt/wmt14, configfr-en, splittest, revisionb199e406369ec1b7634206d3ded5ba45de2fe696. The row schema is a nestedtranslationmapping;source_lang=frandtarget_lang=enmatch the checkpoint direction. The 3,003-row test split is document-grouped, so this evidence uses streaming seeded shuffle (seed=42) before taking 100 rows rather than biased first-N sampling. It is a reproducible engineering subset, not a claim of full-test benchmark equivalence. Hugging Face reports the dataset license as unknown; this PR makes no permissive-license claim.Precision deltas are
0.0000SacreBLEU and0.0000chrF2. The scale is consistent with the checkpoint card's full WMT14 report (BLEU 37.8 and chrF approximately 63.3), while preserving the subset qualification above.On this Windows host the native process can terminate during provider teardown after the complete result JSON is written and is parseable. Both final runs were accepted only after validating JSON, exact 100/100/0 accounting, and zero
INVALID_ARGUMENT,Inference failed, orEvaluation failedlog matches; this is not represented as an inference failure.Delta
No recipe changes are included; the production recipe README is untouched.
WinMLTranslationEvaluatorand lazy/registry wiring fortranslation.TranslationMetricwith corpus SacreBLEU 13a and true chrF2, rather than averaging sentence metrics or mislabeled chrF++.encoder/decoderroles and explicit source/target/tokenizer-language/prefix controls.max_encoder_lengthandmax_decode_lengthfrom generic ONNX metadata onWinMLEncoderDecoderModel; reject a non-positive/dynamic decoder KV capacity where static cached generation cannot be safe.Bug fix explanation:
winml eval --schema --task translationas unsupported; attempting Marian's checkpoint-default 4-beam generation against a static batch-1 decoder also expands decoder inputs to batch 4 and fails ORT dimension validation.Helsinki-NLP/opus-mt-fr-enor model-name branch.2400 passed, 8 skipped, 2 deselected; Marian regression25 passed; focused translation/shared-model suite81 passed; final translation suite19 passed; Ruff passed; Mypy passed for 412 source files;git diff --checkpassed. Two real 100-row fp32/fp16 CLI evaluations completed as reported above.Analyze summary ΓÇö component level and op level
Static rule analysis completed with parseable data for all requested EP rule groups; command exit 1 was caused by unavailable host runtime/plugin registration, so status is ANALYZE-PARTIAL-SUCCESS. This is static compatibility analysis, not runtime execution on those accelerators.
Component-level summary
Expand,Cast,Concat;ScatterNDremains unknown in several accelerator rule sets.Expand; QNN GPU partial:Expand,Concat, unsupported:Cast;ScatterNDremains unknown.Functional MLP and residual/normalization regions are mapped from graph scopes/topology rather than separate traced module boundaries. The model-breakdown topology used fp32 graphs; fp16 topology was checked separately against the converted artifacts.
Op-level summary
ScatterNDunknown.ScatterNDunknown.Rule-less CPU, CUDA, MIGraphX, DML, and VitisAI rows report all op types unknown and are not runtime support claims.
Reproduce commands