Skip to main content

Crate amari_fusion

Crate amari_fusion 

Source
Expand description

Tropical-Dual-Clifford fusion system for optimal LLM evaluation

This crate combines three exotic number systems:

  • Tropical algebra: Converts expensive softmax operations to max operations
  • Dual numbers: Provides automatic differentiation without computational graphs
  • Clifford algebra: Handles geometric relationships and rotations

Together, these systems create a powerful framework for efficient neural network evaluation and optimization.

§Key Types

The main type is TropicalDualClifford, which fuses all three algebras:

use amari_fusion::TropicalDualClifford;

// Create TDC values
let tdc1 = TropicalDualClifford::<f64, 8>::random_with_scale(1.0);
let tdc2 = TropicalDualClifford::<f64, 8>::random_with_scale(1.0);

// Geometric operations
let product = &tdc1 * &tdc2;  // Tropical-modified geometric product
let rotated = tdc1.rotate_by(&tdc2);  // Rotor-based rotation

// Access components
let tropical_val = tdc1.tropical_value();
let gradient = tdc1.gradient();

§Vector Symbolic Architectures

TropicalDualClifford has built-in binding operations for holographic memory:

use amari_fusion::TropicalDualClifford;

let key = TropicalDualClifford::<f64, 8>::random_with_scale(1.0);
let value = TropicalDualClifford::<f64, 8>::random_with_scale(1.0);

// Binding operations (inherent methods)
let bound = key.bind(&value);              // Create association
let retrieved = key.unbind(&bound);        // Retrieve value
let superposed = key.bundle(&value, 1.0);  // Superposition
let sim = key.similarity(&value);          // Cosine similarity

§Holographic Memory (v0.12.3+)

For dedicated Vector Symbolic Architectures (VSA) and holographic reduced representations with multiple algebra options, use the standalone amari-holographic crate:

use amari_holographic::{HolographicMemory, ProductCliffordAlgebra, BindingAlgebra, AlgebraConfig};

type ProductCl3x32 = ProductCliffordAlgebra<32>;

// Create memory with 256-dimensional algebra
let mut memory = HolographicMemory::<ProductCl3x32>::new(AlgebraConfig::default());

// Store and retrieve
let key = ProductCl3x32::random_versor(2);
let value = ProductCl3x32::random_versor(2);
memory.store(&key, &value);
let result = memory.retrieve(&key);

When the holographic feature is enabled, types are re-exported here for backward compatibility.

§Feature Flags

FeatureDescription
stdStandard library support (default)
high-precisionEnable 128-bit and arbitrary precision floats
holographicRe-export amari-holographic types
parallelEnable parallel operations via rayon

Re-exports§

pub use types::EvaluationError;
pub use types::EvaluationResult;
pub use types::TropicalDualClifford;

Modules§

attention
Attention mechanisms using Tropical-Dual-Clifford algebra
evaluation
LLM evaluation metrics using Tropical-Dual-Clifford algebra
optimizer
Optimization using combined tropical-dual-clifford algebra
types
Tropical-Dual-Clifford Fusion Types - The Heart of Amari
verified
Verified fusion operations with phantom types for compile-time safety
verified_contracts
Formal verification contracts for tropical-dual-clifford fusion algebra

Traits§

PrecisionFloat
Unified trait for floating-point arithmetic in scientific computing

Type Aliases§

ExtendedDual
Extended-precision dual number (uses extended precision float from amari-core)
ExtendedFloat
ExtendedMultiDual
Extended-precision multi-dual number (uses extended precision float from amari-core)
ExtendedTropical
Extended-precision tropical number (uses extended precision float from amari-core)
HighPrecisionFloat
StandardDual
Standard-precision dual number (f64)
StandardFloat
Type alias for standard precision calculations
StandardMultiDual
Standard-precision multi-dual number (f64)
StandardTropical
Standard-precision tropical number (f64)