Skip to main content

Crate aphelion_core

Crate aphelion_core 

Source
Expand description

§aphelion-core

Core library for the Aphelion AI Framework.

§Why This Crate Exists

Aphelion is a framework frontend that provides an easier entrypoint for AI engineering in Rust. This crate provides the core infrastructure that unifies access to Rust AI libraries through a consistent API.

Building AI systems means integrating multiple libraries: tensor operations, memory management, device handling, training loops. aphelion-core handles:

  • Unified API: One consistent interface to underlying AI libraries (rust-ai-core, Candle, Burn, CubeCL).

  • Reusable Components: Configurations and pipelines can be templated, shared, and versioned for reproducible experiments.

  • Deterministic graph hashing: SHA-256 over canonicalized node data ensures identical configurations produce identical hashes, regardless of construction order.

  • Structured tracing: Every operation emits typed events. No printf debugging. Export to JSON for analysis or feed to observability systems.

  • Backend abstraction: Write once, run on CPU, GPU, or accelerators. The Backend trait abstracts hardware differences.

  • Pipeline composition: Stages execute in order with hooks for customization. Errors propagate with context. Progress is observable.

§Module Organization

ModulePurpose
configModel configuration with typed parameters and validation
graphDAG representation of model architecture
pipelineStage-based execution with hooks and progress tracking
backendHardware abstraction for CPU/GPU/accelerator targets
diagnosticsStructured tracing and event logging
validationComposable validators for configuration checking
errorTyped errors with context and chaining
exportSerialization of trace events to JSON

§Feature Flags

FeatureEffect
burnEnables Burn deep learning backend integration
cubeclEnables CubeCL GPU compute backend
rust-ai-coreEnables memory tracking, device detection, dtype utilities
cudaEnables CUDA support (requires rust-ai-core)
tokioEnables async pipeline execution
tritter-accelEnables Tritter hardware acceleration
pythonEnables Python bindings via PyO3
wasmEnables WebAssembly/TypeScript bindings via wasm-bindgen

§Quick Start

use aphelion_core::prelude::*;

// Build a model graph
let mut graph = BuildGraph::default();
let encoder = graph.add_node("encoder", ModelConfig::new("enc", "1.0.0"));
let decoder = graph.add_node("decoder", ModelConfig::new("dec", "1.0.0"));
graph.add_edge(encoder, decoder);

// Execute pipeline
let backend = NullBackend::cpu();
let trace = InMemoryTraceSink::new();
let ctx = BuildContext::new(&backend, &trace);
let result = BuildPipeline::standard().execute(&ctx, graph)?;

// Hash is deterministic
assert_eq!(result.stable_hash().len(), 64); // SHA-256 hex

Re-exports§

pub use rust_ai_core::placeholder::AphelionDevice;
pub use rust_ai_core::placeholder::MemoryTracker;

Modules§

backend
Backend abstraction for hardware-specific model execution.
config
Model configuration types and traits.
diagnostics
Diagnostic and tracing infrastructure for model building.
error
Error types and result aliases for Aphelion operations.
export
Export and serialization of trace events.
graph
Graph construction and manipulation for model architectures.
pipeline
Build pipeline orchestration and stage management.
prelude
rust_ai_core
rust-ai-core Integration Module
validation
Configuration validation types and validators.

Attribute Macros§

aphelion_model
Attribute macro for marking a model builder type.