Giving Our Galaxy's Favorite Simulator an AI-Age Speed Boost
Original paper: galpy with differentiable, accelerated backends: galactic dynamics in jax and PyTorch
"Rewiring a paper roadmap into an interactive GPS turns a static layout into a smart system that learns from traffic. Just as a dynamic map instantly recalculates your entire journey backward when you hit a roadblock, the upgraded galpy framework uses modern machine learning tools to run simulations forward and backward simultaneously. This allows researchers to effortlessly trace cosmic paths and automatically learn the hidden forces shaping our galaxy."
This breakthrough bridges the gap between massive astronomical surveys and modern artificial intelligence, enabling researchers to model dark matter and galactic evolution with unprecedented precision. By leveraging tools typically used for training neural networks, astronomers can process petabytes of cosmic data in seconds rather than days, accelerating our understanding of the universe's hidden architecture.
- Galpy now supports JAX and PyTorch computational backends.
- Simulations run up to 100,000 times faster on GPUs.
- AI coding agents helped build galpy version 2.
📑 Original arXiv Technical Abstract
We describe an extension of galpy, the Python library for galactic dynamics, that adds jax and PyTorch as computational backends alongside its existing numpy and C implementation. With it, galpy's gravitational potentials, orbit integration, action-angle transformations and their inverses, and distribution functions, including those for tidal streams, run on GPUs, can be compiled as part of a user's program, and can be differentiated with respect to their inputs and parameters, from the force at a point to the samples drawn from a distribution function. The user-facing design is kept simple: the active backend follows from the type of the arrays that are passed in, the galpy interface is unchanged, and the numpy path gives the same results as before. We describe the design of the backend framework and its implementation in each of galpy's modules, with examples of use, and we discuss its limitations. On a GPU, batches of orbits, samples from distribution functions, and stream models run one to five orders of magnitude faster than on a single CPU core. To illustrate the new capabilities, we present simple examples of fitting the Galactic potential with a hypervelocity star and of learning the inverse action-angle transformation with a neural network trained through galpy. An AI coding agent wrote essentially all of the code under the detailed direction and review of the human author, and we describe how we organized this work and how we established the correctness of the result. This work is the start of galpy's version 2, which is available at https://github.com/jobovy/galpy and documented at https://docs.galpy.org/en/v2/ .
✍️ Are you an author of this paper? Add code/demo links or a note
Help readers explore your work — share your official GitHub repo, Hugging Face weights, affiliation, or a clarification note for our editorial review queue.