AI in JWST: Classifying Galaxies and Gravitational Lenses

This article explores how extragalactic astronomers utilize deep learning artificial intelligence to analyze vast amounts of imagery from the James Webb Space Telescope (JWST). By employing advanced neural networks, researchers rapidly classify early-universe galaxy morphologies and detect rare strong gravitational lenses. These automated techniques bypass the bottlenecks of manual human inspection, enabling scientists to map the structural evolution of the cosmos and distribution of dark matter with unprecedented speed and accuracy.

The James Webb Space Telescope generates petabytes of high-resolution infrared data, capturing hundreds of thousands of distant galaxies in a single observation field. Traditional methods of visual classification, whether by small teams of astronomers or citizen science projects, cannot keep pace with this data volume. Deep learning models solve this problem by automating image analysis, processing tens of thousands of astronomical targets in minutes rather than months.

To classify the shapes—or morphologies—of early-universe galaxies, astronomers rely heavily on Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs). These algorithms are designed to recognize spatial hierarchies and patterns in pixel data. When applied to JWST imagery, the AI examines pixel intensity, light distribution, and structural symmetry across multiple infrared wavelengths. The models then categorize galaxies into distinct morphological classes, such as smooth spheroids, spiral disks, irregular systems, or active galaxy mergers.

Training these AI models requires a baseline of existing knowledge, which poses a challenge since JWST observes the universe at unprecedented depths. Astronomers overcome this by training neural networks on synthetic datasets created from cosmological hydrodynamical simulations, as well as real archival data from the Hubble Space Telescope. To make the simulations realistic, researchers inject simulated JWST instrument noise and point-spread function (PSF) effects into the training images. Once the AI learns to identify galaxy structures under these simulated conditions, astronomers use transfer learning to fine-tune the model on a small, human-verified subset of actual JWST images before deploying it across massive, unlabeled survey fields.

Through this automated morphological classification, deep learning has revealed that the early universe was far more structurally mature than previously theorized. AI models analyzing JWST data have identified a high abundance of well-formed, massive disk galaxies existing less than a billion years after the Big Bang, challenging earlier models of cosmic evolution that predicted early galaxies would be predominantly chaotic and irregular.

Alongside morphological classification, astronomers use deep learning to hunt for strong gravitational lenses. Gravitational lensing occurs when a massive foreground galaxy or cluster warps the fabric of spacetime, bending and magnifying the light of a more distant background galaxy into distorted arcs or complete Einstein rings. These cosmic alignments are invaluable because they act as natural telescopes, magnifying the earliest galaxies in the universe and allowing astronomers to map the invisible dark matter of the foreground object.

However, strong gravitational lenses are exceptionally rare, appearing in less than one out of every thousand galaxies, and their warped light often blends in with the complex structures of standard spiral galaxies. To find them in JWST imagery, astronomers train deep residual networks (ResNets) and object-detection algorithms on millions of simulated lensing events. Scientists take real images of foreground galaxies, mathematically superimpose distorted background light based on Einstein's theory of general relativity, and train the AI to spot the telltale arcs and rings.

Beyond standard supervised learning, astronomers also employ unsupervised deep learning techniques, such as autoencoders and self-organizing maps, to scan JWST data for anomalies. An autoencoder learns to compress and reconstruct "normal" galaxy images; when it encounters a bizarrely warped gravitational lens, it fails to reconstruct the image accurately, flagging the object for human review. This approach ensures that uniquely configured lenses that do not match human-made simulations are still discovered.

Once the deep learning pipelines assign high probability scores to specific galaxy morphologies or lensing candidates, the data is passed back to astronomers for spectroscopic follow-up and physical modeling. By handling the initial heavy lifting of pattern recognition, deep learning allows extragalactic astronomers to focus purely on the physics of how the first galaxies formed and how dark matter shaped the early cosmos.