Skip to main content

Manifold: Geometric Intelligence via Symplectic Geodesic Flows | GFN: Geometric Flow Networks

Project description

Manifold

Geometric Intelligence via Symplectic Geodesic Flows.

VERSION License Physics Documentation


Overview

Manifold is a fundamental reimagining of neural sequence modeling. Instead of relying on static attention matrices ($O(N^2)$) or unstable recurrent states, Manifold formulates intelligence as Optimal Transport on a dynamic Riemannian Manifold. It treats the hidden state as a physical particle traversing a learned geometry, governed by strictly energy-conserving Symplectic Integrators, enabling infinite context windows with constant memory.


Installation

pip install gfn

Or install from source for development:

git clone https://github.com/ManifoldPhysics/Manifold.git
cd Manifold
pip install -e "."


Core Idea

The central hypothesis of Manifold is that "reasoning" is geometric traversal. By learning a Metric Tensor $g_{\mu\nu}(x)$ that warps space in response to semantic density, the model naturally forms "gravity wells" around logical certainties and "expands space" (time dilation) around ambiguities. This allows the network to solve complex long-range dependencies not by "attending" to the past, but by evolving a state that physically conserves the information momentum required to solve the task.


Loss Landscape Analysis

Loss Landscape 3D

The visualization above compares the optimization topology of Manifold (Left) versus a standard GRU/LSTM Baseline (Right). The Z-axis represents the loss value.

Manifold exhibits a remarkably convex and smooth landscape. Because the flow is Symplectic (volume-preserving), gradients flow through the system without exploding or vanishing, creating a global funnel that leads directly to the optimum. The Baseline, in contrast, shows a "chaotic" landscape riddled with sharp local minima and high-frequency noise, explaining why standard RNNs struggle to converge on long-horizon tasks.


Optimization Geometry

Loss Landscape Contours

This contour map view reveals the "stability basin" of the architecture.

  • Manifold (Left): The concentric rings indicate a well-conditioned Hamiltonian system. Perturbations in the weights result in proportional changes in loss, making training robust to hyperparameter variance.
  • Baseline (Right): The distorted, non-convex regions create optimization barriers. This requires ad-hoc fixes like gradient clipping or specific initialization to navigate, whereas Manifold is stable by design.

Generalization Performance

Parity Generalization

We tested Zero-Shot Generalization on the Parity Task, a notoriously difficult problem for RNNs requiring infinite precision memory.

  • Blue Line (Manifold): Maintains near-100% accuracy even as sequence length extends far beyond the training distribution (Out-Of-Distribution). The symplectic state conservation means the "parity bit" information never decays.
  • Red Line (MicroGPT/Standard): Performance collapses immediately once the sequence length exceeds the training window. The model failed to learn the algorithm and merely memorized the pattern.

Memory & Scaling

VRAM Scaling

The "Log-Log" plot above demonstrates the "Infinite Context" breakthrough.

  • Manifold (Blue): The VRAM usage is a perfectly horizontal line. Whether processing 128 tokens or 1 million tokens, the memory state size ($dim \times 2$) remains constant.
  • Transfomer (Orange): The $O(N^2)$ Attention Matrix causes memory to explode exponentially. At ~32k tokens, even efficient Transformers run Out-Of-Memory (OOM) on consumer hardware.

$$ \text{Manifold Memory} \propto O(1) \quad \text{vs} \quad \text{Transformer Memory} \propto O(N^2) $$


Architectural Properties

Manifold integrates five distinctive "Cognitive Physics" components:

  1. Reactive Curvature ($\Gamma$): The manifold stiffens (high curvature) when uncertainty is high, effectively slowing down the "subjective time" of the token to allow for deeper processing.
  2. Logical Singularities: High-confidence predictions act as energetic attractors (Black Holes), locking the trajectory into a semantic decision.
  3. Fractal Tunneling: The state-space is recursive. Complex tokens trigger a "zoom" into a sub-manifold, allowing the model to allocate hierarchical compute density.
  4. Noether Invariance: The architecture enforces symmetry constraints, ensuring that logical rules learned in one context apply universally (Generalization).
  5. Symplectic Integration: The Hamiltonian (Energy) of the system is preserved, preventing the catastrophic forgetting common in long sequences.

