Repository navigation
Judge prompts: per-language guidance slot - #249
Open
fanny-riols wants to merge 5 commits into
Open
fanny-riols wants to merge 5 commits into
fanny-riols wants to merge 5 commits into
Conversation
Judge prompts can now include guidance for the conversation's language.
Each judge template gets a {language_guidance} placeholder, filled from
configs/prompts/judge_language_guidance/<metric>.yaml. English gets an
empty block, so English prompts render exactly as before.
- language_guidance.py loads and renders the guidance. A regional variant
(fr-CA) gets its base language's text followed by its own entry.
- get_judge_prompt() takes the language, fills the slot, and includes the
guidance in the prompt hash.
- The metric signature drift guard also hashes the guidance files.
- Judge call sites pass context.language.
No guidance files are added in this commit.
This was referenced Oct 29, 2026
Open
- A guidance file whose top level is not a mapping, or whose value is not a string, now raises a clear error instead of crashing or being dropped. - get_judge_prompt() requires language=, so a new caller can't silently skip the guidance on non-English runs. The rendered guidance is always the hashed one. - The guidance block renders as a ### section after a blank line, so the sections that follow it don't read as its subsections. English still renders empty. - Reuse base_language() and the language display names. - user_behavioral_fidelity has no guidance slot, and the prompt says why. - Tests: every guidance key is a supported non-English code, every judge template except user_behavioral_fidelity has the slot, get_judge_prompt injects and hashes the guidance, each judge base class forwards context.language, and English prompts match a golden render taken from main.
fanny-riols
commented
Oct 29, 2026
In both key-entities prompts, the guidance block came right after the worked example's JSON, so it read as part of the example. It now ends the Correctness Criteria, which it refines, and the example follows it. English renders exactly as before.
get_judge_prompt() requires language=, so a call site that forgets it raises, and the existing metric tests already run compute() on every call site. The forwarding tests only added a check on the value passed, and they patched private helpers, so an unrelated refactor could break them.
fanny-riols
marked this pull request as ready for review
November 2, 2026 15:21
This branch has not been deployed
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.
Why
Native speakers reviewed EVA conversations in 9 non-English languages (de, nl, fr, fr-CA, es, it, hi, ko, ja). Many of the judge errors they found depend on the language: how letters are named in a spelled code, which politeness formulas are expected, which letters sound alike. The judge prompts had no place for that kind of guidance.
This PR adds that place. It does not add any guidance yet; that comes in the two PRs stacked on top of this one.
What changes
{language_guidance}slot in 9 of the 10 judge templates injudge.yaml, just before the response format. In the two key-entities prompts it ends the Correctness Criteria instead, before the worked example, since the guidance refines those criteria.user_behavioral_fidelityhas no slot: it scores the simulated user against its own instructions (persona, goal, language directive), not against a language's norms.src/eva/metrics/language_guidance.py(new) loadsconfigs/prompts/judge_language_guidance/<metric>.yaml, a mapping of language code to guidance text, and renders it as a### <Language>-specific guidanceblock after a blank line.get_judge_prompt(..., language=...)inbase.pyfills the slot.languageis a required keyword, so a new caller can't silently skip the guidance. The guidance is included in the prompt hash, so a guidance edit shows up in the stored prompt hash.signatures.py): a metric's prompt hash now also covers its guidance file.context.language: the base judge classes, speech fidelity and key entities.English is unchanged
The slot replaces an existing blank line. With empty guidance, every judge prompt renders byte-identical to
main. A new test compares the English renders with a golden file taken frommain.The stored
prompt_hashof English runs does change, because it hashes the template text, and the template now has the slot.Testing
tests/unit/metrics/test_language_guidance.py:user_behavioral_fidelityhas the slot;get_judge_promptinjects the guidance and the prompt hash changes with it;tests/fixtures/judge_prompts_en.json).main: all 100 are byte-identical.Stack
Metric versions are bumped once, in PR 3, so each metric is bumped once for the whole stack.