2026-11-27 16:19 UTC

VindexLLM brings Gemma 3 4B Vulkan inference to Delphi on Windows

state: expiredheat: mediumuncertainty: mediumrelevance: mediumlocal-inference vulkantinyBigGAMES

What is this?

VindexLLM is an open-source Windows inference engine from tinyBigGAMES, written in Delphi and using Vulkan compute shaders to run GGUF models without Python or CUDA. Its GitHub README says end-to-end inference currently works for Gemma 3 4B only, and describes a console chat example with SQLite-backed persistent memory and RAG using a separate embedding model. The project is presented as available to build from source with Delphi 12 or later; the sources do not establish an independent release or adoption history. Performance and capability details come from the developer’s README, not independent testing.

Why it matters

The project offers a different route to local GPU inference: a Delphi application can use Vulkan across NVIDIA, AMD, and Intel GPUs rather than depending on Python environments or CUDA. Its integrated chat, memory, and RAG example could help Windows and Delphi developers build self-contained local AI applications. The scope is narrow for nowβ€”one model architecture, Windows onlyβ€”and the performance and hardware-compatibility claims need independent validation.

Current assessment

Newly surfaced project: tinyBigGAMES’s VindexLLM repository describes a Delphi 12+ engine for Windows 10/11 x64 that loads GGUF weights and runs Gemma 3 4B inference through Vulkan compute shaders. The README says it supports F16, Q8_0, and Q4_0 weights, provides streaming generation and an interactive console chat, and includes SQLite-backed persistent memory and RAG with EmbeddingGemma 300M. It claims Vulkan-capable NVIDIA, AMD, and Intel GPUs can be used, with 4 GB VRAM minimum for Q4_0; these are project claims, not independently verified compatibility results. The README reports 24.4 tokens/sec generation on an RTX 3060 12GB with Q8_0, also developer-reported. It explicitly limits current model support to Gemma 3 4B and calls the repository actively developed. The source describes cloning and building from source rather than documenting a packaged end-user release. Potential significance is lower-friction, vendor-neutral local inference and a ready example for Delphi developers; practical reach depends on validation, usability, and whether model support expands. The Hacker News item links to the repository, while the supplied search results add no independent technical evaluation or adoption evidence.

Measured heat

now 0 pts/hpeak 1 pts/hcomments 0/hpeers p21momentum: steady2 platformsage 336h
points/hour across evidence Β· reading as of 2026-11-22 16:21:12.281861+11:00 Β· deterministic, not a model opinion

How the heat travelled

11-08 06:22 (minted)⭐ origin echo-reconstructedThe project README describes a Delphi Vulkan inference engine for Gemma 3 4B GGUF models, with a console chat example and SQLite-backed memo
tinyBigGAMES on github (echo) Β· attributed from hn.story.50410646 Β· published time unknown
β€”
11-08 05:25first on hacker news Β· published Β· lag ?VindexLLM – Windows Vulkan GPU GGUF LLM inference engine written in Delphi 12
peter_d_sherman
β€”
11-08 05:25amplified on hacker news πŸ‘‘hn.story.50410646
peter_d_sherman
peak 1 Β· 0 comments Β· 104% of case engagement
11-08 06:20our radar first saw it Β· lag ?discovery anchor: hn.story.50410646β€”

Evidence (2) β€” ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnVindexLLM – Windows Vulkan GPU GGUF LLM inference engine written in Delphi 12
Retrieved article excerpt

Open article Β· Retrieved 2026-11-08T06:21:45.572052+00:00

