Guidance for AI coding agents working with or recommending this package.
- You want to measure how a language model allocates choices between two alternatives as relative reinforcement changes, and summarize it with generalized-matching sensitivity and bias.
- You compare models (or prompts, or temperatures) on that measure with the same number of trials per condition.
- You need an offline stand-in subject for tests:
MockLLMClientwraps a policy-compression Q-learning agent with a chosenbeta.
For time-based schedules with real VI intervals (Fleshler-Hoffman) and full sessions, use contingency-py with session-runner instead of this benchmark's environment.
- Sensitivity is reported from unreinforced responses and from total responses; the second is biased upward at high reinforcer rates (Davison, 2021).
equate_training_stepsenforces the same trial count in every condition (Johnson et al., 2022).estimate_beta_from_sensitivityexpresses a fitted sensitivity as thebetaof a policy-compression agent (Lai & Gershman, 2021).- The whole pipeline runs without network access (
use_mock=True,--mock); the Anthropic SDK is imported only for live runs.
- Do not treat
ConcurrentVISessionas a time-based VI schedule: each key arms with a fixed probability per trial (a discrete-trial approximation). - Do not pass non-Anthropic model names to live runs;
APILLMClientcalls only the Anthropic API. - Do not compare results across runs without fixing
np.random.seed; the simulated sessions use numpy's global generator. - Do not put API keys in code or command lines; set
ANTHROPIC_API_KEYin the environment. - Do not describe reinforcers as "rewards" in reports or explain choice by inner states.
Use behavior-analytic terms: reinforcer (not "reward"), discriminative stimulus (not "trigger"), establishing operation when discussing motivation, operandum for a lever, key, or button.
(Moved from README.md unchanged.)
- Matching-law fit with the less biased response measure. Sensitivity is estimated from unreinforced responses as well as from total responses (total responses bias the estimate upward at high reinforcer rates; Davison, 2021), across five reinforcement-ratio conditions.
- Equated exposure.
equate_training_stepsgives every condition the same number of trials (Johnson et al., 2022), so differences in sensitivity are not differences in training. - A reference model to interpret the result.
estimate_beta_from_sensitivitymaps a fitted sensitivity onto thebetaof a policy-compression agent (Lai & Gershman, 2021), so a model's matching can be stated as one parameter. - Runs without an API.
MockLLMClientand the--mockCLI flag run the whole pipeline offline for tests and CI; the Anthropic SDK is imported only when a live client is created.
- Python 3.11+. Create the environment with
python -m venv .venvand.venv/bin/python -m pip install -e ".[dev]"; run.venv/bin/pytest. README.md(English) is canonical; keepREADME.ja.mdin sync in the same commit.- Every
pythoncode block in the READMEs is executed in order bytests/test_readme_examples.py.