Skip to content

About

Frozen policy-relative audits and controlled RL studies of reward overoptimization in machine translation.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Auditing translation rewards before reinforcement learning

tests

Research code, frozen protocols, and paper sources for studying what happens when machine translation policies optimize learned quality-estimation rewards. The current question is what a cheap, policy-relative pre-training audit can reliably clear and which reward vulnerabilities training should guard.

At a glance

  • Before training, a policy-relative audit tests whether a reward prefers controlled failure constructions (source copy, wrong-language output, truncation, repetition, refusal, over-translation, and others) to the initial policy's translations.
  • Predictions are frozen before GRPO training; protocol hashes prevent results from being silently redefined after outcomes are known.
  • Safe calls reliably clear the tested reward--policy pair for a named construction. Hack calls identify vulnerabilities, but most are not realized within the frozen training budget.
  • An audit-guided guarded ensemble improves over the best single reward, primarily by preventing wrong-language collapse in Swahili and Zulu. An all-guards comparator performs similarly because guards rarely misfire.
  • The work includes controlled best-of-N and contextual-bandit studies, a corrected 1.5B GRPO grid, 7B LoRA scale and language-generalization studies, a strengthening study on a second policy family, and prospective recipe tests.
  • A first-author ACL paper is in progress. Blinded Spanish and Chinese human evaluation is prepared but has not yet been run.

The repository grew from an earlier tokenization intervention study. That branch is closed as a bounded negative result and has its own short paper. The main project now combines controlled candidate selection experiments with generative GRPO experiments.

Project status

Reward overoptimization

The completed controlled studies include:

  • best-of-$N$ selection with fixed WMT candidate pools;
  • a finite-action contextual bandit whose expected objective and gradient can be computed exactly;
  • a source-and-candidate-text policy evaluated on held-out systems;
  • reward-training seed and optimization-horizon replications;
  • prospective tests of pre-optimization screening and pressure selection; and
  • matched controls for metric--annotation disagreement filtering.

These studies support the class project and the current ACL draft. See the reward-overoptimization protocol, contextual-bandit protocol, and pre-optimization predictor protocol.

Generative GRPO

Qwen2.5 translation policies (1.5B full fine-tuning; 7B LoRA) are trained with GRPO against COMET-family and MetricX quality-estimation rewards.

  • The audit: before training, a policy-relative audit compares each reward's scores for controlled source-copy, refusal, repetition and truncation outputs against the initial policy's own translations.
  • The rule: a frozen three-band rule (results/policy_relative_rule.json) turns each preference rate into a hack call, a safe call, or an abstention.
  • Freezing: every study's calls are frozen before training, and the trainer refuses runs whose protocol or prediction hashes differ from the pinned values.

Studies, all complete unless noted:

Study Protocol / predictions Result
Corrected 1.5B grid (en-es, en-de, en-zh) grpo_padding_rerun_amendment.json Reran every early run after a rollout right-padding bug; the earlier refusal collapse and preambles were artifacts of it
Scale study (7B LoRA; MetricX-24 XL/XXL rewards) grpo_scale_protocol.json, grpo_scale_predictions.json Safe calls 36/36 tasks; hack calls 1/2 (XCOMET copies into Chinese, not German)
Generalization study (XCOMET-XXL, CometKiwi-23-XXL; en-ja, en-ru) grpo_generalization_protocol.json, grpo_generalization_predictions.json Hack calls 4/4 tasks (12/12 cells); safe calls 27/34 tasks, every failure in the truncation indicator and mostly cleanups of bloated initial outputs
Reachability probe (why 7B en-de did not copy) reachability_probe_protocol.json Failed calibration, frozen before the generalization outcomes; how often the policy samples copies does not explain it
Copy-margin hypothesis and fresh test copy_margin_protocol.json, margin_test_protocol.json The post-hoc margin carried some signal but its fresh prospective test was mixed; it is not a deterministic reachability rule
Strengthening study strengthening_protocol.json, strengthening_runs.json Safe calls transfer across additional rewards, targets and Llama-3.1-8B; most hack calls remain unrealized
Audit-guided recipe, C1--C4 recipe_protocol.json, recipe_runs.json C3 improves over C1 and slightly over C2, chiefly by preventing Swahili/Zulu wrong-language collapse
All-guards comparator, C5 recipe_allguards_runs.json C5 is not detectably different from C3; unnecessary guards have low measured cost in this setting
Recipe extension recipe_extension_runs.json, recipe_extension_result.json On Gujarati over-translation, which a language gate cannot see, audit-chosen guards beat the gate in COMET-22 and chrF; a third Swahili/Zulu seed repeats the collapse pattern

Reference-based automatic metrics, behavior indicators, and a secondary learned judge evaluate the recipe. Blinded human evaluation is prepared but not yet sent. Two native Spanish and two native Chinese annotators will evaluate the recipe conditions:

The paper outline and framing decisions are in docs/GRPO_PAPER_OUTLINE.md. Prior-work positioning, with every citation checked against its source, is in notes/lit_review_2026-11-11.md.

Tokenization study

The earlier branch established exact same-string policy-gradient invariance and closed a token-length-tilt intervention after its launch screen did not pass. It does not claim a translation-learning effect. See docs/SAME_STRING_INVARIANCE.md, docs/GO_NO_GO.md, and paper/tokenization_acl/.

Papers and class deliverables

  • paper/reward_overoptimization_acl/: ACL-format manuscript for the reward-overoptimization project.
  • paper/grpo_audit_acl/: ACL-format manuscript for the prospective generative reward-audit study. It covers safe-call transfer, strengthening, guard coverage, the audit-guided recipe, the all-guards comparator, the recipe extension, a secondary judge, and the padding correction. Human evaluation remains pending.
  • paper/tokenization_acl/: short negative-result paper for the tokenization branch.
  • paper/class_project_proposal/: proposal for the reinforcement-learning course project.

The reward-overoptimization manuscript presents the controlled candidate studies. The generative GRPO study is maintained as a separate manuscript so its prospective design and padding correction remain explicit.

Reproducibility and numeric claims

results/paper_stats.json is the single source of truth for paper-facing experimental quantities. Analysis scripts merge their own keys into that file. Paper builders render LaTeX commands into generated_stats.tex; those generated files are build artifacts and are not edited by hand.

Before considering a paper build complete:

  1. Recompute the relevant analysis section in paper_stats.json.
  2. Regenerate the paper's LaTeX commands and figures.
  3. Run scripts/check_tex_numbers.py on every hand-authored TeX source.
  4. Confirm that each reported table row traces to a source record or run artifact.

Build the main manuscript from the repository root:

python src/build_reward_overoptimization_paper.py
python src/plot_reward_overoptimization.py
python src/plot_contextual_bandit.py \
  --output-stem paper/reward_overoptimization_acl/figures/contextual_bandit
python src/plot_text_policy_bandit.py \
  --output-stem paper/reward_overoptimization_acl/figures/text_policy_bandit
python scripts/check_tex_numbers.py paper/reward_overoptimization_acl/main.tex
make -C paper/reward_overoptimization_acl

Build the tokenization paper:

python src/build_tokenization_paper_stats.py
python scripts/check_tex_numbers.py paper/tokenization_acl/main.tex
make -C paper/tokenization_acl

Build the generative GRPO audit paper (order matters: the builder refuses a stale figure):

module load texlive/2024
python src/analyze_grpo_generalization.py          # only after new generalization outputs
python src/diagnose_truncation_flags.py
.venv/bin/python src/plot_audit_outcomes.py
# exploratory analyses added after the 2026-12-03 review panel (CPU; rerun only if their inputs change)
.venv/bin/python src/analyze_recipe_sensitivity.py   # leave-out estimates, own change per condition, English drift
.venv/bin/python src/analyze_realization_by_call.py  # realization rate by audit call (strengthening)
.venv/bin/python src/analyze_zulu_xhosa.py           # second language identifier on Zulu outputs
python src/build_grpo_audit_paper.py
python scripts/check_tex_numbers.py paper/grpo_audit_acl/main.tex
make -C paper/grpo_audit_acl

