GPU backends
The base Hearth.AI package gives you CPU inference. Install one of the backend packages when you want hardware acceleration.
| Package | Hardware target | Notes |
|---|---|---|
Hearth.AI |
CPU | Default package |
Hearth.AI.Cuda |
NVIDIA CUDA 12 | Best fit for NVIDIA GPUs |
Hearth.AI.Metal |
Apple Silicon and supported macOS GPUs | Best fit for macOS |
Hearth.AI.Vulkan |
Vulkan-capable AMD and Intel GPUs | Cross-vendor GPU path |
Choosing GpuLayers
GpuLayers controls how much of the model is offloaded:
0= CPU only35= a practical starting point for many 7B Q4 models on 8 GB GPUs999= offload everything possible
Practical guidance
- Start conservative and increase
GpuLayerswhile watching VRAM usage. - Use
999on Apple Silicon when Metal is available and the model fits. - Keep
ContextSizerealistic, because a larger KV cache increases memory use quickly.
Installation examples
dotnet add package Hearth.AI.Cuda
dotnet add package Hearth.AI.Metal
dotnet add package Hearth.AI.Vulkan