Skip to main content

geosae

Sparse autoencoders for Earth embeddings.

CI Coverage PyPI Python versions Documentation License: MIT DOI

geosae is a Python library for doing science with sparse autoencoders (SAEs) on Earth embeddings: pixel-level representations such as AlphaEarth and Tessera, and patch tokens of foundation models such as OlmoEarth and MMEarth. It builds patch stores of embeddings and reference products for the cells you choose, and trains SAEs that rewrite each embedding with a few active features from an overcomplete dictionary. It then evaluates any decomposition on the same pixels: an SAE, a frozen-decoder control, or raw dimensions, PCA, ICA and NMF. Everything is plain PyTorch, NumPy and Zarr, and every stage is both a Python function and a geosae command driven by one YAML config.

Features

Data

  • Build a Zarr store of 64 x 64 patches of 10 m pixels for any cells of the MajorTOM grid: a bounding box, a list of points or MajorTOM ids, or a seeded random sample of land cells, regional or global.
  • 39 registered products: AlphaEarth and Tessera embeddings; land cover (ESA WorldCover, ESA CCI, Esri, GLC_FCS30D, GLanCE, MODIS), crops, forest, water, settlements, terrain, soils, climate (CHELSA) and ecological partitions (RESOLVE, potential natural vegetation), each reprojected onto the patch grid.
  • Most sources are public and need no account, AlphaEarth included through a public mirror. Before a build starts, geosae checks the credentials of Google Earth Engine and NASA Earthdata products.
  • Plan mode lists sources, licences, sizes and credentials before fetching anything. Builds resume where they stopped and can add products to an existing store.

Models

  • BatchTopK, TopK, Matryoshka (nested prefixes) and ReLU+ℓ1 SAEs, and a frozen-decoder control whose random dictionary stays fixed while only the encoder trains.
  • One SparseAutoencoder contract and a registry: an architecture registered under a name runs through training, inference and every evaluation unchanged.

Training and inference

  • A single-device PyTorch trainer:
    • AuxK dead-feature revival;
    • warm-up and cosine decay;
    • bf16 on a GPU;
    • a controller that holds a ReLU+ℓ1 model at a target L0;
    • per-step pixel subsampling.
  • Inference writes padded sparse codes and per-patch feature statistics to a Zarr store. It also reports FVE, cosine similarity and L0.

Evaluation

  • Reconstruction at matched sparsity. A panel scores a whole ladder of runs and conventional baselines (raw, PCA, ICA, NMF) on one labelled pixel sample.
  • Concept alignment:
    • folded single-feature AUROC against every reference class;
    • coverage counts (UCov, EMF) with width-matched and block-permutation nulls;
    • comparisons at matched capacity.
  • Spatial scale: semivariance curves and correlation lengths per feature, and patch-mean Moran's I.
  • Monosemanticity scores, sub-concept discovery validated against null partitions, and an area-of-applicability estimate scored on graded hold-outs.
  • Further embeddings: OlmoEarth and MMEarth patch tokens computed from Sentinel-2, and the Copernicus-FM 0.25 degree map on a coarsened store.

Reproducibility

  • General configs ship inside the wheel (-c batchtopk, -c small, -c download).
  • Every run directory stores the resolved config it used, and every draw is seeded.

Installation

pip install geosae

geosae needs Python 3.11 or newer. For a GPU, install a CUDA build of PyTorch first, following pytorch.org, then geosae. Optional extras:

Extra For
download building a patch store from the upstream sources
embed encoding Sentinel-2 patches with OlmoEarth and MMEarth
viz plotting (matplotlib, nicefigs)
docs building the documentation
dev tests and linting
pip install "geosae[download]"

Quickstart

On a laptop CPU, these commands take about ten minutes. They build a store of 225 patches around Jena with AlphaEarth and ESA WorldCover (no account needed), train a small BatchTopK SAE, encode the test split and score concept alignment:

geosae download -c download -o download.out=data/quickstart.zarr \
    -o "download.cells.bbox=[11.0,50.5,12.0,51.2]" -o "download.products=[alphaearth_cog,lc_esa_wc]"
