Abstract
AstroLLaMA is a 7-billion-parameter large language model (LLM) specialized for the field of astronomy. By fine-tuning LLaMA-2 on over 300,000 arXiv abstracts using domain-adaptation techniques, the model achieves significantly lower perplexity and generates more technically accurate content compared to general-purpose models like GPT-4. This paper details the development, evaluation, and superior embedding performance of AstroLLaMA, demonstrating the power of domain-specific specialization in foundation models.
Introduction
While general-purpose large language models (LLMs) like GPT-4 and LLaMA-2 have demonstrated remarkable capabilities, they often struggle with highly specialized scientific domains. In astronomy, scholarly text represents a negligible fraction of the massive internet datasets used for general training, leading to "hallucinations" or overly generic responses when these models are prompted with niche research questions.
Previous specialized models, such as astroBERT, were limited by their small scale and discriminative nature, which prevented them from generating new scientific content. AstroLLaMA was developed to bridge this gap, serving as a generative foundation model capable of assisting researchers with hypothesis generation, summarization, and complex reasoning within the astronomical domain.
Methodology and Data
The researchers employed a domain-adaptation approach, starting with the open-source LLaMA-2 (7B) as the base model. To optimize computational efficiency, the team utilized 4-bit quantization and LoRA (Low-Rank Adaptation), allowing the model to be fine-tuned on four NVIDIA A100 GPUs.
The training corpus consisted of 326,238 abstracts from the arXiv astro-ph category, spanning from 1992 to 2023. This dataset comprised approximately 95 million tokens. The model was trained using Causal Language Modeling for three epochs, following a cosine learning rate schedule.
Key Results and Performance
AstroLLaMA demonstrated significant improvements over its base model and general-purpose competitors. It achieved a 30% reduction in perplexity compared to the original LLaMA-2, dropping from an average of ~10 to 6.55.
Qualitative Accuracy
In head-to-head comparisons, AstroLLaMA avoided the "generic trap" common in larger models. When asked about identifying stars in the Magellanic Stream, GPT-4 provided broad suggestions about machine learning, whereas AstroLLaMA correctly identified specific astronomical catalogs (e.g., Gaia EDR3) and physical markers like [Fe/H] chemical signatures.
Embedding Nuance
One of the model's most significant strengths is its embedding space. AstroLLaMA provides much higher variance in its text embeddings compared to general models like GPT-3 (ada-002). This allows it to better distinguish between papers that may share keywords but discuss fundamentally different physical contexts.
Discussion and Future Work
Despite its successes, AstroLLaMA is not without limitations. It occasionally exhibits "numerical hallucinations," inventing specific values that appear plausible but are factually incorrect. It also shows knowledge gaps regarding specific candidate counts in certain surveys.
To address these issues, future iterations will expand the training set from abstracts to full LaTeX sources of astronomy papers. This expansion is expected to increase the training data by approximately 100x, significantly enhancing the model's reasoning capabilities and factual accuracy. The weights for AstroLLaMA have been released publicly on Hugging Face to foster community-driven development in astronomical research tools.
Summary updated