betaFeedback

WorksPhysics and Astronomy

PLATON 7: An ultra-fast exoplanet atmospheric retrieval code

Abstract

PLATON is an open source Python package for atmospheric retrieval, first released in 2018. We introduce PLATON 7, a complete rewrite of PLATON using Claude Fable 5. The biggest changes are that PLATON now uses JAX for all intensive calculations, and these calculations are now performed in single precision instead of double precision. These two changes speed up the code by a factor of ~60 with negligible decrease in accuracy, allowing it to compute a 0.8–5.3 um transmission spectrum at R=20k in 0.35 ms on a RTX 5090. We also introduce several new features, including support for two-limb retrievals, patchy clouds, and more opacities (particularly OCS and CS2). PLATON is available on GitHub at https://github.com/ideasrule/platon.

Statement of need

PLATON is an open source atmospheric retrieval Python code first released in 2018 [15] that was greatly expanded in Zhang et al. [16] and Zhang et al. [17]. The forward model can generate transmission and emission of both rocky and gaseous exoplanets. The retrieval supports both equilibrium chemistry and free retrieval using either nested sampling or MCMC.

PLATON 7 is a complete rewrite of PLATON 6 using Claude Fable 5. The biggest changes are that PLATON now uses JAX [2] for all intensive calculations, and these calculations are now performed in single precision instead of double precision. These two changes speed up the code by a factor of ∼60\sim60 with negligible decrease in accuracy, enabling a 0.80.8–5.3 μm5.3\,\mu\mathrm{m} transmission spectrum to be computed at R=20kR=20\mathrm{k} in 0.350.35 ms on a RTX 5090. To prevent underflows or overflows in intermediate calculations, we instructed Claude to rearrange operations and rescale values (notably opacities and polarizabilities) to be near unity.

An unrelated change which contributes to the vast speedup is our switch to nautilus [7] as the default nested sampling package. Unlike classic nested sampling packages such as MultiNest [5] or dynesty [12], nautilus trains small neural networks to draw the live set boundary instead of fitting hyper-ellipsoids or other geometric objects. In our experience, nautilus enables far more efficient sampling at high dimensionality, in addition to more accurate identification of small (low prior volume) but high likelihood modes.

In addition to the large speedup, we add a variety of features, as detailed in our documentation and examples. For example, it is now easy for users to run a forward model with custom temperature and abundance profiles. We add support for two-limb retrievals because JWST observations have revealed the importance of limb asymmetry in gas giant transit spectra [4]. We also add support for non-isothermal limbs in transit spectra, again motivated by the increasing precision of data.

State of the field

As of March 2023, at least 50 retrieval codes existed in the exoplanet literature, of which 26 were open source [9]. However, highly optimized GPU retrieval codes are much rarer. We are only aware of one: BeAR [14], a successor to HELIOS-r2 [6], written in C++ and CUDA with a Python wrapper.

Because the main motivation of our PLATON 7 rewrite was speed, we benchmarked it against 4 widely used retrieval codes: PLATON 6 [17], POSEIDON 1.4 [8, 10], TauREx 3.3 [1], and BeAR 2 [14]. We ran free retrievals with the same parameterization on the transit spectrum of TOI 6894b [18], making sure that the spectral resolution and number of atmospheric layers are also identical across all codes. All benchmarks were run on a vast.ai virtual instance with a AMD Ryzen 9 7950X3D 16-core CPU, 45 GB of RAM, a RTX 5090 GPU, and CUDA 13.0. The CPU codes were run with 16 cores for POSEIDON and TauREx, and 10 cores (the maximum that the memory allows for) for PLATON 7 with GPU use disabled.

CodeTime (ms)GPU?
PLATON 70.35Yes
BeAR0.61Yes
PLATON 620Yes
TauREx-CUDA17Yes
PLATON 714No
POSEIDON45No
TauREx132No

Table 1.