export GEOSAE_STORE=data/quickstart.zarr
geosae train    -c batchtopk -c small   # a run directory under runs/batchtopk/
geosae predict  -c batchtopk -c small   # sparse codes of the test split
geosae coverage -c batchtopk -c small   # folded-AUROC concept alignment

The Quickstart page walks through the same steps in Python and maps a feature.

Documentation

The user guide and the API reference are at https://earthyscience.github.io/geosae:

NeurIPS 2026 paper

Decomposing Earth Embeddings with Sparse Autoencoders
Vitus Benson, Fanny Yang, Markus Reichstein. Advances in Neural Information Processing Systems (NeurIPS 2026).

Earth observation foundation models produce global embeddings, and each of their dimensions entangles unrelated physical concepts. The paper proposes SAEs to decompose these embeddings into sparse features over an overcomplete dictionary. It also proposes an evaluation protocol for satellite pixels: it scores reconstruction at matched sparsity, alignment with reference concepts and spatial scale, each against baselines that include an SAE with a frozen random decoder.

On AlphaEarth and Tessera, SAEs reconstruct the embeddings better than every baseline at matched sparsity. Their features align with far fewer concepts than raw dimensions do, and they carry more variance at fine spatial scales. The frozen-decoder control shares both of these properties, so they follow from sparsity; only a learned dictionary reconstructs the embeddings accurately. Two applications show how sparse features could be used: discovering land-cover sub-concepts, and detecting out-of-distribution pixels by estimating an area of applicability. Neither is yet reliable enough for practical use.

  • The NeurIPS 2026 paper docs page covers the paper's configs and stages.
  • scripts/neurips2026/ holds the scripts behind every figure and table.
  • The Zenodo record holds the release source, every SAE checkpoint behind the paper and the input data of its figures and tables.

If you use geosae, please cite the paper:

Benson, V., Yang, F., & Reichstein, M. (2026). Decomposing Earth Embeddings with Sparse Autoencoders. Advances in Neural Information Processing Systems (NeurIPS 2026).

BibTeX
@inproceedings{benson2026decomposing,
  title     = {Decomposing Earth Embeddings with Sparse Autoencoders},
  author    = {Benson, Vitus and Yang, Fanny and Reichstein, Markus},
  booktitle = {Advances in Neural Information Processing Systems (NeurIPS 2026)},
  year      = {2026}
}

CITATION.cff holds the same reference and the software record.

Contributing

Issues and pull requests are welcome at github.com/EarthyScience/geosae. make dev installs the package with its development tools and the git hooks. make check runs what CI enforces: pre-commit, the test suite and a strict documentation build.

License

MIT; see LICENSE. The data sources geosae downloads keep their own licences, which geosae download -o download.plan=true lists. The MajorTOM grid arithmetic is adapted from eodata, under the BSD 3-Clause License; see NOTICE.

Acknowledgements

This work has received funding from the European Union under the Horizon Europe project WeatherGenerator (grant agreement 101187947). The data downloads owe much to Sebastian Hoffmann and Markus Zehner's work on eodata. geosae rests entirely on openly shared embeddings and reference products; we thank the many teams who produce, curate and release them.

Metadata

Release files for geosae 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geosae 1.0.0
File Size Uploaded Provenance Actions
geosae-1.0.0.tar.gz 457.6 kB With provenance Details for geosae-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for geosae 1.0.0
File Interpreter ABI Platform Actions
geosae-1.0.0-py3-none-any.whl Python 3 none any Details for geosae-1.0.0-py3-none-any.whl

Total release size: 837.2 kB

Release files / geosae-1.0.0.tar.gz

Download URL geosae-1.0.0.tar.gz
Size 457.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0597e7a0d14b9d65e94849211116eb452321308228760f792ddbd0100adf9638
BLAKE2b-256 checksum
How to use checksums
2634117d1da407ffc4464b4fa83d2b89d99331a27e543b8458b2b80926d3d5da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / geosae-1.0.0-py3-none-any.whl

Download URL geosae-1.0.0-py3-none-any.whl
Size 379.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a257521de3384473c42e30bd022ec26d16e35ce1e6fff12ce2982534b111a9b9
BLAKE2b-256 checksum
How to use checksums
42ea05504fb9c52e382ab4934d366581e6c02557801a91f625a9c035ab49ce5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for geosae 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for geosae-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page