L.I.L.I.T.H. (Long-range Intelligent Learning for Integrated Trend Hindcasting)
A lightweight, open-source weather prediction model trained on GHCN data.
Python 3.10+
PyTorch
License
Model Description
LILITH is a transformer-based weather forecasting model designed to run on consumer hardware (e.g., RTX 3060). It learns from 150+ years of station-based observations (GHCN-Daily) to predict 90-day temperature and precipitation trends with uncertainty quantification.
Every day, corporations charge billions of dollars for weather forecasts built on freely available public data. The Global Historical Climatology Network (GHCN)—maintained by NOAA with taxpayer funding—contains over 150 years of weather observations from 100,000+ stations worldwide. This data is public domain. It belongs to humanity.
Yet somehow, we've accepted that accurate long-range forecasting should be locked behind enterprise paywalls and proprietary black boxes.
LILITH exists to change that.
With a single consumer GPU (RTX 3060, 12GB), you can now train and run a weather prediction model that delivers 90-day forecasts with uncertainty quantification—the same capabilities that corporations charge premium prices for. No cloud subscriptions. No API limits. No black boxes.
┌────────────────────────────────────────────────────────────────────────────┐
│ │
│ "The same public data that corporations use to train billion-dollar │
│ weather systems is available to anyone with a GPU and curiosity." │
│ │
└────────────────────────────────────────────────────────────────────────────┘
The Data is Free. The Science is Open. The Code is Yours
What Corporations Charge For
What LILITH Provides Free
90-day extended forecasts
90-day forecasts with uncertainty bands
"Proprietary" ML models
Fully transparent architecture
Enterprise API access
Self-hosted, unlimited queries
Historical climate analytics
150+ years of GHCN data access
Per-query pricing
Run on your own hardware
Why LILITH
The Problem
Modern weather AI (GraphCast, Pangu-Weather, FourCastNet) achieves remarkable accuracy, but:
Requires ERA5 reanalysis data — computationally expensive to generate, controlled by ECMWF
Needs massive compute — training requires hundreds of TPUs/GPUs
Inference is heavy — full global models need 80GB+ VRAM
Production Ready — Docker containers, Redis caching, PostgreSQL + TimescaleDB
User Experience
Glassmorphic UI — Beautiful, modern interface with dynamic weather backgrounds
Interactive Maps — Mapbox GL JS with temperature layers and station markers
Rich Visualizations — Recharts/D3 for forecasts, uncertainty bands, wind roses
Historical Explorer — Analyze 150+ years of climate trends
Quick Start
Prerequisites
Python 3.10+
CUDA-capable GPU (12GB+ VRAM recommended)
Node.js 18+ (for frontend)
Quick Start with Pre-trained Model
If you have a trained checkpoint (e.g., lilith_best.pt), you can run the full stack immediately:
bash
1# 1. Clone and setup2git clone https://github.com/consigcody94/lilith.git
3cd lilith
4python -m venv .venv
5.venv\Scripts\activate # Windows6# source .venv/bin/activate # Linux/Mac78# 2. Install dependencies9pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
10pip install -e ".[all]"1112# 3. Place your checkpoint in the checkpoints folder13mkdir checkpoints
14# Copy lilith_best.pt to checkpoints/1516# 4. Set OpenWeatherMap API Key (Optional but recommended for live data)17exportOPENWEATHER_API_KEY="your_api_key_here"# Linux/Mac18# set OPENWEATHER_API_KEY=your_api_key_here # Windows1920# 5. Start the API server (auto-detects checkpoint)21python -m uvicorn web.api.main:app --host 127.0.0.1 --port 80002223# 6. In a new terminal, start the frontend24cd web/frontend
25npminstall26npm run dev
2728# 7. Open http://localhost:3000 in your browser
The API will automatically find and load checkpoints/lilith_best.pt or checkpoints/lilith_final.pt. You'll see log output like:
Found checkpoint at C:\...\checkpoints\lilith_best.pt
Model loaded on cuda
Config: d_model=128, layers=4
Val RMSE: 3.96°C
Model loaded successfully (RMSE: 3.96°C)
1# Clone the repository2git clone https://github.com/consigcody94/lilith.git
3cd lilith
45# Create and activate virtual environment6python -m venv .venv
7source .venv/bin/activate # Linux/Mac8# .venv\Scripts\activate # Windows910# Install with all dependencies11pip install -e ".[all]"
Download Data
bash
1# Download GHCN-Daily station data2python scripts/download_data.py --source ghcn-daily --stations 5000 --years 5034# Process and prepare for training5python scripts/process_data.py --config configs/data/default.yaml
Training
LILITH training is designed to work on consumer GPUs. Here's a complete step-by-step guide:
Step 1: Environment Setup
bash
1# Create and activate virtual environment2python -m venv .venv
3.venv\Scripts\activate # Windows4# source .venv/bin/activate # Linux/Mac56# Install PyTorch with CUDA support7# For RTX 30/40 series:8pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
910# For RTX 50 series (Blackwell - requires nightly):11pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
1213# Install LILITH dependencies14pip install -e ".[all]"
Step 2: Download Training Data
bash
1# Download GHCN station data (start with 300 stations for quick training)2python -m data.download.ghcn_daily \3 --stations 300\4 --min-years 30\5 --country US
67# For better models, download more stations8python -m data.download.ghcn_daily \9 --stations 5000\10 --min-years 20\11 --elements TMAX,TMIN,PRCP
1213# Download climate indices for long-range prediction14python -m data.download.climate_indices --all
Step 3: Process Data
bash
1# Process raw GHCN data into training format2python -m data.processing.ghcn_processor
34# This creates:5# - data/processed/ghcn_combined.parquet (all station data)6# - data/processed/training/X.npy (input sequences)7# - data/processed/training/Y.npy (target sequences)8# - data/processed/training/meta.npy (station metadata)9# - data/processed/training/stats.npz (normalization stats)
Step 4: Train the Model
bash
1# Quick training (30 epochs, good for testing)2python -m training.train_simple \3 --epochs 30\4 --batch-size 64\5 --d-model 128\6 --layers 478# Full training (100 epochs, production quality)9python -m training.train_simple \10 --epochs 100\11 --batch-size 128\12 --d-model 256\13 --layers 6\14 --lr 1e-4
1516# Resume training from checkpoint17python -m training.train_simple \18 --resume checkpoints/lilith_best.pt \19 --epochs 50
1# Update the API to use your trained model2# Edit web/api/main.py and set DEMO_MODE = False34# Or run inference directly5python -m inference.forecast \6 --checkpoint checkpoints/lilith_best.pt \7 --lat 40.7128 --lon -74.006 \8 --days 90
Training on Multiple GPUs
bash
1# Using PyTorch DistributedDataParallel2torchrun --nproc_per_node=2 training/train_distributed.py \3 --config models/configs/large.yaml
45# Using DeepSpeed for memory efficiency6deepspeed --num_gpus=4 training/train_deepspeed.py \7 --config models/configs/xl.yaml \8 --deepspeed configs/training/ds_config.json
Memory Requirements
Model Size
Batch Size
VRAM Required
d_model=128
64
~4 GB
d_model=256
64
~8 GB
d_model=256
128
~12 GB
d_model=512
64
~16 GB
Training Tips
Start small: Train with 300 stations first to verify everything works
Monitor GPU usage: Use nvidia-smi to ensure GPU is being utilized
Watch for overfitting: If val loss increases while train loss decreases, reduce epochs
Save checkpoints: The best model is automatically saved to checkpoints/lilith_best.pt
Use mixed precision: Enabled by default (FP16), cuts memory usage in half
Pre-trained Models
Using Pre-trained Checkpoints
Once a model is trained, you do not need to retrain — the checkpoint file contains everything needed for inference. Anyone can download and use pre-trained models.
Checkpoint File Contents
The .pt checkpoint file (~20-50MB depending on model size) contains:
python
1checkpoint ={2'epoch':20,# Training epoch when saved3'model_state_dict':{...},# All learned weights4'optimizer_state_dict':{...},# Optimizer state (for resuming training)5'val_loss':0.2456,# Validation loss at checkpoint6'val_rmse':1.89,# Temperature RMSE in °C7'config':{# Model architecture config8'input_features':3,9'output_features':3,10'd_model':128,11'nhead':4,12'num_encoder_layers':4,13'num_decoder_layers':4,14'dropout':0.115},16'normalization':{# Data normalization stats17'X_mean':[...],18'X_std':[...],19'Y_mean':[...],20'Y_std':[...]21}22}
Pre-trained Checkpoint Included
A pre-trained checkpoint (lilith_best.pt) is included in the checkpoints/ folder. This model was trained on:
915,000 sequences from 300 US GHCN stations
20 epochs of training
Validation RMSE: 3.96°C
You can use this checkpoint immediately or train your own model with different data/parameters.
Model Specifications
Model
Parameters
File Size
VRAM (Inference)
Best For
SimpleLILITH
1.87M
~23 MB
2-4 GB
Default model, fast training
lilith-base
150M
~45 MB
4 GB
Balanced accuracy/speed
lilith-large
400M
~120 MB
8 GB
High accuracy
GPU Requirements for Inference
Unlike training, inference requires much less VRAM. Here's what you can run on different hardware:
1# Set checkpoint path2exportLILITH_CHECKPOINT=checkpoints/lilith_best.pt
34# Start API (will use trained model instead of demo mode)5python -m web.api.main
67# Or specify directly8python -m uvicorn web.api.main:app --host 0.0.0.0 --port 8000
1# Tag your release2git tag -a v1.0 -m "LILITH Base v1.0 - Trained on 915K sequences"3git push origin v1.0
45# Upload checkpoint to release (via GitHub UI or gh cli)6gh release create v1.0 checkpoints/lilith_best.pt --title "LILITH v1.0"
Model Training Metrics
When training completes, you'll see metrics like:
┌────────────────────────────────────────────────────────────────┐
│ LILITH TRAINING COMPLETE │
├────────────────────────────────────────────────────────────────┤
│ Epochs: 20 │
│ Training Samples: 915,001 │
│ Final Train Loss: 0.2134 │
│ Final Val Loss: 0.2456 │
│ Temperature RMSE: 1.89°C │
│ Temperature MAE: 1.42°C │
│ Checkpoint: checkpoints/lilith_best.pt (22.8 MB) │
├────────────────────────────────────────────────────────────────┤
│ Model Config: │
│ - Parameters: 1,869,251 │
│ - d_model: 128 │
│ - Attention Heads: 4 │
│ - Encoder Layers: 4 │
│ - Decoder Layers: 4 │
└────────────────────────────────────────────────────────────────┘
Resuming Training
bash
1# Continue training from checkpoint2python -m training.train_simple \3 --resume checkpoints/lilith_best.pt \4 --epochs 50\5 --lr 5e-5 # Lower learning rate for fine-tuning67# The checkpoint includes optimizer state, so training continues smoothly
Model Comparison
Checkpoint
Epochs
Training Data
Val RMSE
File Size
Notes
lilith_v0.1.pt
10
100K samples
4.3°C
22 MB
Quick test
lilith_v0.5.pt
30
500K samples
2.8°C
22 MB
Development
lilith_v1.0.pt
100
915K samples
1.9°C
22 MB
Production
lilith_large_v1.pt
100
2M samples
1.5°C
120 MB
Best accuracy
Inference
bash
1# Generate a forecast2python scripts/run_inference.py \3 --checkpoint checkpoints/best.pt \4 --lat 40.7128 --lon -74.006 \5 --days 9067# Start the API server8python scripts/start_api.py --checkpoint checkpoints/best.pt --port 8000910# Query the API11curl -X POST http://localhost:8000/v1/forecast \12 -H "Content-Type: application/json"\13 -d '{"latitude": 40.7128, "longitude": -74.006, "days": 90}'
Web Interface
bash
1cd web/frontend
2npminstall3npm run dev
4# Open http://localhost:3000
1{2"location":{"latitude":40.7128,"longitude":-74.006,"name":"New York, NY"},3"generated_at":"2025-01-15T12:00:00Z",4"model_version":"lilith-base-v1.0",5"forecasts":[6{7"date":"2025-01-16",8"temperature":{"mean":2.5,"min":-1.2,"max":6.8},9"precipitation":{"probability":0.35,"amount_mm":2.1},10"wind":{"speed_ms":5.2,"direction_deg":270},11"uncertainty":{"temperature_std":1.2,"confidence":0.85}12}13]14}
GET /v1/historical/{station_id}
Retrieve historical observations for a station.
GET /health
Health check endpoint.
Contributing
We welcome contributions from the community. LILITH is built on the principle that weather forecasting should be accessible to everyone, and that means building in the open with help from anyone who shares that vision.
Ways to Contribute
Code: Model improvements, new features, bug fixes
Data: Additional data sources, quality control improvements
Documentation: Tutorials, guides, API documentation
Testing: Unit tests, integration tests, benchmarking
Design: UI/UX improvements, visualizations
Development Setup
bash
1# Fork and clone (replace with your username if you fork)2git clone https://github.com/consigcody94/lilith.git
3cd lilith
45# Install development dependencies6pip install -e ".[dev]"78# Install pre-commit hooks9pre-commit install1011# Run tests12pytest tests/ -v
1314# Run linting15ruff check .16mypy .
Pull Request Process
Fork the repository
Create a feature branch (git checkout -b feature/amazing-feature)
Make your changes
Run tests and linting
Commit with clear messages
Push and open a Pull Request
Acknowledgments
U.S. Government AI Initiatives
We thank President Donald Trump and his administration for the Stargate AI Initiative and commitment to advancing American AI research and infrastructure. The recognition that AI development—including open-source projects like LILITH—represents a critical frontier for innovation, economic growth, and global competitiveness has helped create an environment where ambitious projects like this can flourish. The initiative's focus on building domestic AI capabilities and infrastructure supports the democratization of advanced technologies for all Americans.
Data Providers
NOAA NCEI — For maintaining the invaluable GHCN dataset as a public resource funded by U.S. taxpayers
ECMWF — For ERA5 reanalysis data
Research Community
GraphCast (Google DeepMind) — Pioneering ML weather prediction
Pangu-Weather (Huawei) — Advancing transformer architectures for weather
FourCastNet (NVIDIA) — Demonstrating Fourier neural operators for atmospheric modeling
FuXi (Fudan University) — Pushing boundaries in subseasonal forecasting
Open Source
PyTorch team for the deep learning framework
Hugging Face for model hosting infrastructure
The countless contributors to the Python scientific computing ecosystem
1# Linux/Mac2exportOPENWEATHER_API_KEY="your_key_here"34# Windows PowerShell5$env:OPENWEATHER_API_KEY="your_key_here"67# Windows CMD8setOPENWEATHER_API_KEY=your_key_here
Using the Pre-trained Model
A pre-trained model is available in the releases. This model was trained on:
505 US GHCN stations with 9.6 million weather records
1.15 million training sequences
10 epochs of training (~5 hours on CPU, ~1 hour on GPU)
Final RMSE: 3.88°C (temperature prediction accuracy)
Download and use:
bash
1# Download from releases2curl -L -o checkpoints/lilith_best.pt https://github.com/consigcody94/lilith/releases/download/v1.0/lilith_best.pt
34# Start with the model5LILITH_CHECKPOINT=checkpoints/lilith_best.pt python -m uvicorn web.api.main:app --port 8000
Live Data & Caching
LILITH fetches live data from external APIs. To avoid hitting rate limits:
OpenWeatherMap (Forecast Adjustments)
Source: api.openweathermap.org
Cache: 15 minutes per location
Rate Limit: 1,000 calls/day on free tier
Used for fallback forecasts when ML model is unavailable
To disable live data fetching entirely and use only the ML model:
python
1# In web/api/main.py, set _weather_service to None2_weather_service =None# Disables OpenWeatherMap calls
Running Without API Keys
If you don't want to set up API keys, the app will still work but with limited features:
Training data is cached locally. To avoid re-downloading on every build:
bash
1# Check if data exists before downloading2if[! -d "data/raw/ghcn_daily/stations"];then3 python scripts/download_data.py --max-stations 5004fi56# Or use the --skip-existing flag7python scripts/download_data.py --max-stations 500 --skip-existing
License
Copyright 2025 LILITH Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Citation
If you use LILITH in your research, please cite:
bibtex
1@software{lilith2025,
2 author = {LILITH Contributors},
3 title = {LILITH: Long-range Intelligent Learning for Integrated Trend Hindcasting},
4 year = {2025},
5 url = {https://github.com/consigcody94/lilith}
6}
"The storm goddess sees all horizons."
Weather prediction should be free. The data is public. The science is open. Now the tools are too.