Agentic Pattern Libraryby Vikas Goyal
Patterns / Math models / Item Response Theory
No. M09 Evaluation Emerging Verification

Item Response Theory

The two-parameter logistic model, \(\Pr(\text{pass}) = \sigma\big(a(\theta-b)\big)\)

Takeaway

A test case that even your weakest agent passes % of the time carries only 2.5% of the information of a well-placed case. It costs the same to run.

Change the blue number. Every figure on this page updates with it.

Why care

Not every test case earns its place in an eval set.

Eval sets grow by accretion: every bug report and edge case gets added, and few are ever removed. Over time many cases pass for every version you try, some fail for every version, and a few have wrong reference answers, so they reward the wrong behavior. All of them cost tokens and time on every run, and they compress the differences you are trying to see. Item Response Theory, the method behind standardized tests, estimates each case's difficulty and how sharply it separates strong agents from weak ones, so you can keep the cases that carry signal.

The intuition

Think of each test case as a hurdle. Its height is its difficulty: how capable an agent must be to have even odds of clearing it. Its sharpness is its discrimination: whether clearing it depends tightly on capability, or is closer to a coin flip.

A hurdle far below every agent tells you nothing, because everyone clears it. A hurdle far above every agent tells you nothing either. A hurdle at the right height but with a blurry edge tells you little, because strong and weak agents clear it about equally often. The informative cases sit inside the range of your agents' abilities and have a sharp edge.

Well-placed, sharp case
100%
Well-placed, blurry case (a = 0.5)
15%
Too easy: weakest agent passes 98%
2.5%
Far too easy: weakest passes 99.9%
0.1%

Average information about agents spread evenly between abilities −1.5 and +1.5, relative to a sharp case (a = 1.5) placed in the middle.

The math

The two-parameter logistic (2PL) model gives the probability that an agent with ability \(\theta\) passes case \(i\):

$$\Pr(\text{pass}_i \mid \theta) = \frac{1}{1+e^{-a_i(\theta - b_i)}}$$

How much a case tells you about ability near \(\theta\) is its information, and information adds up across cases:

$$I_i(\theta) = a_i^2\,P_i(\theta)\big(1-P_i(\theta)\big), \qquad I(\theta) = \sum_i I_i(\theta), \qquad \text{SE}(\hat\theta) \approx \frac{1}{\sqrt{I(\theta)}}$$
\(\theta\)
ability of an agent version (model, prompt, configuration) on a common scale, centered at 0
\(b_i\)
difficulty: the ability at which an agent has a 50% chance of passing case \(i\)
\(a_i\)
discrimination: how steeply the pass probability rises around \(b_i\); near 0 means the case barely depends on ability, negative usually means a wrong reference answer
\(I(\theta)\)
test information: the precision with which the whole eval measures abilities near \(\theta\)
  • Peak information is \(a^2/4\), reached at \(\theta = b\). Doubling a case's sharpness quadruples what it can tell you.
  • Information falls off exponentially away from \(b\). A case 5/\(a\) units from the nearest agent gives that agent under 3% of its peak information.
  • Precision depends on information, not case count. Removing uninformative cases leaves \(I(\theta)\) and the standard errors nearly unchanged.

Where each of these comes from is worked through in Derivations at the end of the page.

Interactive calculator

Inspect one test case: set its difficulty and sharpness and the ability range of the agents you compare. The second view shows the worked example's whole eval before and after pruning.

Below 0.4 the case barely tracks ability. Negative usually means the reference answer is wrong.
–
Verdict for this case
–
Weakest agent passes
–
Strongest agent passes
–
Information across your agents, vs a well-placed case
Chance of passing Information (scaled) Your agents' ability range

Worked example: pruning a 200-case eval

This example is simulated, so the true answers are known. A team's agent eval has 200 cases and has been run on 30 agent configurations over the past quarter: different models, prompts and tool setups. The run history is a 30 × 200 table of passes and fails, enough to fit a 2PL model to every case.

