Home/Packages/AlgFormer.Gpu

AlgFormer.Gpu · machine learning

Same model, same weights. Just faster.

AlgFormer.Gpu adds ILGPU/CUDA-backed training and inference for the HoloFormer (holographic attention) engine from the core AlgFormer package. It builds GPU kernels straight from a CPU HoloFormer's serialized weights — no separate model format, no retraining to switch devices. Backward passes, a fused on-device Adam optimizer step, and batched forward inference all run on the GPU when one is present, with the CPU engine automatically taking over when it isn't.

v1.3.0 net8.0+ ILGPU / CUDA automatic CPU fallback free to use
dotnet add package EvaluatedApplications.AlgFormer.Gpu

Why it's useful

drop-in, not a rewrite

Drop-in, not a rewrite

Point it at an existing CPU HoloFormer; it trains and serves against the same serialized weights.

Automatic fallback

Runtime device detection means the same build works on a machine with a CUDA GPU and one without — no separate code paths for callers to maintain.

Correctness-checked against the CPU engine

Every GPU kernel is gradient-checked against the CPU HoloFormer (which does the math in double precision) as the reference oracle. GPU runs in float32 for speed, so results are float-close to the CPU reference, not bit-identical.

Fused on-device Adam

The optimizer step runs on the GPU too, alongside the forward/backward kernels, avoiding a round trip to the CPU on every training batch.

Key features

what you get

GPU-batched training

Forward and backward for HoloFormer, including per-layer weight-tied iterative refinement ("StackIter") and all-positions loss.

Checkpoint/resume

Fused on-device Adam optimizer state can be checkpointed and resumed alongside the GPU-resident training loop.

Device detection

GpuDevice.HasGpu with silent, safe CPU fallback when no supported CUDA device is present.

Standalone kernel verification

Utilities to confirm a given GPU matches the CPU reference before trusting it in production.

Good to know

honest limits

Requires a CUDA device to use the GPU path

Without an ILGPU-supported CUDA device at runtime, the package falls back to the CPU HoloFormer engine automatically — the same build works either way.

Optional

The core AlgFormer package has no GPU dependency at all and stays dependency-free and AOT/trim-safe. Add this package only if you want GPU-accelerated training or inference.

The older softmax path is deprecated

The package also includes GPU support for AlgFormer's earlier (non-HoloFormer) softmax-attention model. That path still builds and runs, but all current development — including the fused Adam step — targets HoloFormer only. New projects should use the HoloFormer path.

Install from NuGet: EvaluatedApplications.AlgFormer.Gpu. Requires the core EvaluatedApplications.AlgFormer package alongside it. License: proprietary; every capability here is free to use today.