Skip to content

Repository files navigation

🌌 AION-1: AstronomIcal Omnimodal Network

License: MITPyTorcharXivOpen In ColabModel on HF

Polymathic's Large Omnimodal Model for Astronomy

🚀 Quick Start🎓 Tutorials🔬 Scientific Overview📦 Advanced Installation


🎯 Overview

AION Logo

AION-1 is a cutting-edge large omnimodal model specifically designed for astronomical surveys. It seamlessly integrates multiple data modalities, and enables simple adaptation to a wide range of astronomical tasks.

🚀 Quick Start

Assuming you have PyTorch installed, you can install AION trivially with:

pip install polymathic-aion

Then you can load the pretrained model and start analyzing astronomical data:

importtorchfromaionimportAIONfromaion.codecsimportCodecManagerfromaion.modalitiesimportLegacySurveyImage# Load model and codec managermodel=AION.from_pretrained('aion-base').to('cuda') # or 'aion-large', 'aion-xlarge'codec_manager=CodecManager(device='cuda')
# Prepare your astronomical data (example: Legacy Survey image)image=LegacySurveyImage(
flux=your_image_tensor, # Shape: [batch, 4, height, width] for g,r,i,z bandsbands=['DES-G', 'DES-R', 'DES-I', 'DES-Z']
)
# Encode data to tokenstokens=codec_manager.encode(image)
# Option 1: Extract embeddings for downstream tasksembeddings=model.encode(tokens, num_encoder_tokens=600)
# Option 2: Generate predictions (e.g., redshift)fromaion.modalitiesimportZpreds=model(
codec_manager.encode(image),
target_modality=Z,
)

🎓 Tutorials

Start with our interactive tutorial:

🔬 Scientific Overview

🧬 Architecture

AION-1 employs a two-stage, transformer-based design:

  1. Modality-Specific Tokenizers transform raw inputs into discrete tokens
  2. Unified Encoder–Decoder Transformer ingests all token streams via a multimodal masked modeling (4M) objective

🗂️ Supported Modalities

AION-1’s tokenizers cover 39 distinct data types, grouped by survey and data category

CategoryDescriptionToken Name(s)
Imaging (2)Legacy Survey, HSC Widetok_image_ls, tok_image_hsc
Catalog (1)Legacy Survey catalog entriescatalog
Spectra (2)SDSS, DESItok_spectrum_sdss, tok_spectrum_desi
Gaia (4)BP/RP spectra, parallax, sky coordstok_xp_bp, tok_xp_rp, tok_parallax, tok_ra, tok_dec
Gaia Photometry (3)G/BP/RP fluxtok_flux_g_gaia, tok_flux_bp_gaia, tok_flux_rp_gaia
Legacy Survey (9)g,r,i,z bands & WISE W1–W4 flux, E(B–V)tok_flux_g,…,tok_flux_w4, tok_ebv
Legacy Shape (3)Ellipticity components & effective radiustok_shape_e1, tok_shape_e2, tok_shape_r
HSC Photometry (5)g,r,i,z,y magnitudestok_mag_g,…,tok_mag_y
HSC Extinction (5)g,r,i,z,y extinctionstok_a_g,…,tok_a_y
HSC Shape (3)Shape components 11,22,12tok_shape11, tok_shape22, tok_shape12
Other (1)Spectroscopic redshifttok_z

📈 Model Variants

VariantEncoder BlocksDecoder BlocksModel DimHeadsTotal ParamsModel
Base121276812300 Maion-base
Large2424102416800 Msoon
XLarge24242048323 Bsoon

Pretraining – Global batch size: 8 192 – Steps: Base (1.5 days on 64 H100), Large (2.5 days on 100 H100), XLarge (3.5 days on 288 H100) – Optimizer: AdamW, peak LR 2 × 10⁻⁴, linear warmup + cosine decay

🔧 Data Preparation

AION uses a typed data system to understand the provenance of each astronomical observation. Each modality must be properly formatted:

Modality Types

fromaion.modalitiesimport (
LegacySurveyImage, HSCImage, # ImagesDESISpectrum, SDSSSpectrum, # SpectraLegacySurveyFluxG, HSCMagG, # PhotometryGaiaParallax, Z, # Scalars# ... and 30+ more modalities
)

Example: Preparing Legacy Survey Data

importtorchfromaion.modalitiesimportLegacySurveyImage, LegacySurveyFluxG# Format image data (shape: [batch, 4, height, width])image=LegacySurveyImage(
flux=torch.tensor(image_data, dtype=torch.float32),
bands=['DES-G', 'DES-R', 'DES-I', 'DES-Z']
)
# Format scalar photometryflux_g=LegacySurveyFluxG(value=torch.tensor([flux_values]))

Supported Data Formats

SurveyModalityRequired Format
Legacy SurveyImages4-band (g,r,i,z), any resolution (auto-cropped to 96×96)
HSCImages5-band (g,r,i,z,y), any resolution
DESI/SDSSSpectraFlux, inverse variance, wavelength arrays
GaiaBP/RPCoefficient arrays (55 coefficients each)
All SurveysScalarsSingle values or 1D tensors

💡 Example Use Cases

🔍 Similarity Search

Find galaxies similar to a query object across different modalities:

# Extract embeddings for similarity searchquery_embedding=model.encode(codec_manager.encode(query_image))
all_embeddings=model.encode(codec_manager.encode(*dataset_images))
# Find most similar objects using cosine similarityfromsklearn.metrics.pairwiseimportcosine_similaritysimilarity_scores=cosine_similarity(query_embedding, all_embeddings)
similar_objects=similarity_scores.argsort()[::-1][:10] # Top 10 similar

📊 Property Prediction

Build lightweight models on AION embeddings:

# Extract embeddings from multiple modalitiesembeddings=model.encode(codec_manager.encode(
image, spectrum, flux_g, flux_r, flux_i, flux_z
), num_encoder_tokens=900)
# Train simple regressor for stellar mass, redshift, etc.fromsklearn.neighborsimportKNeighborsRegressorregressor=KNeighborsRegressor(n_neighbors=5)
regressor.fit(embeddings.mean(axis=1), target_property)

🌌 Generative Modeling

Predict missing astronomical properties:

# Predict redshift from photometry + morphologypredictions=model(
codec_manager.encode(image, flux_g, flux_r, flux_i, flux_z),
target_mask={'tok_z': torch.zeros(batch_size, 1)},
num_encoder_tokens=600
)
redshift_probs=torch.softmax(predictions['tok_z'], dim=-1)

📦 Advanced Installation

AION offers flexible installation options to suit your environment and requirements.

To install AION with PyTorch included:

pip install polymathic-aion[torch]

For contributors and developers:

pip install polymathic-aion[torch,dev]

This includes testing frameworks, linting tools, and development dependencies.

For specific PyTorch versions (e.g., CUDA support):

# Install PyTorch with CUDA 12.4 support
pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu124
# Then install AION
pip install polymathic-aion

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🌟 Acknowledgments

AION is developed by Polymathic AI, advancing the frontier of AI for scientific applications. We would like to acknowledge the support of the Simons Foundation and of Schmidt Sciences. This project was provided with computer and storage resources by GENCI at IDRIS thanks to the grant 2024-GC011015468 on the supercomputer Jean Zay’s H100 partition. Additionally, some of the computations in this work were run at facilities supported by the Scientific Computing Core at the Flatiron Institute, a division of the Simons Foundation.

📬 Contact


Built with ❤️ for the astronomical community

About

Polymathic's Large Omnimodal Model for Astronomy

Resources

Stars

145 stars

Watchers

6 watching

Forks

Releases

Packages

Contributors

Languages