The table above reports the total wall clock time divided by the total number of forward models, after discarding the initialization and 5000 forward models’ worth of burn-in. PLATON 7 is substantially faster than other codes we tested, beating BeAR by 1.75x, PLATON 6 by 57x, and CPU-based codes by around 2-3 orders of magnitude. When not allowed to use the GPU, PLATON 7 transparently falls back to the CPU and remains substantially faster than other CPU codes.

The speedup enabled by nautilus is hard to quantify because it is highly dependent on the specific retrieval problem, but we have seen speedups over MultiNest of more than 80x for retrievals with many parameters. This is especially the case for retrievals where each limb is fit separately with a non-isothermal T/PT/P profile.

Software design

PLATON was initially designed to be fast, open source, easy to install and use, and easy to understand. To this end, we implemented it in pure Python and kept the functionality spartan, enabling us to keep the number of lines to a minimum. The idea was that users could easily hack the code to implement the functionality they wanted. This idea was successful, and researchers from other groups implemented free retrievals, patchy clouds, and rocky surface emission long before they were included in the official PLATON.

With the advent of powerful AI coding assistants, we de-emphasized the last design goal– ease of human understanding–in favor of the first, raw speed. Our experience is that frontier LLMs like Fable are fully capable of understanding the code and making changes to it. As AI becomes more powerful, we expect only a vanishingly small portion of PLATON users will read the code themselves, making human readability much less important. That said, we have not sacrificed this goal completely: PLATON 7 is still in pure Python, retains largely the same structure as PLATON 6, and implements the same core algorithms.

PLATON 7 remains easy to install and use, even without AI assistance. Its user-facing interface is nearly identical to that of its predecessor. We have added more example scripts and simplified the ones that already exist in order to flatten the learning curve even further for humans and AIs alike.

Research impact statement

PLATON is one of the oldest and most widely used open source retrieval codes. It has been used by more than 80 papers to investigate everything from sulfur biosignatures on sub-Neptunes ([13]) to aerosols on warm sub-Saturns ([3]). The majority of these papers do not involve the main developer. Users span institutions and career stages, and include undergraduate students in exoplanet courses.

PLATON 7 specifically has been used to analyze the impact of limb asymmetry on the transit spectrum of WASP-94b ([4]). We expect much wider adoption once the code is officially released, as the 57x speedup over its predecessor enables use cases that would otherwise be prohibitively expensive.

Our vibecoding experience

We expect that the majority of new software will be written by AI. Since PLATON 7 is the first AI-written retrieval code that we are aware of, we share our vibecoding experiences in the hopes that it will be useful for the community.

Many years ago, the lead developer MZ aspired to make PLATON auto-differentiable by basing it on JAX instead of cupy ([11]), enabling the use of sample-efficient Hamiltonian Monte Carlo methods. However, he dropped the project after realized that JAX is not a drop-in replacement for cupy, and that adopting JAX would mean rewriting the entire codebase.

In April 2026, we asked Claude Code with the Opus 4.6 model to implement HMC with JAX-computed gradients. Opus first misunderstood our intent and computed numerical gradients instead of rewriting the code to support autodiff. After we clarified, it successfully rewrote the transit spectrum code, but encountered numerical difficulties with the opaque cloud deck, which we circumvented by adopting a continuous cloud prescription. After more debugging, we realized that HMC struggles with the posterior shapes typical in free retrievals. We therefore disabled autodiff and switched back to nested sampling, enabling a significant speedup over the old PLATON.

We then realized that a further speedup is possible by using fp32 instead of fp64 precision. Opus made the change and converted all of the arrays to fp32, but reported no speedup. Realizing this made no sense, we examined the AI’s progress reports and realized it inexplicably set jax_enable_x64 to True. We set the variable to False and the code instantly became many times faster, evaluating every forward model in only 1.5 ms. Opus declared that the code was unusable because fp32 is insufficient precision, but we told it to work around overflows and underflows by reordering operations and rescaling variables to order unity. The code then produced correct results for our test case. However, over the following months, we found other bugs stemming from the lower precision, which we fixed one by one.