[VindexLLM](https://github.com/tinyBigGAMES/VindexLLM/blob/main/media/logo.png)

  

[Discord](https://discord.gg/Wb6z8Wam7p) [Follow on Bluesky](https://bsky.app/profile/tinybiggames.com)

## What is VindexLLM?

**VindexLLM** is a GPU-accelerated LLM inference engine written entirely in Delphi, using Vulkan compute shaders for all heavy computation. It loads standard GGUF model files, runs the full transformer forward pass on the GPU, and produces text β€” no Python, no CUDA toolkit, no external runtimes. The only dependency is `vulkan-1.dll`, which already ships with every modern GPU driver.

Feed it a prompt, get tokens back. Everything between β€” embedding lookup, 34 layers of attention and FFN, normalization, sampling β€” happens on the GPU via GLSL 450 compute shaders compiled to SPIR-V and embedded as Windows resources into the binary.

### Single-shot inference

```
var
  LInference: TVdxInference;
  LConfig: TVdxSamplerConfig;
begin
  LInference := TVdxInference.Create();
  try
    // Stream tokens to console as they're generated
    LInference.SetTokenCallback(
      procedure(const AToken: string; const AUserData: Pointer)
      begin
        Write(AToken);
      end, nil);

    // Load model β€” memory-maps GGUF, initializes Vulkan, uploads weights to GPU
    if LInference.LoadModel('path\to\gemma-3-4b-it-q4_0.gguf') then
    try
      // Configure sampler (Google-recommended settings for Gemma 3 4B IT)
      LConfig := TVdxSampler.DefaultConfig();
      LConfig.Temperature := 1.0;
      LConfig.TopK := 64;
      LConfig.TopP := 0.95;
      LInference.SetSamplerConfig(LConfig);

      // Generate up to 1024 tokens
      LInference.Generate('Explain how a CPU works', 1024);
    finally
      LInference.UnloadModel();
    end;
  finally
    LInference.Free();
  end;
end;
```

### Interactive chat with persistent memory

```
var
  LChat: TVdxConsoleChat;
  LConfig: TVdxSamplerConfig;
begin
  LChat := TVdxConsoleChat.Create();
  try
    LChat.ModelPath := 'path\to\gemma-3-4b-it-q4_0.gguf';
    LChat.EmbedderPath := 'path\to\embeddinggemma-300M-qat-Q4_0.gguf';
    LChat.MemoryDbPath := 'session.db';
    LChat.SystemPrompt := 'You are a helpful assistant.';
    LChat.MaxTokens := 1024;

    LConfig := TVdxSampler.DefaultConfig();
    LConfig.Temperature := 1.0;
    LConfig.TopK := 64;
    LConfig.TopP := 0.95;
    LChat.SamplerConfig := LConfig;

    // Enter interactive chat loop β€” loads model, opens memory DB,
    // retrieves context via RAG each turn, streams responses
    LChat.Run();
  finally
    LChat.Free();
  end;
end;
```

Load a model, generate text, done. The chat example adds multi-turn conversation with SQLite-backed persistent memory and RAG retrieval across sessions. For the full implementations including status callbacks, cancel support, event hooks, error handling, and performance stats, see `testbed\UTest.Demo.pas`.

## Why VindexLLM?

Most LLM inference stacks depend on CUDA (NVIDIA-only, ~3GB toolkit install), Python environments, or large runtime libraries. VindexLLM takes a different approach:

- **Zero install** β€” Vulkan ships with every NVIDIA, AMD, and Intel GPU driver. No separate toolkit download, no PATH configuration, no DLL hell. The app calls `LoadLibrary('vulkan-1.dll')` and talks directly to the GPU.
- **No vendor lock-in** β€” Vulkan runs on any modern GPU. Not tied to NVIDIA hardware.
- **Self-contained binary** β€” All 37 compute shaders are compiled to SPIR-V at build time and embedded into the executable as Windows resources. No loose shader files, no runtime compilation.
- **No Python, no runtime** β€” Pure compiled Delphi. Starts instantly, no interpreter warmup, no dependency resolution.
- **Memory-mapped model loading** β€” GGUF files are mapped directly via `CreateFileMapping` / `MapViewOfFile`. Weights are accessed at their file offsets and uploaded to VRAM through staging buffers. No intermediate copies, no parsing into custom formats.
- **Everything on GPU** β€” The residual stream never leaves VRAM between layers. The only PCIe transfers are the initial token embedding (~10KB) and the final logits download for sampling. Everything else β€” attention, FFN, norms, activations, residual additions β€” runs as GPU compute dispatches.

## How It Works

VindexLLM implements the standard dense transformer forward pass. For each token, the engine runs 34 layers of attention and FFN computation on the GPU, then samples the next token from the output logits.

```
                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚  GGUF File   β”‚
                         β”‚  (mmap'd)    β”‚
                         β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚ weights uploaded to VRAM at startup
                                β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  "prompt"  │────►│  Tokenize (BPE)  ──►  Embed (GPU lookup)     β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
                                        β–Ό  Γ— 34 layers
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚  PreAttnNorm ──► Attention (GQA + RoPE +     β”‚
                     β”‚    QK-norm + TQ3 KV cache) ──► PostAttnNorm  β”‚
                     β”‚  ──► residual += attn_out                    β”‚
                     β”‚                                              β”‚
                     β”‚  PreFFNNorm ──► gate(x), up(x) ──►           β”‚
                     β”‚    GELU(gate) * up ──► down(hidden)          β”‚
                     β”‚  ──► PostFFNNorm ──► residual += ffn_out     β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
                                        β–Ό
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚  Final RMSNorm ──► Unembed (tied weights)    β”‚
                     β”‚  ──► Sample (temp, top-K/P, min-P, repeat)   β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

Prefill processes all prompt tokens in parallel using batched matmul shaders. Autoregressive generation runs one token at a time using matvec shaders. Both paths share the same KV cache, which uses TQ3 compression to reduce VRAM usage by ~9Γ— compared to F32.

## Current Status

Dense inference is working end-to-end. The engine loads a Gemma 3 4B GGUF, tokenizes a prompt with chat template formatting, runs the full forward pass on the GPU, and generates coherent text with configurable sampling. A complete interactive chat system with persistent memory and RAG is built on top of the inference engine.

**What works today:**

- Full Gemma 3 4B forward pass (34 layers, all on GPU, no CPU fallbacks)
- Batched prefill (all prompt tokens processed in parallel via matmul shaders)
- Autoregressive generation with streaming token callback
- F16, Q8\_0, and Q4\_0 weight format support (detected automatically from GGUF metadata)
- TurboQuant TQ3 KV cache compression with fused attention scoring (no separate dequant step)
- Pure Delphi BPE tokenizer loaded directly from GGUF vocabulary (no external SentencePiece library)
- Token sampling: temperature, top-K, top-P, min-P, repetition penalty, deterministic seeding (xoshiro256\*\* PRNG)
- Gemma 3 chat template formatting
- Interactive multi-turn console chat (`TVdxConsoleChat`) with streaming output, ESC cancel, slash commands
- SQLite-backed persistent conversation memory (`TVdxMemory`) with SHA-256 dedup and semantic dedup (cosine similarity threshold)
- RAG retrieval: cosine-similarity vector search over stored turns using EmbeddingGemma 300M, merged and injected as reference context each turn
- Embedding model support (`TVdxEmbeddings`) β€” loads a second GGUF for vector search independently of the inference model
- Session management (`TVdxSession`) wrapping inference + memory + embeddings into a single lifecycle
- Model abstraction layer with architecture registry β€” graceful error for unsupported models
- Architecture validation and configurable context length with model-max clamping
- VRAM usage reporting (weights, cache, buffers breakdown)
- Context overflow detection (`srContextFull` stop reason)
- Inference event callbacks (load/unload/prefill/generate start/end)
- Cancel callback (poll per-layer, ESC to abort in testbed)
- Memory-mapped file access (`TVdxVirtualFile`) for zero-copy GGUF weight reads
- Page-file-backed virtual buffers (`TVdxVirtualBuffer<T>`) for CPU workspace β€” allocates address space without committing physical RAM until touched
- 37 GLSL 450 compute shaders compiled to SPIR-V and embedded as Windows resources

## TurboQuant (TQ3)

TurboQuant is VindexLLM's custom 3-bit quantization format, designed specifically for KV cache compression. It uses a Walsh-Hadamard Transform (WHT) to decorrelate values within each 32-element block before quantizing to 3 bits using Lloyd-Max optimal centroids fitted to a standard normal distribution.

The result is ~9Γ— compression versus F32 with quality that significantly outperforms naive 3-bit rounding because the WHT spreads information across all elements before quantization.

**TQ3 pipeline (per block of 32 values):**

1. Apply fixed sign-flip pattern (improves WHT energy distribution)
2. 5-stage butterfly WHT (in-place, no temporary buffers)
3. Normalize by 1/√32
4. Find absolute max, compute FP16 scale factor (gamma)
5. Quantize each value to nearest Lloyd-Max centroid (8 levels, 3 bits)
6. Pack: 2 low bits into `qs` words, 1 high bit into `qr` word, gamma into FP16

All four TQ3 phases run as GPU compute shaders: general quantize/dequantize (`tq3_quantize.comp`, `tq3_dequantize.comp`), KV-cache-specific quantize/dequantize (`tq3_kv_quantize.comp`, `tq3_kv_dequantize.comp`), fused batch KV store + quantize (`kv_cache_store_batch_tq3.comp`), and fused attention scores directly on TQ3-compressed keys (`attn_scores_mh_tq3.comp`) β€” eliminating the separate K dequantization step entirely.

CPU reference implementations exist in `VindexLLM.TurboQuant.pas` for validation.

## Supported Models

VindexLLM currently implements the Gemma 3 4B architecture. The following GGUF files have been vetted and confirmed to produce correct output. All vetted models are collected in the [tinyBigGAMES Hugging Face collection](https://huggingface.co/collections/tinybiggames/gemma-3).

| Model | Purpose | Format | Size | Download |
| --- | --- | --- | --- | --- |
| gemma-3-4b-it-qat-q4\_0 | Inference (chat/generation) | Q4\_0 | ~2.5 GB | [Download](https://huggingface.co/tinybiggames/gemma-3-4b-it-qat-q4_0-gguf/resolve/main/gemma-3-4b-it-q4_0.gguf?download=true) |
| embeddinggemma-300M-qat-Q4\_0 | Embeddings (memory/RAG) | Q4\_0 | ~278 MB | [Download](https://huggingface.co/tinybiggames/embeddinggemma-300m-qat-Q8_0/resolve/main/embeddinggemma-300m-qat-Q8_0.gguf?download=true) |

Both vetted models use **QAT (Quantization-Aware Training)** Q4\_0 rather than post-training quantized Q4\_0. With QAT, the quantization error is accounted for during training β€” the model learns to compensate for reduced precision, producing significantly better output quality at the same 4-bit size. This gives the smallest practical VRAM footprint while preserving quality, making it possible to run the full stack (inference + embeddings + memory/RAG) comfortably on most consumer GPUs with 4–6 GB of VRAM.

Other Gemma 3 4B GGUF files may work but have not been tested. Non-Gemma architectures are not supported at this time β€” the engine will report a clear error message if you attempt to load an unsupported model.

## Performance

Measured on an NVIDIA RTX 3060 12GB with Gemma 3 4B Q8\_0:

| Metric | Value |
| --- | --- |
| Prefill throughput | 35.0 tok/s |
| Generation throughput | 24.4 tok/s |
| Time to first token | 457 ms |

All computation runs on the GPU. The only PCIe transfers per token are the embedding lookup input and the logits download for sampling.

## Getting Started

1. Download 
peter_d_sherman10
🟧 echo.github ⭐The project README describes a Delphi Vulkan inference engine for Gemma 3 4B GGUF models, with a console chat example and SQLite-backed memotinyBigGAMESβ€”β€”

Interpretation history

Decision trace