Spire-27B โ€” Vulkan GLSL & WebGPU WGSL Compute Shader Model

Base Model Spire-9B-RL Compile Rate 96.6% WGSL Pass@1 66.4% Apache 2.0

Spire-27B is the 27B flagship model in the Spire compute shader family, fine-tuned from Qwen/Qwen3.5-27B for high-reliability Vulkan GLSL (#version 450) and WebGPU WGSL compute shader generation, debugging, and translation.


Highlights

  • 96.6% Compile & Run Reliability (201/208): Achieves near-perfect shader compilation (76.4% โ†’ 96.6%, +20.2pp) and GPU execution (62.5% โ†’ 96.6%, +34.1pp) with zero runtime crashes across all compiled shaders.
  • +16.3pp Overall Pass@1 & +36.5pp Vulkan GLSL: Lifts Qwen/Qwen3.5-27B from 42.8% โ†’ 59.1% overall Pass@1 and boosts standalone Vulkan GLSL Pass@1 from 15.4% โ†’ 51.9% (+38 additional passing kernels).
  • Best-in-Family WebGPU WGSL & Complex Kernels: Leads all fine-tuned Spire models on WGSL (66.4%), Data Movement (77.3%), Quantization (77.3%), Attention (58.3%), and Matrix Multiply (57.1%).
  • Multi-Task Compute Engineering: Writes standalone Vulkan GLSL (#version 450) and WebGPU WGSL compute shaders from natural-language specs, fixes broken kernels from compiler/runtime diagnostics, and translates between GLSL โ†” WGSL.

Benchmark Results

All models are evaluated with greedy decoding (do_sample=False, enable_thinking=False) on the 104 held-out test tasks across both Vulkan GLSL and WebGPU WGSL (208 total tests). Every generated shader must:

  1. Compile & Validate: glslangValidator -V + spirv-val (for GLSL) or naga / wgpu validation (for WGSL).
  2. Execute on GPU: Dispatch cleanly on a real GPU compute pipeline without device loss or out-of-bounds faults.
  3. Pass Numerical Equivalence: Match reference NumPy/PyTorch outputs across multiple tensor shapes (atol=1e-3, rtol=1e-2).

Spire-27B Benchmark Results vs Qwen3.5-27B Base and Spire-9B-RL

Spire Model Family Benchmark (208 Tests)

Model Size Compile Rate Run Rate Overall Pass@1 GLSL Pass@1 WGSL Pass@1
Qwen/Qwen3.5-9B (Base) 9B 32.7% 30.3% 20.7% (43/208) 0.0% (0/104) 41.3% (43/104)
Qwen/Qwen3.5-27B (Base) 27B 76.4% 62.5% 42.8% (89/208) 15.4% (16/104) 70.2% (73/104)
sarimahsan101/Spire-9B-RL 9B 91.8% 91.8% 59.6% (124/208) 65.4% (68/104) 53.8% (56/104)
sarimahsan101/Spire-27B 27B 96.6% 96.6% 59.1% (123/208) 51.9% (54/104) 66.4% (69/104)
Gain vs. Qwen3.5-27B Base โ€” +20.2pp +34.1pp +16.3pp (+34) +36.5pp (+38) -3.8pp (-4)

Per-Category Pass@1 Breakdown (Qwen3.5-27B Base โ†’ Spire-27B)

Spire-27B Per-Category Pass@1 Breakdown

Compute Kernel Category Tests Qwen3.5-27B Base Spire-27B (Ours) Gain (ฮ”)
Elementwise 34 70.6% (24/34) 94.1% (32/34) +23.5pp (+8)
Data Movement 22 54.6% (12/22) 77.3% (17/22) +22.7pp (+5)
Quantization 22 59.1% (13/22) 77.3% (17/22) +18.2pp (+4)
Attention & Data 24 37.5% (9/24) 58.3% (14/24) +20.8pp (+5)
Matrix Multiply 28 42.9% (12/28) 57.1% (16/28) +14.3pp (+4)
Scan & Sort 24 29.2% (7/24) 41.7% (10/24) +12.5pp (+3)
Reduction 28 10.7% (3/28) 35.7% (10/28) +25.0pp (+7)
Conv & Pooling 26 34.6% (9/26) 26.9% (7/26) -7.7pp (-2)

Choosing Between Spire-27B and Spire-9B-RL

Use Case Recommended Model Why
WebGPU WGSL, Attention, Quantization, Data Movement, MatMul Spire-27B Highest compile/run rate (96.6%), best fine-tuned WGSL (66.4%), strongest on complex memory/attention kernels
Vulkan GLSL, Fast Local Inference, Scan/Sort & Reduction Spire-9B-RL RL-optimized for Vulkan GLSL (65.4%), 3ร— smaller/faster, GGUF quants available

Quickstart

Important: Spire-27B was trained with direct shader emission (enable_thinking=False) and outputs clean, standalone shaders inside a single fenced code block (```glsl or ```wgsl).

1. Transformers (Python)

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "sarimahsan101/Spire-27B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

messages = [
    {
        "role": "system",
        "content": (
            "You are an expert GPU compute shader engineer specializing in "
            "Vulkan GLSL and WebGPU WGSL. Write standalone, race-free, valid compute "
            "shaders that strictly follow the requested bindings and workgroup layout. "
            "Output the shader inside a single fenced code block (```glsl or ```wgsl)."
        ),
    },
    {
        "role": "user",
        "content": (
            "Write a WebGPU WGSL compute shader with @workgroup_size(64, 1, 1) "
            "that computes row-wise RMSNorm over a float buffer X (binding 0, shape [R, C]) "
            "with weight W (binding 1, shape [C]), output Y (binding 2, shape [R, C]), "
            "and uniform Params { R: u32, C: u32, eps: f32 } (binding 3)."
        ),
    },
]

prompt = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=False,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1536, do_sample=False)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))