In September 2026, we started from scratch and prompted Fable 5 to rewrite all of PLATON–not just a small part of the transit spectrum code–to use JAX. We told it from the outset to use single precision, set jax_enable_x64 to False, and prevent underflows or overflows by rescaling variables to order unity and/or reordering operations. Afterwards, we told it to optimize the code while ensuring that the unit tests still pass. After it was finished, we asked it to ask Codex (GPT-5.6 Sol) to review its changes and fix any important issues. We also triggered /code-review to have Claude review its own changes, then prompted it to fix any important issues.

This time, Claude was able to perform the entire refactoring and optimization process with no apparent issues and minimal human guidance. We have exercised the code extensively and could not find any new bugs. We attribute this to a combination of the much stronger model (Fable 5 vs. Opus 4.6), more specific initial instructions, and extensive code review by both GPT-5.6 Sol and Fable. Our experience is that frontier LLMs already outperform nearly all, if not all, astronomers at writing correct and fast code.

AI usage disclosure

Fable 5 with the Claude Code harness did all of the code rewrite. GPT-5.6 Sol with the Codex harness reviewed the code for correctness. More features were subsequently added by Opus 5.5.

No AI was used in the writing of this manuscript, except for finding and adding references.

Acknowledgements

We acknowledge contributions from Arjun Savel and Vatsal Panwar during the development of PLATON.

MZ acknowledges funding from the Heising-Simons Foundation for his 51 Pegasi b postdoctoral fellowship.

References

