Skip to main content

GAHIB

A PyTorch implementation of a graph-attention variational autoencoder with an information bottleneck and a Lorentz hyperbolic geometry loss, applied to single-cell RNA-seq latent representation learning.

What it does

Given a scanpy AnnData with raw counts, GAHIB fits a VAE whose encoder can be an MLP, a Transformer, or a graph neural network (GAT, GCN, GraphSAGE, ChebConv, TAG, GraphTransformer, ARMA). The latent code is shaped by three losses:

  • a reconstruction term (NB, ZINB, Poisson, or ZIP),
  • an information-bottleneck term that compresses the latent into a 2D manifold coordinate, and
  • a Lorentz-hyperbolic term that anchors the manifold coordinate on the hyperboloid so radial distance encodes hierarchy.

Optional SDE and PDE modules are provided for trajectory experiments.

Install

pip install gahib
# graph encoders, scanpy and scVI helpers
pip install "gahib[all]"

For development, clone the repository and run pip install -e ".[all]".

Python 3.9 or later. Full dependency list in pyproject.toml.

Usage

import scanpy as sc
from gahib import GAHIB

adata = sc.read_h5ad("data/human_cd34_bone_marrow.h5ad")

model = GAHIB(
    adata,
    layer="counts",
    encoder_type="graph",
    graph_type="GAT",
    latent_dim=10,
    i_dim=2,
    irecon=1.0,
    lorentz=5.0,
)

model.fit(epochs=200, patience=30)
Z = model.get_latent()

Set encoder_type="mlp" (default) for a plain VAE without the graph encoder.

Important constraint

The hyperbolic loss depends on the information-bottleneck target. With irecon=0, the bottleneck coordinate is untrained and the Lorentz distance becomes degenerate. The model enforces this dependency internally.

Main outputs

Call Returns
model.get_latent() the learned embedding
model.get_time() the trajectory time estimate (if SDE)
model.get_centroid() per-cluster latent centroids

Experiment runners

The experiments/ directory contains reproducible runners for the benchmark and robustness studies. Each runner takes its dataset paths from GAHIB_DATASET_DIRS and writes results to GAHIB_results/{study}/.

Repository layout

gahib/       package source (core model, metrics, interpretation)
experiments/ benchmark and robustness runners
tests/       pytest suite

Tests

pytest

Citation

If you use GAHIB, please cite the article:

Fu Z, Fu J, Wang X, Liu Y, Ran T. GAHIB: graph attention VAE with a hyperbolic information bottleneck for biologically structured single-cell representations. Frontiers in Genetics. 2026;17:1863100. https://doi.org/10.3389/fgene.2026.1863100

@article{fu2026gahib,
  author  = {Fu, Zeyu and Fu, Jiawei and Wang, Xiaoxia and Liu, Yiyao and Ran, Tianfei},
  title   = {GAHIB: graph attention VAE with a hyperbolic information bottleneck for biologically structured single-cell representations},
  journal = {Frontiers in Genetics},
  volume  = {17},
  pages   = {1863100},
  year    = {2026},
  doi     = {10.3389/fgene.2026.1863100}
}

GitHub's "Cite this repository" button reads the same record from CITATION.cff.

License

MIT. See LICENSE.

Metadata

Release files for gahib 2.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 gahib 2.0.0
File Size Uploaded Provenance Actions
gahib-2.0.0.tar.gz 52.6 kB With provenance Details for gahib-2.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 106.3 kB

Release files / gahib-2.0.0.tar.gz

Download URL gahib-2.0.0.tar.gz
Size 52.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0fab60bbbe8a9ffdf9244a4c657e4e4adeeb8226aa407602240df72a469de64d
BLAKE2b-256 checksum
How to use checksums
3486d7cb16734dcec481d4bc90b8447ea0635c62bcd6f12cc5a6933eac32ec0f
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 16, 2026.

Transparency log

Release files / gahib-2.0.0-py3-none-any.whl

Download URL gahib-2.0.0-py3-none-any.whl
Size 53.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d49d401f8c058dfc65f670a01a7e6097d674f3ab0e4780b8c81d78ec2a2bc20d
BLAKE2b-256 checksum
How to use checksums
46a8d48dcac80b01edb5e0d856a054200430a0101b3bb4732be961e8ae33e4a4
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 16, 2026.

Transparency log

Security for gahib 2.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 gahib-2.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 16, 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

2.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