ashhart/TensorFold

LLM Inference Engine for Metal, CUDA and Vulkan.

What it solves

TensorFold provides a high-performance, standalone way to serve language models on Apple Silicon and NVIDIA GPUs without requiring Python or MLX installations. It simplifies the deployment of specific qualified models by providing a native binary that handles checkpoint reading, tokenization, and kernel execution directly.

How it works

Built with Zig, the engine runs Metal or CUDA kernels directly to execute model weights. It supports an OpenAI-compatible API for chat completions and Anthropic Messages. Key technical features include:

  • Living Weights: An experimental feature that allows a running model to learn new facts by writing them directly into the checkpoint files, making the learned information persistent across restarts.
  • Context Compaction: Instead of refusing requests that overflow the context window, it can summarize older conversation turns into a "memory note" while keeping recent turns verbatim.
  • Exact Decoding: Ensures that drafted responses match the reference output of the native engine exactly.
  • Prompt Caching: Supports retained-prefix budgets to speed up processing of common prompt prefixes.

Who it’s for

Developers and users who want to run LLMs locally on macOS (M1-M5) or Linux (NVIDIA Ampere/Blackwell) with minimal dependencies and high efficiency.

Highlights

  • Zero Python Dependency: Serves models as a native Zig binary.
  • Living Weights: Enables real-time, persistent learning of new facts into model weights.
  • ** uma 3D Visualization**: Includes a 3D view to monitor how facts are integrated into neurons and layers.
  • Broad Hardware Support: Optimized for Apple Silicon (Metal) and NVIDIA GPUs (CUDA).
  • Context Management: Intelligent compaction to prevent context overflow.

Related

  • Project
  • Project
  • Project
  • Project
  • Project