latent-riemannian-world
Riemannian geometry + Bayesian inference + world models for diffusion model latent spaces.
Why this library?
| latent-geometry | Diffusion-Pullback | lrw | |
|---|---|---|---|
| Pullback metric | ✓ | ✓ | ✓ |
| Fisher-Rao metric | ✗ | ✗ | ✓ |
| Bayesian metric | ✗ | ✗ | ✓ |
| Geodesic solver (IVP) | ✗ | ✗ | ✓ |
| Geodesic solver (BVP) | ✗ | ✗ | ✓ |
| Parallel transport | ✗ | ✗ | ✓ |
| SVGD / Riemannian SGLD | ✗ | ✗ | ✓ |
| World model / temporal | ✗ | ✗ | ✓ |
| Python 3.12+ / PyTorch 2.4+ | ✗ | ✗ | ✓ |
Installation
pip install latent-riemannian-world
Quick Start
import torch
from lrw.metric import PullbackMetric, BayesianMetric
from lrw.geodesic import GeodesicSolver, BVPSolver
from lrw.transport import SchildsLadder, PoleLadder
from lrw.bayes import SVGD, RiemannianSGLD
from lrw.world import LatentStateSpace, RiemannianRSSM
decoder = your_model.decode # (B, D) -> (B, C, H, W)
metric = PullbackMetric(decoder=decoder)
z = torch.randn(4, 16)
# IVP solver — fast, approximate
solver = GeodesicSolver(metric=metric)
path = solver.interpolate(z[0:1], z[1:2], n_points=10)
# BVP solver — true geodesic, guaranteed arrival at z1
bvp = BVPSolver(metric=metric, lr=0.1, max_iter=50)
true_path, info = bvp.geodesic_path(z[0:1], z[1:2], n_points=10)
print(f"Converged: {info['converged']}, error: {info['final_error']:.4f}")
IVP vs BVP
| GeodesicSolver (IVP) | BVPSolver | |
|---|---|---|
| Speed | Fast | Slower (iterative) |
| Arrival at z1 | Not guaranteed | Guaranteed |
| Use case | Prototyping | WAN keyframes, final quality |
Module Structure
lrw/
├── metric/ PullbackMetric, FisherMetric, BayesianMetric
├── geodesic/ GeodesicSolver (IVP), BVPSolver (true geodesic), slerp
├── transport/ SchildsLadder, PoleLadder
├── bayes/ SVGD, RiemannianSGLD
├── world/ LatentStateSpace, RiemannianRSSM
└── utils/ sym_inv, sym_sqrt, riemannian_norm, manifold_assert_*
References
- Shao et al. (2018) The Riemannian Geometry of Deep Generative Models. CVPR.
- Arvanitidis et al. (2018) Latent Space Oddity. ICLR.
- Park et al. (2023) Riemannian Geometry of Diffusion Models. NeurIPS.
- Liu et al. (2016) Stein Variational Gradient Descent. NeurIPS.
- Hafner et al. (2020) Dream to Control. ICLR.
License
BSL-1.1 — (c) 2025 lajjadred
Metadata
Release files for latent-riemannian-world 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| latent_riemannian_world-0.3.0.tar.gz | 19.2 kB | Without provenance | Details for latent_riemannian_world-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| latent_riemannian_world-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for latent_riemannian_world-0.3.0-py3-none-any.whl |
Total release size: 46.8 kB
Release files / latent_riemannian_world-0.3.0.tar.gz
| Download URL | latent_riemannian_world-0.3.0.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51b2af41154357dcd0958f6084849d9170fdf8e8035fca650a4420fa145441e3
|
|
BLAKE2b-256 checksum How to use checksums |
22b11c6dea777207156929239dbc90ccadcc9ddcf6b5fb7f37893806bdc5eeec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / latent_riemannian_world-0.3.0-py3-none-any.whl
| Download URL | latent_riemannian_world-0.3.0-py3-none-any.whl |
|---|---|
| Size | 27.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ae044d4f68d766dd1c77daacacd7645f5d6a26389322eef7bc8a57c29a5eeee
|
|
BLAKE2b-256 checksum How to use checksums |
c56e8b9c62611872f299af7e7a366de32213886452a77292aae46d1ef84cd91e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for latent-riemannian-world 0.3.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.