integrals / README.md
chenpanli's picture
Add the pool, its generation script and the dataset card
c88f17b verified
|
Raw History Blame Contribute Delete
4.29 kB
metadata
pretty_name: Integrals
license: mit
language:
  - en
tags:
  - mathematics
  - symbolic-integration
size_categories:
  - 1K<n<10K
configs:
  - config_name: default
    data_files:
      - split: test
        path: integrals.jsonl

Integrals

1,000 indefinite integrals of a single elementary term, such as $\int -5x^{8},dx$ or $\int 4x\sin(15x + 9),dx$, each with a reference antiderivative. Each one alone is a routine exercise. The paper On the Fragility of Tasks under Composition: Implicit Budgeting in Language Models sums k of them into one integrand and asks a model for the antiderivative of the whole, so each term must still be integrated correctly when it shares the prompt with others. The code for those experiments is at github.com/chenpanli/fragility.

from datasets import load_dataset

pool = load_dataset("chenpanli/integrals", split="test")

Problems

There are five categories of 200 problems each, stored in this order (atom-0000 to atom-0199 are polynomials, and so on). Here $a$ ranges over $[-5, 5]$, $n$ and $b$ over $[-15, 15]$, all three nonzero, and $c$ over $[-15, 15]$.

Category Integrand
polynomial $a x^n$, including negative powers
trigonometric $a \sin(bx+c)$, $a \cos(bx+c)$ or $a \tan(bx+c)$
exponential $a e^{bx}$
logarithmic_rational $a \ln(bx+c)$ or $a / (bx+c)$
integration_primitive $a x \cdot g(bx+c)$ for $g \in {\exp, \sin, \cos, \ln, \arctan}$, which needs integration by parts

Every problem is solvable: SymPy found an elementary antiderivative for it, and that antiderivative passed the same checker that grades model answers. Of 1,272 random draws, the 272 that repeated an earlier integrand were dropped; none failed either check.

How it was made

generation/experiments/integrals/generate_dataset.py draws the integrands, solves and checks them, and writes integrals.manifest.json with the seed, the parameter ranges and the rejection counts. To rebuild the pool (under a minute on one CPU core):

pip install -r generation/requirements.txt
cd generation
PYTHONPATH=src python experiments/integrals/generate_dataset.py -n 1000
cmp datasets/integrals/atomic.jsonl ../integrals.jsonl    # identical

generation/src/llm/ holds the modules the script imports from the paper's code: integral_utils.py (the sampler), and verification.py with the parser/ package it uses (the checker, identical to the code repository's copies).

Fields

Field Meaning
id Stable id, atom-0000 to atom-0999. Every composed prompt in the paper refers to problems by this id.
integrand The integrand in SymPy syntax, e.g. -5*x**8.
integrand_latex The integrand in LaTeX, e.g. - 5 x^{8}.
integrand_latex_integral The integral as it appears in the prompt, e.g. \int - 5 x^{8} \, dx.
reference_antiderivative One antiderivative in SymPy syntax, e.g. -5*x**9/9.
category One of the five categories above.
variable Always x.
stage, k Always atomic and 1.

Grading

An answer is correct if its derivative equals the integrand, so any constant of integration, and any form of the antiderivative, is accepted. The checker is check_antiderivative in generation/src/llm/core/math/verification.py. It reads the last \boxed{} of a model response, parses the LaTeX, differentiates it with SymPy and compares the result to the integrand. If their difference does not expand to zero, it evaluates both sides at complex sample points to reject wrong answers, then confirms the rest by simplifying the difference.

from llm.core.math.verification import check_antiderivative

result = check_antiderivative(r"... $\boxed{-\frac{5x^{9}}{9} + C}$", "-5*x**8",
                              symbol="x", input_kind="response")
result.verdict    # Verdict.CORRECT

Citation

@inproceedings{li2026fragility,
  title     = {On the Fragility of Tasks under Composition: Implicit Budgeting in Language Models},
  author    = {Li, Chenpan and Brockmoeller, Thies and Jegelka, Stefanie and
               Gupta, Sharut and Karalias, Nikolaos},
  year      = {2026},
}