Three screening rules flagged 74 cases:

RuleCases flagged
Passed by at least 97% of configurations (too easy)36
Failed by at least 97% of configurations (too hard)20
Fitted discrimination below 0.4 (not tracking ability)18
Kept126

Reading the 18 low-discrimination cases, the team found 15 with wrong reference answers or ambiguous instructions, which strong configurations were failing for doing the right thing. The other 3 were valid but noisy.

All 200Kept 126
Test information at average ability42.341.2 (97%)
Spread of scores, weakest to strongest configuration36%–78%22%–90%
Rank correlation with the full eval's ranking–0.996
Run cost100%63%

The pruned eval costs 37% less per run, ranks the configurations almost identically, and spreads their scores further apart, so real differences are easier to see. A random cut to 126 cases would also save 37%, but would keep only about 63% of the information, widening every standard error by roughly a quarter.

Assumptions and where it breaks

  • You need many agents to fit it. Estimating two parameters per case takes results from dozens of agent configurations, not two or three. With few agents, use the simple screens: pass rate near 0% or 100%, and the correlation between passing a case and the overall score.
  • One ability may not be enough. The 2PL assumes a single skill drives every case. If your eval mixes coding, retrieval and tone, fit each area separately or use a multidimensional model.
  • Easy today is not easy forever. A case every current agent passes can catch a regression tomorrow. Move retired cases to a cheap regression suite rather than deleting them.
  • Difficulty is relative to the agents you fit on. Add a much stronger model and yesterday's "too hard" cases become the informative ones. Refit as the agent population changes.
  • Runs are random. A single run per case per agent adds noise to every estimate. Use several runs where cost allows (M05).

How to apply it

  1. Keep the run history. Store pass or fail per case per agent configuration, not just the overall score.
  2. Screen with simple statistics first. Flag cases nearly every configuration passes or fails, and cases whose results don't correlate with overall scores.
  3. Fit a 2PL model once you have results from 20 or more configurations, and rank cases by information over the ability range you care about.
  4. Read every low or negative discrimination case. These are usually labeling errors, and fixing them improves the eval more than adding new cases.
  5. Re-check the ranking on the pruned set against the full set before switching, and keep retired cases as a regression suite.

How to explain it to a stakeholder

"A third of our test cases are ones every version passes, every version fails, or that have the wrong answer key. They cost us on every run and tell us nothing. We'll keep the cases that separate good agents from weak ones, and we'll get the same ranking for two-thirds of the cost."

For coding agents

A machine-readable summary and a reference implementation. The same spec is embedded in this page as <script type="application/json" id="model-spec">, and the whole series is listed in models.json.

Model spec (YAML)
id: item-response-theory
number: M09
name: Item Response Theory (2PL) for eval sets
family: evaluation
answers: "Which test cases are too easy, too hard or broken, and how small can the eval be?"
formula:
  pass_probability: "1 / (1 + exp(-a * (theta - b)))"
  item_information: "a**2 * P * (1 - P)"
  test_information: "sum over items"
  ability_se: "1 / sqrt(test_information)"
inputs:
  X: {type: matrix, meaning: "X[agent][case] = 1 if passed"}
  theta_range: {type: pair, meaning: ability range of the agents being compared}
screens:
  too_easy: "pass rate >= 0.97"
  too_hard: "pass rate <= 0.03"
  low_discrimination: "a < 0.4 (review for label errors)"
assumptions:
  - one latent ability drives all cases
  - results from 20+ agent configurations
  - cases independent given ability
use_when:
  - an eval has grown large and slow
  - suspecting wrong reference answers
related_patterns: [llm-as-judge, learning-loop, test-first-loop]
Reference implementation (Python, NumPy)
import numpy as np

