XERのinstance_detailsのWERがトークナイザ未適用で計算される問題を修正 - #295
Open
kiakiraki wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
kiakiraki
marked this pull request as ready for review
July 19, 2026 01:48
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.
問題
XERメトリクスで tokenizer を指定した場合、summary のwer_scoreはトークナイズ済みテキストで計算される一方、instance_detailsのwer_scoreは生のreference/lm_outputで計算されていました。日本語のようにスペースで単語が区切られない言語では、jiwer のデフォルト分割により文全体が1単語として扱われるため、インスタンス単位の WER が「完全一致なら 0.0、少しでも違えば 1.0」というデタラメな値になり、summary と矛盾していました。
修正内容
instance_detailsのwer_scoreを summary と同じトークナイズ済みテキスト(tokenized_references/tokenized_lm_outputs)で計算するように修正しました。cer_scoreは文字単位の計算でトークナイズ不要のため、summary 側と同様に生文字列のまま維持(挙動変更なし)テスト
WhitespaceTokenizer指定時に単一インスタンスのinstance_details[0]["wer_score"]が summary と一致することを検証SacreBleuTokenizer(name="ja-mecab")、4トークン中1トークン違い)で、修正前は 1.0 になっていた WER が正しく 0.25 になることを検証🤖 Generated with Claude Code