References

  1. [1]Al-Refaie, A. F., Changeat, Q., Waldmann, I. P., & Tinetti, G. (2021). TauREx 3: A fast, dynamic, and extendable framework for retrievals. The Astrophysical Journal, 917(1), 37. https://doi.org/10.3847/1538-4357/ac0252
  2. [2]Bradbury, J., Frostig, R., Hawkins, P., Johnson, M. J., Katariya, Y., Leary, C., Maclaurin, D., Necula, G., Paszke, A., VanderPlas, J., Wanderman-Milne, S., & Zhang, Q. (2018). JAX: Composable transformations of Python+NumPy programs. http://jax.readthedocs.io/en/latest/
  3. [3]Estrela, R., Swain, M. R., Roudier, G. M., West, R., Sedaghati, E., & Valio, A. (2021). Detection of aerosols at microbar pressures in an exoplanet atmosphere. The Astronomical Journal, 162(3), 91. https://doi.org/10.3847/1538-3881/ac0c7c
  4. [4]Fairnington, T. R., Radica, M., Zhang, M., Kempton, E. M.-R., Bean, J. L., Ahrer, E.-M., Savel, A. B., & D’Andrea, P. S. (2026). Recovering the morning and evening limbs of WASP-94Ab from its limb-averaged JWST transmission spectrum. arXiv e-Prints, arXiv:2609.20923. https://doi.org/10.48550/arXiv.2609.20923
  5. [5]Feroz, F., Hobson, M. P., & Bridges, M. (2009). MultiNest: An efficient and robust Bayesian inference tool for cosmology and particle physics. Monthly Notices of the Royal Astronomical Society, 398(4), 1601–1614. https://doi.org/10.1111/j.1365-2966.2009.1548.x
  6. [6]Kitzmann, D., Heng, K., Oreshenko, M., Grimm, S. L., Apai, D., Bowler, B. P., Burgasser, A. J., & Marley, M. S. (2020). Helios-r2: A new Bayesian, open-source retrieval model for brown dwarfs and exoplanet atmospheres. The Astrophysical Journal, 890(2), 174. https://doi.org/10.3847/1538-4357/ab6d71
  7. [7]Lange, J. U. (2023). nautilus: Boosting Bayesian importance nested sampling with deep learning. Monthly Notices of the Royal Astronomical Society, 525(2), 3181–3194. https://doi.org/10.1093/mnras/stad2441
  8. [8]MacDonald, R. J. (2023). POSEIDON: A multidimensional atmospheric retrieval code for exoplanet spectra. Journal of Open Source Software, 8(81), 4873. https://doi.org/10.21105/joss.04873
  9. [9]MacDonald, R. J., & Batalha, N. E. (2023). A catalog of exoplanet atmospheric retrieval codes. Research Notes of the AAS, 7(3), 54. https://doi.org/10.3847/2515-5172/acc46a
  10. [10]MacDonald, R. J., & Madhusudhan, N. (2017). HD 209458b in new light: Evidence of nitrogen chemistry, patchy clouds and sub-solar water. Monthly Notices of the Royal Astronomical Society, 469(2), 1979–1996. https://doi.org/10.1093/mnras/stx804
  11. [11]Okuta, R., Unno, Y., Nishino, D., Hido, S., & Loomis, C. (2017). CuPy: A NumPy-compatible library for NVIDIA GPU calculations. Proceedings of Workshop on Machine Learning Systems (LearningSys) in the Thirty-First Annual Conference on Neural Information Processing Systems (NIPS). http://learningsys.org/nips17/assets/papers/paper_16.pdf
  12. [12]Speagle, J. S. (2020). dynesty: A dynamic nested sampling package for estimating Bayesian posteriors and evidences. Monthly Notices of the Royal Astronomical Society, 493(3), 3132–3158. https://doi.org/10.1093/mnras/staa278
  13. [13]Tsai, S.-M., Innes, H., Wogan, N. F., & Schwieterman, E. W. (2024). Biogenic sulfur gases as biosignatures on temperate sub-Neptune waterworlds. The Astrophysical Journal Letters, 966(2), L24. https://doi.org/10.3847/2041-8213/ad3801
  14. [14]Wang, E., Kitzmann, D., Hoeijmakers, H. J., Ward enier, J. P., & Lecoq-Molinos, H. (2026). BeAR: The Bern atmospheric retrieval code – a GPU-accelerated framework for low-resolution, high-resolution, and joint retrievals of exoplanet atmospheres. arXiv e-Prints, arXiv:2611.08489. https://doi.org/10.48550/arXiv.2611.08489
  15. [15]Zhang, M., Chachan, Y., Kempton, E. M.-R., & Knutson, H. A. (2019). Forward modeling and retrievals with PLATON, a fast open-source tool. Publications of the Astronomical Society of the Pacific, 131(997), 034501. https://doi.org/10.1088/1538-3873/aaf5ad
  16. [16]Zhang, M., Chachan, Y., Kempton, E. M.-R., Knutson, H. A., & Chang, W. (Happy). (2020). PLATON II: New capabilities and a comprehensive retrieval on HD 189733b transit and eclipse data. The Astrophysical Journal, 899(1), 27. https://doi.org/10.3847/1538-4357/aba1e6
  17. [17]Zhang, M., Paragas, K., Bean, J. L., Yeung, J., Chachan, Y., Greene, T. P., Lunine, J., & Deming, D. (2025). Retrievals on NIRCam transmission and emission spectra of HD 189733b with PLATON 6, a GPU code for the JWST era. The Astronomical Journal, 169(1), 38. https://doi.org/10.3847/1538-3881/ad8cd2
  18. [18]Zhang, M., Xue, Q., Yang, J., Nagpal, V., Line, M. R., Fu, G., Nixon, M. C., Bean, J. L., Gao, P., Kempton, E. M.-R., Welbanks, L., Bryant, E. M., Bayliss, D., Brady, M., Désert, J.-M., Van Eylen, V., Fortney, J. J., Jordán, A., Parmentier, V., . . . Triad, A. H. M. J. (2026). C, N, O, S, and photochemistry in a temperate giant planet orbiting a late M dwarf. The Astrophysical Journal Letters, 1009(2), L28. https://doi.org/10.3847/2041-8213/aea4ae

Paper details

vlnc:W_turf28ez
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 7

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Fable 5, Claude Code, GPT-5.6 Sol (bare), Codex, Claude Opus 5.5 (bare), AI

View statement
Looking for related papers…
Contents