def fit_2pl(X, iters=4000, lr=0.05):
    """X: agents x cases matrix of 0/1. Joint maximum likelihood by gradient ascent.
    Good enough for screening; use a dedicated IRT library for publication-grade fits."""
    X = np.asarray(X, float)
    m, n = X.shape
    theta, a, b = np.zeros(m), np.ones(n), np.zeros(n)
    for _ in range(iters):
        p = 1 / (1 + np.exp(-a * (theta[:, None] - b)))
        r = X - p
        theta += lr * (r * a).sum(1) / n
        a = np.clip(a + lr * (r * (theta[:, None] - b)).sum(0) / m, -3, 4)
        b = np.clip(b + lr * (-r * a).sum(0) / m, -6, 6)
        theta = (theta - theta.mean()) / theta.std()   # fix the scale
    return theta, a, b

def screen(X, a, easy=0.97, hard=0.03, min_a=0.4):
    rate = np.asarray(X, float).mean(0)
    too_easy, too_hard = rate >= easy, rate <= hard
    weak = (a < min_a) & ~too_easy & ~too_hard
    return {"too_easy": np.where(too_easy)[0], "too_hard": np.where(too_hard)[0],
            "review": np.where(weak)[0], "keep": np.where(~(too_easy | too_hard | weak))[0]}

def test_information(a, b, theta):
    a = np.clip(a, 0, None)
    p = 1 / (1 + np.exp(-a * (theta - b)))
    return float((a ** 2 * p * (1 - p)).sum())

Derivations

For the math-curious: where each result in The math comes from. Nothing above depends on reading this.

The 2PL as logistic regression on ability

Write the log-odds of passing as a straight line in ability: \(\ln\frac{P}{1-P} = a(\theta - b)\). Solving for \(P\) gives the logistic curve. At \(\theta = b\) the log-odds are 0, so \(P = 0.5\): that defines difficulty. The slope of \(P\) at that point is \(a/4\): that is why \(a\) measures sharpness. The scale of \(\theta\) is arbitrary, so it is fixed by centering the agents' abilities at 0 with standard deviation 1.

Where item information comes from

Fisher information is the expected squared slope of the log-likelihood. For one case, the log-likelihood of a result \(x \in \{0,1\}\) is \(x\ln P + (1-x)\ln(1-P)\). Its derivative with respect to \(\theta\) is \(a(x - P)\), because \(dP/d\theta = aP(1-P)\). The expected square is \(a^2\operatorname{Var}(x) = a^2P(1-P)\). Since cases are independent given ability, information adds, and the maximum-likelihood ability estimate has standard error about \(1/\sqrt{I(\theta)}\).

Why easy cases carry almost nothing

\(P(1-P)\) peaks at \(\tfrac14\) when \(P = 0.5\) and shrinks toward 0 as \(P\) approaches 0 or 1. A case the weakest agent passes 98% of the time has \(P(1-P) \le 0.0196\) for every agent at or above that ability, under 8% of the peak, and the stronger agents get even less. Far from \(b\), \(P(1-P) \approx e^{-a|\theta-b|}\), so information decays exponentially with distance.

The calculator's information score

The readout averages the case's information over the ability range \([\theta_{\text{lo}}, \theta_{\text{hi}}]\) and divides by the same average for a case with the same discrimination placed at the middle of the range. A value of 100% means the case is as well placed as it can be for your agents; low values mean it is too easy, too hard, or both relative to them. Its sharpness is judged separately, by \(a\).

References

  1. Polo, F. M. et al. (2024). tinyBenchmarks: evaluating LLMs with fewer examples. Uses IRT to estimate full-benchmark scores of LLMs from around 100 well-chosen items.
  2. Baker, F. B. (2001). The Basics of Item Response Theory, 2nd edition. ERIC Clearinghouse on Assessment and Evaluation. A free, short introduction to item curves and information.
  3. Lord, F. M. (1980). Applications of Item Response Theory to Practical Testing Problems. Lawrence Erlbaum. The classic treatment of test information and test design.