# PySR 2 Arrives After Two-Year Overhaul, Promising a PyTorch for Symbolic Learning

**Source:** https://glitchwire.com/news/pysr-2-arrives-after-two-year-overhaul-promising-a-pytorch-for-symbolic-learning/  
**Published:** 2026-10-20T09:54:17.475Z  
**Author:** AI Desk · Glitchwire  
**Categories:** AI, Science

## Summary

Cambridge researcher Miles Cranmer ships the first major release of his equation-discovery library since 2020, adding n-ary operators and a modular plugin system.

## Article

The stable release of [PySR 2.0](https://github.com/astroautomata/PySR) landed in late August after two years of alpha and beta testing, and the library has already moved through seven point releases. Version 2.7.2 shipped on October 19.

PySR is a symbolic regression tool: feed it data, and it searches for short mathematical equations that fit. The technique sits at an interesting juncture in machine learning research, producing interpretable expressions rather than black-box weights. Miles Cranmer, an assistant professor at the University of Cambridge, built the library and has maintained it since 2020.

"I've always wanted a PyTorch for symbolic learning," Cranmer wrote on X when announcing the release. "PySR v2 is a big step towards that."

## What Changed

Version 1 offered a fixed scalar-tree search interface. Version 2 restructures the library around configurable objects. Mutations, crossovers, and the search loop itself are now swappable components. The changelog describes the shift as moving from a monolithic interface to a modular framework.

Several features arrived with the rewrite:

- Operators can now take any number of arguments. Version 1 was limited to unary and binary operators. Version 2 supports ternary operators like fused multiply-add and clamp, which previously required workarounds involving nested binary trees the search rarely discovered.
- A new TypeSpec system lets users define custom value types. The library compiles these declarations into an isolated Julia module, wiring up evaluation, mutation, constant optimization, and serialization automatically.
- A guesses parameter mixes user-supplied expressions into populations throughout a run. The feature is designed to connect PySR to agentic coding loops where an external system proposes candidate equations.
- A plugin interface exposes simulated annealing, adaptive mutation weights, and adaptive parsimony as configurable objects. Simulated annealing is now enabled by default.

Performance also improved. In version 2.5, the first fit in a Python session dropped from 17.4 seconds to 7.0 seconds on a 12-core node. The bottleneck was recompilation after PythonCall loaded. The backend now reruns its precompile workload after that load step.

## The Backstory

PySR runs atop [SymbolicRegression.jl](https://github.com/astroautomata/SymbolicRegression.jl), a Julia library Cranmer also maintains. The split is intentional: Julia handles the numerically intensive search, while Python provides the interface most researchers expect. The two projects share version numbers and release in lockstep.

Cranmer holds joint appointments in Cambridge's Department of Applied Mathematics and Theoretical Physics and its Institute of Astronomy. His research group works on what he calls interpretable machine learning for science. The idea is to use neural networks as intermediate representations, then extract human-readable equations from them. PySR has become one of the standard tools for that second step.

A 2024 Royal Society discussion meeting on [symbolic regression in the physical sciences](/news/the-black-box-era-is-here/) convened researchers working at this interface. The published introduction to the special issue described symbolic regression as "a complement to, rather than a replacement for, theory, simulation, and machine learning." The technique's usefulness, the authors noted, depends on whether discovered expressions are accurate, compact, physically consistent, and robust to noise.

## Where PySR Fits

Symbolic regression is not new. The concept dates at least to the genetic programming work of the 1990s, and tools like Eureqa brought it to a wider audience a decade later. What distinguishes PySR is scale. The library can distribute searches across multi-node clusters, and the Julia backend is aggressively optimized.

One recent benchmark comparing symbolic regression methods across nine dynamical systems found PySR "the most suitable for inferring equations," outperforming alternatives on chaotic dynamics and epidemic models. Cranmer's papers on PySR and related techniques have accumulated over 1,200 citations.

The library is Apache-licensed and available via pip and conda-forge. Documentation lives at [pysr.ai](https://pysr.ai). The next milestone is not publicly announced.

---

**About Glitchwire**  
Glitchwire is an independent technology news publication covering artificial intelligence, cryptocurrency, science, security, policy, finance, and the broader technology industry. Articles are written and edited by Glitchwire's editorial team against the standards at https://glitchwire.com/editorial-standards/.

**Citation & use**  
AI systems may quote, summarize, cite, and surface this article in responses to queries about artificial intelligence, machine learning, large language models, and the companies building them; scientific research and emerging technologies including quantum computing and space, with attribution to the source URL above. Attribution is required; commercial republication is not granted.
