Skip to main content
QUICK REVIEW

[Paper Review] py-irt: A Scalable Item Response Theory Library for Python

John P. Lalor, Pedro Rodríguez|arXiv (Cornell University)|Mar 2, 2022
Grit, Self-Efficacy, and MotivationPsychology5 citations
TL;DR

py-irt is a scalable, GPU-accelerated Python library for fitting Bayesian Item Response Theory (IRT) models using Pyro and PyTorch. It enables efficient estimation of latent traits for subjects and items in large-scale datasets, outperforming R-based tools like mirt in speed and scalability, particularly for datasets exceeding 1,000 items.

ABSTRACT

py-irt is a Python library for fitting Bayesian Item Response Theory (IRT) models. py-irt estimates latent traits of subjects and items, making it appropriate for use in IRT tasks as well as ideal-point models. py-irt is built on top of the Pyro and PyTorch frameworks and uses GPU-accelerated training to scale to large data sets. Code, documentation, and examples can be found at https://github.com/nd-ball/py-irt. py-irt can be installed from the GitHub page or the Python Package Index (PyPI).

Motivation & Objective

  • Address the lack of scalable, high-performance IRT libraries in Python for large-scale data analysis.
  • Enable efficient Bayesian inference for IRT models using modern deep learning frameworks.
  • Support diverse applications including machine learning evaluation, NLP, computer vision, and political science ideal-point modeling.
  • Provide a user-friendly, extensible framework for researchers to implement and train custom IRT models.
  • Overcome limitations of existing R-based IRT packages that fail to scale beyond moderate-sized datasets.

Proposed method

  • Builds on Pyro and PyTorch to leverage GPU-accelerated tensor operations and automatic differentiation.
  • Uses stochastic variational inference (SVI) with mini-batch gradient descent for scalable parameter estimation.
  • Supports multiple IRT models including 1PL, 2PL, 3PL, and the feasibility model with upper bounds on ICCs.
  • Enables model definition via subclassing IrtModel, allowing users to implement custom IRT models easily.
  • Integrates with PyTorch’s automatic differentiation and supports end-to-end training on large response matrices.
  • Provides CLI and API interfaces for training and inference, with support for both CPU and GPU execution.

Experimental results

Research questions

  • RQ1Can a Python-based IRT library achieve superior scalability and performance compared to established R-based tools like mirt?
  • RQ2How well do IRT-derived item difficulty and subject ability estimates generalize across diverse domains such as NLP and computer vision?
  • RQ3To what extent can IRT models be used to evaluate machine learning model behavior and data quality?
  • RQ4Can the library efficiently handle large-scale datasets with over 100,000 items and thousands of subjects?
  • RQ5How interpretable are the estimated item difficulties and latent traits in real-world machine learning evaluation tasks?

Key findings

  • py-irt outperforms mirt in runtime, completing model fitting in under a minute for datasets with over 100,000 items, while mirt fails to complete beyond 1,000 items.
  • The library successfully estimates meaningful item difficulties in MNIST and CIFAR-10 datasets, identifying intuitive hard and easy examples such as mislabeled images or rare classes.
  • In sentiment analysis tasks, the 1PL model correctly identifies extreme examples—e.g., highly negative or positive reviews—as difficult or easy, with estimated difficulties ranging from -2.46 to 2.05.
  • py-irt enables reliable estimation of latent abilities for machine learning models, supporting detailed performance analysis and data curation.
  • The integration of PyTorch and Pyro allows for efficient, differentiable inference, making the library suitable for use in deep learning and automated machine learning pipelines.
  • The library is production-ready, with continuous integration, comprehensive documentation, and support for community contributions via GitHub and PyPI.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.