Score variance baseline mixin

From wenmin-wu/ds-skills · View interactive version

Score variance baseline mixin is an AI agent skill from the GitHub repository wenmin-wu/ds-skills. Mix a small fraction of plain baseline responses into an adversarial submission to preserve cross-row score variance

How to use this skill

Skill file

Overview

In metrics that reward disagreement between LLM judges (e.g. variance or rank-correlation penalties), a perfectly-adversarial submission where every row gets the same derailed score is actually bad — the variance collapses to zero. The fix: keep a 10-15% fraction of rows as plain, un-attacked baselines. The baselines produce a normal score distribution; the adversarial rows cluster at the derailed value. The bimodal mixture has higher variance than either alone, which is exactly what the metric rewards.

Quick Start

import random

def submission_row(row, rng, baseline_frac=0.10):
    if rng.random() < baseline_frac:
        return plain_essay(row), "baseline"
    else:
        return adversarial_essay(row), "attack"

rng = random.Random(42)
submission = [submission_row(r, rng) for r in test_rows]

Workflow

  1. Implement both a plain_essay and an adversarial_essay function
  2. Sweep baseline_frac on a held-out slice: measure the competition metric for frac in {0, 0.05, 0.10, 0.15, 0.20}
  3. Pick the frac that maximizes the metric — usually 0.08-0.15
  4. Use a deterministic seed so the baseline/attack split is reproducible
  5. Log which rows were baselines — needed if you need to patch only the attack rows later

Key Decisions

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.