Skip to main content

Information geometry engine — Fisher-Rao manifolds, Jordan boundaries, K-density navigation

Project description

kaft

Geometric dynamics on information manifolds.

PyPI version License: MIT Python 3.9+

pip install kaft

What kaft does

kaft implements geometric dynamics on Riemannian information manifolds.

Standard approaches treat knowledge as accumulation in flat Euclidean space like dot product similarity, cosine distance, softmax attention. Čencov's uniqueness theorem (1981) proves this is mathematically forced to be wrong: Fisher-Rao is the only Riemannian metric invariant under sufficient-statistic transformations on probability manifolds.

kaft builds on that foundation:

  • Embeds any corpus into a unified Fisher-Rao metric space
  • Computes K-density fields via inverse square law interaction dynamics
  • Detects Jordan-Brouwer domain boundaries as emergent geometry, not imposed constraints
  • Evolves knowledge state via the master field equation across timesteps
  • Traces geodesic paths between concepts on the curved manifold
  • Persists and reloads manifold state for session continuity

Core concepts

Fisher-Rao metric The unique invariant Riemannian metric on statistical manifolds (Čencov 1981). Geodesic distance = arccos of cosine similarity on the hypersphere S^383. Validated against geomstats to 4 decimal places.

K-density field Inverse square law interaction: K ∝ I₁·I₂ / d² where d is geodesic distance on the Fisher-Rao manifold, not Euclidean distance. High K = dense semantic cluster. Low K = open conceptual space.

Jordan boundaries Emergent domain separators — NOT configurable parameters. They crystallise as level sets of K-density gradients from the geometry itself. Hallucination prevention: crossing a boundary requires discrete energy accumulation, not smooth interpolation.

Knowledge evolution Master field equation: ∂K/∂t = c·v²_cog·K² + P(V)·∇^FR(K) + ξ_J(t) K² term: self-amplifying dynamics — understanding compounds. Fisher-Rao gradient: geodesic flow along information-theoretically optimal paths. Jordan noise: topologically constrained stochastic exploration within domains.


Quickstart

Build a manifold

from kaft.core.manifold import build_manifold

corpus = [
    {"text": "Fisher-Rao information geometry manifold"},
    {"text": "Riemannian curvature tensor geodesic"},
    {"text": "CRISPR-Cas9 gene editing mechanism"},
    {"text": "mRNA vaccine immunological response"},
    {"text": "statistical mechanics entropy thermodynamics"},
]

state = build_manifold(corpus)
print(state.embeddings.shape)  # (5, 384)

Compute Fisher-Rao geometry

from kaft.core.metric import FisherRaoMetric
from kaft.core.topology import KDensity, JordanBoundary

metric = FisherRaoMetric(state)
metric.compute()

kdensity = KDensity(state, metric)
K = kdensity.compute()
# K[i] ∈  — normalised interaction density at each point [actualisedaily](https://actualisedaily.com/transformation/transformative-crucibles-and-the-adventure-of-life/)

boundaries = JordanBoundary(state, kdensity).detect()
# Boundaries emerge from K-density gradients — not imposed
for b in boundaries:
    print(f"Boundary at: {b['text']} | energy barrier: {b['energy_barrier']:.4f}")

Evolve knowledge dynamics

from kaft.simulate.kaft import KAFTSimulator
from kaft.simulate.softmax import SoftmaxSimulator
from kaft.simulate.compare import compare

result = compare(KAFTSimulator(), SoftmaxSimulator(), state, n_steps=50)
print(f"Divergence: {result['divergence']:.4f}")
# KAFT sees domain structure — varied K across clusters
# Softmax sees uniform K=1.000 across all points

Navigate geodesics

from kaft.navigate.geodesic import GeodesicNavigator

navigator = GeodesicNavigator(state, metric, n_steps=15)
path = navigator.trace(source_idx=0, target_idx=2)

print(f"Fisher-Rao path length: {path.total_fr_length:.4f}")
for wp in path.waypoints:
    print(f"t={wp.t:.2f}  K={wp.k_density:.4f}  {wp.nearest_text[:40]}")

# Jordan boundary crossings detected automatically
for t_val, label in path.boundary_crossings:
    print(f"t={t_val:.2f}{label}")

Real corpus via arXiv

from kaft.ingest.router import ArxivRouter

router = ArxivRouter()
records = router.fetch("Fisher information geometry", max_results=10)
state = build_manifold(records)

Persist manifold state

from kaft.navigate.seeder import DomainSeeder

DomainSeeder.save(state, "domain.json")          # compute once
state = DomainSeeder.load("domain.json")          # reload instantly

Validation

Experiment Result
Fisher-Rao vs geomstats Exact match to 4 decimal places
Jordan boundaries Emerge on real 24-paper arXiv corpus (4 domains)
K² soliton Topology locks at step 10, stable through step 50
Geometric vs flat dynamics Divergence D=0.2230 on real corpus
3-SAT phase transition α=5.0 95.73% ±1.03% satisfaction, O(N^1.17) scaling

Installation

pip install kaft

Development:

git clone https://github.com/crucible-science/kaft
cd kaft
pip install -e ".[dev]"
pytest tests/ -v

Background

kaft is the reference implementation of Knowledge Attention Field Theory — a geometric framework for knowledge dynamics on Riemannian information manifolds.

Built at Crucible Science. arXiv paper: forthcoming — endorsements in progress


License

MIT — see LICENSE

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

kaft-0.1.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

kaft-0.1.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file kaft-0.1.0.tar.gz.

File metadata

  • Download URL: kaft-0.1.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for kaft-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5c40752c920c0a37c59d14d9107abc2e61169e615808e4dc5d572f0eb96b786a
MD5 2aa107753636be439fda83799f8aaec5
BLAKE2b-256 f2130053f489d1e5bf8ad220aa1d359ba94c773affadf34426dfc554bb6505e1

See more details on using hashes here.

File details

Details for the file kaft-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kaft-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for kaft-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59a4d2e0fad3e81fdf3fb7f22e997d8c591965d56c254cde21bdb70d42d2fbb3
MD5 e035e74240ba3c59fff3e9901856a799
BLAKE2b-256 15df0caa49816c07a8836b98bea91f1ecabd94cdd6d2c3730baef6952cead40e

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