2. vLLM (OpenAI-Compatible Server)

vllm serve sarimahsan101/Spire-27B \
  --dtype bfloat16 \
  --max-model-len 4096

Limitations & Intended Use

  • Domain Focus: Optimized specifically for compute shaders (Vulkan GLSL #version 450 and WebGPU WGSL). Graphics pipeline stages (vertex, fragment, tessellation, ray tracing) were outside the target scope.
  • Verification Recommended: While 96.6% of generated shaders compile and execute cleanly, complex multi-pass or shared-memory kernels (e.g., 2D convolutions) should still be validated against unit tests in your target compute pipeline.
  • License: Released under Apache 2.0, inheriting the permissive open-source terms of Qwen/Qwen3.5-27B.

Citation

@misc{spire27b2026,
  title  = {Spire-27B: Compute Shader Generation for Vulkan GLSL and WebGPU WGSL},
  author = {Sarim Ahsan},
  year   = {2026},
  url    = {https://huggingface.co/sarimahsan101/Spire-27B}
}
Downloads last month
12
Safetensors
Model size
28B params
Tensor type
BF16
ยท
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for sarimahsan101/Spire-27B

Base model

Qwen/Qwen3.5-27B
Finetuned
(368)
this model

Collection including sarimahsan101/Spire-27B

Evaluation results

  • Overall Pass@1 (208 tests) on Spire Held-Out 104-Task Compute Shader Benchmark (GLSL + WGSL)
    test set self-reported
    59.130
  • GLSL Pass@1 (104 tests) on Spire Held-Out 104-Task Compute Shader Benchmark (GLSL + WGSL)
    test set self-reported
    51.920
  • WGSL Pass@1 (104 tests) on Spire Held-Out 104-Task Compute Shader Benchmark (GLSL + WGSL)
    test set self-reported
    66.350
  • Compile & Run Rate on Spire Held-Out 104-Task Compute Shader Benchmark (GLSL + WGSL)
    test set self-reported
    96.630