Comparison Summary

Compared to the current state-of-the-art:

  • Vs Transformers: Manifold offers Infinite Context and Constant Memory, whereas Transformers are limited by context window size and quadratic compute.
  • Vs RWKV / Mamba: While these are also efficient RNNs, Manifold is the only one based on Symplectic Geometry, offering superior numerical stability and a convex loss landscape for easier training.
  • Vs LSTM/GRU: Manifold eliminates the vanishing gradient problem entirely via the Adjoint Sensitivity method and provides strictly better generalization.

Use Cases

  • Long-Document Analysis: Processing entire books or legal repositories in a single pass without "chunking".
  • Robotics & Control: The continuous-time physics engine makes it ideal for real-world continuous data streams.
  • Scientific Modeling: Predicting chaotic systems (weather, fluid dynamics) where conservation laws must be respected.
  • Edge AI: Running high-intelligence models on devices with extremely limited RAM (e.g., 4GB or less).

Development Maturity

Manifold v1.0.0 has reached a stable production milestone. The core Symplectic Engine and Active Inference modules have been rigorously verified against standard baselines, demonstrating the predicted O(1) memory scaling and numerical stability in reproducible benchmarks. The kernel backend (Fused CUDA) is fully optimized for NVIDIA Turing/Ampere architectures.


Research Trajectory

The Manifold Laboratory is currently focused on scaling geometric intelligence to the billion-parameter regime.

  1. Hyperscale Pre-training: Validating the physics engine's loss convergence properties at 1B+ parameters on the Pile dataset.
  2. Multi-Manifold MoE: Developing a "Mixture of Geometries" architecture where different expert heads operate on topologically distinct manifolds (e.g., Hyperbolic for hierarchy, Euclidean for logic).
  3. Native Multimodal Flows: extending the geodesic formalism to continuous data streams (Audio/Video), treating them as unrolling surfaces rather than discrete tokens.
  4. Hardware-Native Symplectic Logic: Designing custom FPGA/ASIC kernels that enforce energy conservation at the circuit level.

Repository Structure

/
├── src/                # Core Manifold Source Code
│   ├── model.py        # The Main Architecture
│   ├── geometry.py     # Riemannian Metric & Curvature
│   └── physics.py      # Symplectic Integrators
├── docs/               # Deep Technical Documentation
│   ├── PHYSICS.md      # Mathematical Derivations
│   ├── BENCHMARKS.md   # Full Performance Reports
│   └── API.md          # Developer Verification
├── tests/              # Verification Suite
│   └── benchmarks/     # Reproducible Science Scripts
└── LICENSE             # Apache 2.0

Manifold Laboratory
Forging the physics of intelligence.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gfn-2.0.0.tar.gz (42.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gfn-2.0.0-py3-none-any.whl (49.3 kB view details)

Uploaded Python 3

File details

Details for the file gfn-2.0.0.tar.gz.

File metadata

  • Download URL: gfn-2.0.0.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for gfn-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ac31a76bab672b95bded49698813adc20eb022b945383240dfc8f1ad563119c1
MD5 6b05b08064f8351ec4d8128fc762ff63
BLAKE2b-256 845fdd5271879965f489c86273341293ae399b8964427b7d04d3c829f1d53909

See more details on using hashes here.

File details

Details for the file gfn-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: gfn-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 49.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for gfn-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 968a2df9918c6e8a391d851701641188f18275ec6adeb0be0223a826a43080e5
MD5 0b3ad9bcc49a627e8df2c993bcbfc5af
BLAKE2b-256 30ef332eb8d5627e2963dca1309327110c939da2fd809f2d4f52619cf31c66b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page