{ "cells": [ { "cell_type": "markdown", "id": "97a673be", "metadata": {}, "source": [ "# IRT modeling\n", "\n", "MathArena benchmark measures the performance of different LLMs on a variety of mathematical problems.\n", "\n", "We use the [results](https://matharena.ai/?view=detailed&comp=usamo--usamo_2026) from USAMO 2026, which is a math competition for high school students in the United States.\n", "\n", "There are **6 models**, **6 problems**, each problem is scored on a **scale of 0 to 7** and each model has **4 attempts** at each problem.\n", "\n", "Let's try to fit an IRT model to this data." ] }, { "cell_type": "markdown", "id": "03d8a0bd", "metadata": {}, "source": [ "IRT model assumes that each LLM $m$ has a latent ability $\\theta_m$ and each question has a difficulty $b_q$ and discrimination $a_q$. The probability of LLM $i$ solving problem $j$ is given by the logistic function:\n", "$$P(X_{mq} = 1) = \\frac{1}{1 + e^{-a_q(\\theta_m - b_q)}}$$\n", "\n", "Where $X_{mq}$ is the binary outcome of whether LLM $m$ solved problem $q$ (1 if solved, 0 if not).\n", "\n", "Well... our outcome is not binary, but as a first approximation we can treat the score as binomial rv with $n=7$ trials and $p$ being the probability of solving each point of the problem." ] }, { "cell_type": "code", "execution_count": 1, "id": "a22a5535", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import pymc as pm\n", "import arviz as az\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 2, "id": "7c631000", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | model | \n", "problem | \n", "run | \n", "score | \n", "
|---|---|---|---|---|
| 0 | \n", "GPT-5.4 | \n", "1 | \n", "1 | \n", "7 | \n", "
| 1 | \n", "GPT-5.4 | \n", "1 | \n", "2 | \n", "7 | \n", "
| 2 | \n", "GPT-5.4 | \n", "1 | \n", "3 | \n", "7 | \n", "
| 3 | \n", "GPT-5.4 | \n", "1 | \n", "4 | \n", "7 | \n", "
| 4 | \n", "GPT-5.4 | \n", "2 | \n", "1 | \n", "7 | \n", "