Machine Learning

Train and deploy through one Vulkan compute runtime.

OA is a GPU-first Rust and Python machine-learning stack built around oa::Matrix, graph-recorded operators, automatic differentiation, reusable modules, and portable model artifacts.

RNN · GRU · TransformerDense and sparse MoEMamba-3 · Empyrealm
Machine-learning compute infrastructure
Machine Learning

One execution model

Operators record into the current compute context. Modules compose those operators,oa::ml::GradientTape builds the backward pass, and the runtime submits the resulting work to Vulkan. Python imports the available values from their owning modules and calls lowercase operation modules such as oa.ml.loss.

01

Autograd

Forward operations register their gradient rules; no separate handwritten training graph is required.
02

Modules

Linear, embedding, recurrent, attention, Transformer, MoE, VQ, and optimizer components share one parameter contract.
03

Artifacts

.oam files persist architecture metadata, weights, optimizer state, and checkpoint identity.
04

Measured training

Training logs distinguish wall time, GPU time, validation loss, throughput, and task-specific quality metrics.

Core API

Type or namespaceRole
oa::MatrixDevice-backed tensor shared by operators, modules, gradients, Vision, and Audio.
oa::ml::ModulePublic model behavior and parameter traversal contract.
oa::matrix / oa::ml::matrixStateless matrix, activation, normalization, and sequence operations; losses and metrics live in their owning ML modules.
oa::ml::GradientTapeReverse-mode automatic differentiation over the recorded forward graph.
oa::ml::AdamWOptimizer over the recursive parameter list returned by a module.
oa::ml::ItTrainingTraining metrics, validation, checkpoints, throughput, and GPU timing.

One module, two front ends

The language switch changes the example without changing OA's execution model.

1use oa::{Engine, Matrix, ml};
2
3fn main() -> oa::Result<()> {
4 let engine = Engine::new()?;
5
6 let x = Matrix::from_f32(&engine, [5, 1], &[-2.0, -1.0, 0.0, 1.0, 2.0])?;
7 let target = Matrix::from_f32(&engine, [5, 1], &[-3.0, -1.0, 1.0, 3.0, 5.0])?;
8
9 let model = ml::nn::Linear::with_seed(&engine, 1, 1, 0)?;
10 let mut optimizer = ml::Sgd::new(model.parameters(), 0.05, 0.0, 0.0)?;
11
12 let mut initial_loss = 0.0_f32;
13 let mut loss_matrix = Matrix::from_f32(&engine, [1], &[0.0])?;
14
15 for step in 0..80 {
16 optimizer.zero_grad();
17 let tape = ml::GradientTape::new();
18 let prediction = model.forward(&x)?;
19 loss_matrix = ml::loss::mse(&prediction, &target)?;
20 tape.backward(&loss_matrix)?;
21 drop(tape);
22 optimizer.step()?;
23
24 if step == 0 {
25 initial_loss = loss_matrix.read_f32()?[0];
26 }
27 }
28
29 let final_loss = loss_matrix.read_f32()?[0];
30 let values = model.forward(&x)?.read_f32()?;
31
32 assert!(final_loss < initial_loss * 0.01);
33 assert!(
34 values
35 .iter()
36 .zip([-3.0_f32, -1.0, 1.0, 3.0, 5.0])
37 .all(|(&a, b)| (a - b).abs() < 0.1)
38 );
39
40 println!("loss: {initial_loss:.6} -> {final_loss:.6}");
41 println!("{values:?}");
42 Ok(())
43}
44

Verified reference workload

The native NLP suite covers Byte, BPE, and character tokenization across RNN, GRU, Transformer, sparse MoE Transformer, and experimental SSM backbones. The source suite exercises training, evaluation, text generation, and checkpoint workflows; Rust and Python qualification remains scoped to the individual workload. The current Intel Iris Xe reference uses FP32; precision routes remain capability-gated rather than assumed.

Applications

Text to motion · USD

Alm

Generate prompt-conditioned motion tokens and decode them into a canonical USD skeleton clip through one native OA model bundle.

Android · Physical Vulkan

Mobile Lab

Train the same five OA NLP architectures on a physical Adreno GPU, inspect live GPU metrics, and verify generation plus checkpoint replay from one Android application.