Skip to content

test(wmt_translation): score spBLEU offline with a local SentencePiece model - #6036

Draft
yaoyu-33 wants to merge 1 commit into
mainfrom
yuya/wmt-translation-offline-spbleu-tests
Draft

yaoyu-33 wants to merge 1 commit into
mainfrom
yuya/wmt-translation-offline-spbleu-tests

Conversation

@yaoyu-33

Copy link
Copy Markdown
Contributor

What changed

resources_servers/wmt_translation/tests/test_app.py gets two fixtures. No other file changes.

  • local_spm_sacrebleu_dir (session-scoped) trains a small SentencePiece unigram model from the four sentences the spBLEU tests score. It writes the model where sacrebleu looks for the FLORES-200 model (<dir>/models/flores200sacrebleuspm).
  • offline_spbleu_tokenizer (autouse) points sacrebleu.tokenizers.tokenizer_spm.SACREBLEU_DIR at that directory. It also replaces tokenizer_spm.download_file with a function that fails the test, so a later test can't quietly go back to downloading.

app.py is unchanged. Production spBLEU still uses the FLORES-200 model.

Why

sacrebleu downloads the FLORES-200 SentencePiece model the first time it builds a flores200 tokenizer. The URL is https://tinyurl.com/flores200sacrebleuspm, which redirects to dl.fbaipublicfiles.com. That host's TLS certificate expired on 2026-11-11 at 23:59:59 GMT. Since then, 21 tests in TestVerify, TestScoreMissingComet and TestComputeMetrics fail with urllib.error.URLError: ... CERTIFICATE_VERIFY_FAILED ... certificate has expired. This happens in every CI run that includes this server, including the scheduled Full test suite on main (for example run 43151999283, job "Server suite (shard 7)"). Retrying doesn't help, and server unit tests shouldn't depend on an outside host anyway.

The tests still check real spBLEU behavior. sacrebleu's BLEU runs on real SentencePiece segmentation, and only the vocabulary is small. The existing assertions hold for any SentencePiece model: identical text scores 100, NFC-equivalent text scores 100, slight variants score above 0, and the per-pair and cross-pair keys are present. The tests that check the tokenizer name (tokenize="flores200") are unchanged. The fixture docstring says that spBLEU values in these tests are not FLORES-200 values.

Issue: none. The breakage comes from an outside host, the fix is test-only, and no existing issue or PR covers it.

Validation

Ran on a Linux host. The server venv was built from the lock with uv sync --locked --python 3.13.14 --no-dev (uv 0.13.7). The server directory and repo root were on PYTHONPATH, as gym env test does. SACREBLEU pointed at an empty directory, like a fresh CI container. unshare -rn ran the tests with no network at all.

Run Result
This branch, whole server suite, with network 118 passed
This branch, whole server suite, no network (unshare -rn) 118 passed; the sacrebleu directory stays empty
This branch, tests/test_app.py, no network 49 passed
main's tests/test_app.py, no network 21 failed, 28 passed (the same 21 tests that fail in CI)
  • pre-commit run --files resources_servers/wmt_translation/tests/test_app.py: passed.
  • I also checked by hand that the local model is deterministic (two trainings produce identical bytes) and that it scores as expected: identical text scores 100, a one-word variant scores about 92, and unrelated text scores about 3.

Rollout evidence

N/A. This is a test-only change. verify(), compute_metrics() and the spBLEU tokenizer used in production are unchanged.

Compatibility

None. No user-facing, config or benchmark-result changes.

🤖 Generated with Claude Code

…e model

sacrebleu downloads the FLORES-200 SentencePiece model from
dl.fbaipublicfiles.com the first time it builds a flores200 tokenizer.
That host's TLS certificate expired on 2026-11-11, so 21 tests in
TestVerify, TestScoreMissingComet and TestComputeMetrics failed with
CERTIFICATE_VERIFY_FAILED on every CI run that includes this server.

The tests now train a small SentencePiece model from the sentences they
score, point sacrebleu's model directory at it, and fail any test that
would still download a model. spBLEU keeps running the real sacrebleu
BLEU and SentencePiece code; app.py is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33 yaoyu-33 added the area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers label Nov 12, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test b41a69e

This branch had an error being deployed

1 failed deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers ci CI, automation, test queue, or workflow infrastructure work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants