[feature]: opt-in per-slice regression gates for laya-evals
The problem
laya-evals already records language, model, qid, and tag slices, but compare checks only overall and run --slice only prints them. An aggregate can improve while a smaller but important language regresses. For example, moving 900 English cases from 90% to 95% and 100 Chinese cases from 90% to 60% raises overall accuracy from 90% to 91.5%; the existing overall tolerance gate passes. A fixed slice floor alone also misses a drop that remains above that floor.
Proposed solution
Add an opt-in --gate-policy FILE to run and saved-report compare. A versioned JSON policy would name one existing slice dimension/value and an exact metric per rule, require min_count scored cases, and allow either an absolute min/max or a directional baseline max_drop/max_increase. Relative rules require --baseline. Both commands use the same evaluator and report the slice, metric, counts, current/baseline values, and limit on failure. Missing slices, missing metrics, too few scored cases, skipped cases, and incompatible baseline identities fail closed. Invalid policy syntax exits 2 before checkpoint loading; quality failures exit 1. Existing commands without the flag retain their behavior. I can implement this in a focused PR with weight-free tests and docs.
Alternatives considered
--slice is useful for inspection but does not fail CI. The current overall --min/--max and --tolerance cannot express a slice-specific change. Extending EvalReport.compare() to compare every slice by default would change existing gates and make newly appearing or tiny slices noisy; a small explicit policy keeps the rollout controlled.
Use case
A team can require language=zh choice_accuracy to drop by no more than 0.05 against a reviewed report, with at least 50 scored answers in both reports. They can keep the existing overall tolerance and add this one rule when promoting a checkpoint.
Prior art
No response
Before submitting
- I searched the existing issues and this is not a duplicate.
Source: NandhaKishorM/laya