whatisgithub

What is flashqwen?

frankkk96/flashqwen — explained in plain English

Analysis updated 2026-05-18

28C++Audience · researcherComplexity · 5/5Setup · hard

In one sentence

A from-scratch C++ and CUDA engine for running the Qwen3-8B language model on an NVIDIA GPU, built as a learning project with no external libraries.

Mindmap

mindmap
  root((FlashQwen))
    What It Does
      Runs Qwen3-8B on GPU
      From-scratch inference engine
    Tech Stack
      C++
      CUDA
      CMake
    Use Cases
      Local GPU chat
      Inference benchmarking
    Audience
      Researchers
      Systems learners

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Run Qwen3-8B in interactive multi-turn chat directly on a local NVIDIA GPU.

USE CASE 2

Benchmark GPU inference speed across different prompt lengths.

USE CASE 3

Study a fully from-scratch implementation of an LLM inference engine, including tokenizer and matrix math.

USE CASE 4

Check out tagged commits to see how each optimization stage improved decode speed.

What is it built with?

C++CUDACMake

How does it compare?

frankkk96/flashqwennv-tlabs/wosxmaxlaurence/slippi-android
Stars282827
LanguageC++C++C++
Setup difficultyhardhardhard
Complexity5/55/54/5
Audienceresearcherresearchergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires a CUDA 12.x toolkit and an NVIDIA GPU with at least 20GB of VRAM, plus downloading model weights via Git LFS.

So what is it?

FlashQwen is a C++ and CUDA inference engine for running Qwen3-8B, a large language model, directly on an NVIDIA GPU. The entire project is built from scratch with no external library dependencies beyond the CUDA toolkit and the C++ standard library. There is no PyTorch, no cuBLAS, no tokenizer library, and no third-party JSON parser. Every component, including the tokenizer, the tensor file reader, the matrix math kernels, and the JSON parser, is written in this codebase. The project was built for learning purposes and totals roughly 1,940 lines of code. The intended use is running Qwen3-8B in interactive multi-turn chat on a local GPU, or running a built-in benchmark mode that measures how fast the engine processes different prompt lengths. You point the tool at a directory containing the model's weight files, which you download separately from Hugging Face using Git LFS, and it loads them at startup. The engine quantizes the matrix multiplication weights from 16-bit to 8-bit integers in memory at load time, which reduces the memory footprint from roughly 16 gigabytes to about 9 gigabytes and improves decode speed. On an RTX 4090 GPU, the benchmarks show the engine decoding at around 100 tokens per second for short to medium contexts. The README walks through an optimization study across eight stages, starting from a scalar math baseline at 49.7 tokens per second and tracing each gain: tensor-core prefill, vectorized matrix-vector multiply for decode, an in-GPU argmax step, INT8 weight quantization, and a CUDA graph to reduce per-step overhead. Each stage is a tagged commit on a separate branch so any version can be checked out and measured. The project requires a CUDA toolkit (version 12.x recommended) and an NVIDIA GPU with at least 20 gigabytes of VRAM. It builds in about 9 seconds with CMake and produces a binary under 2 megabytes. FlashQwen supports any dense Qwen3 model from 0.6 billion to 32 billion parameters, mixture-of-experts variants, multimodal variants, and non-Qwen architectures are not supported.

Copy-paste prompts

Prompt 1
Walk me through building FlashQwen with CMake and running it against a downloaded Qwen3-8B model.
Prompt 2
Explain how the INT8 quantization step in this engine reduces memory use and speeds up decoding.
Prompt 3
What GPU and VRAM do I need to run FlashQwen, and which Qwen3 model sizes does it support?
Prompt 4
Show me how the eight-stage optimization study in the README improved performance over the baseline.

Frequently asked questions

What is flashqwen?

A from-scratch C++ and CUDA engine for running the Qwen3-8B language model on an NVIDIA GPU, built as a learning project with no external libraries.

What language is flashqwen written in?

Mainly C++. The stack also includes C++, CUDA, CMake.

How hard is flashqwen to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is flashqwen for?

Mainly researcher.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.