The paper directories also provide a tectonic Make target.

Repository layout

  • src/: data preparation, reward training, audits, policy optimization, evaluation, analysis, paper-stat generation, and plotting.
  • results/: frozen protocols, prospective predictions, compact audit output, and the paper statistics source of truth.
  • docs/: scientific protocols, intervention decisions, human-evaluation guidance, and research plans.
  • scripts/slurm/: tracked BYU cluster launchers for the experiments.
  • paper/: ACL manuscripts and the course proposal.
  • tests/: checks for the controlled data, reward, bandit, and analysis paths.
  • artifacts/: local generated translations, logs, checkpoints, and evaluation output. Most contents are intentionally excluded from Git.
  • data/: compact provenance and split audits. Corpus text remains local.

Main execution paths

Controlled reward study

The main sequence is:

  1. inventory and diagnose DA slices;
  2. build matched reward-training conditions;
  3. train and score reward models;
  4. run best-of-$N$, contextual-bandit, and text-policy analyses;
  5. run the frozen prospective confirmation and pressure-selection analyses;
  6. merge results into paper_stats.json and rebuild the paper.

The corresponding scripts use descriptive names under src/, including analyze_da_slice_diagnostics.py, train_da_reward_model.py, analyze_wmt25_best_of_n.py, analyze_wmt26_best_of_n.py, run_contextual_bandit.py, run_text_policy_bandit.py, and the predictor and safe-pressure analysis scripts.

Generative GRPO study

The generative path is centered on:

Supporting scripts:

Role Scripts
Freezing (each refuses to overwrite its output) freeze_grpo_*_protocol.py, freeze_grpo_*_predictions.py, freeze_reachability_predictions.py, freeze_margin_predictions.py, freeze_margin_test_runs.py
Scoring analyze_grpo_generalization.py, plus the scale and rule-test scorers above
Probes and diagnostics probe_reachability.py, diagnose_truncation_flags.py, audit_preamble_exploratory.py
Reference quality eval_grpo_reference.py (COMET-22, chrF, paired bootstrap; cached), eval_stripped_reference.py
Figure plot_audit_outcomes.py (task-level scatter; palette validated for colour vision deficiency)
Human evaluation prepare_human_eval.py (blinded sheets; key hashes in artifacts/human_eval/manifest.json)

Cluster launchers default to offline Hugging Face caches and the project Python environment in .venv/. Do not regenerate a frozen protocol or prediction file in place. Each freezing script refuses to overwrite its output, and trainers pin the expected hashes.

Environment

The GRPO, audit, scoring and paper-building scripts run in a project virtual environment at .venv/ (not committed). Every cluster launcher uses $SLURM_SUBMIT_DIR/.venv/bin/python, so submit from the repository root. env/requirements.lock.txt pins the exact package set; its header gives the uv commands that recreate it (CUDA 12.4 PyTorch, installed with --no-deps because the working set is exact rather than resolver-consistent). Set GRPO_PYTHON to override the interpreter.

Older branches use other files. requirements-rl.txt and requirements-data.txt contain the small pinned dependencies for the original NLLB and data-reader paths. The generative GRPO experiments use PyTorch, Transformers, TRL, PEFT/LoRA, COMET-family rewards, GlotLID guards, and SLURM launchers. Protocol JSON files pin model identifiers, input hashes, and experimental settings. Analysis and paper-building scripts can run outside the original cluster when their recorded inputs are available.

Data, models, and redistribution

WMT annotations and system outputs, Tatoeba text, model checkpoints, generated translations, and optimizer state are not distributed in this repository. Compact source hashes, manifests, and attribution records are retained where permitted. The NLLB/Tatoeba branch's terms and attribution are summarized in docs/DATA_MODEL_NOTICE.md. Consult the relevant WMT release and model cards before redistributing data or modified weights.

OPUS-100 remains excluded from research training because its combined-source licensing was not cleared for this project.

License

Code is released under the MIT License. Datasets, model weights, and generated artifacts remain subject to their original licenses and terms.

About

Frozen policy-relative audits and controlled RL studies of reward overoptimization in machine translation.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages