Skip to main content

How to Run Qwen3.8-27B Locally on an NVIDIA RTX 5090

Learn how to run Qwen3.8-27B locally with Blackwell-native NVFP4 and MTP speculative decoding, achieving up to 170 tokens per second with llama.cpp.
Aug 25, 2026  · 6 min read

Explore with AI

ChatGPTClaudePerplexity

Qwen3.8-27B is quickly becoming one of the most popular models for local AI. Despite having just 27 billion parameters, it delivers performance that competes with much larger models across coding, reasoning, agentic, and general-purpose benchmarks. It is even approaching models such as GLM-5.2 in several areas, which has made it especially popular among people experimenting with powerful local hardware.

The RTX 5090 is particularly well-suited to Qwen3.8-27B because its Blackwell architecture supports NVFP4, allowing the model to run at very high speeds while maintaining strong output quality. Combined with speculative decoding through multi-token prediction (MTP), an optimized llama.cpp build, and the right GGUF model, Qwen3.8-27B can deliver well over 100 tokens per second on a single RTX 5090.

In this guide, we will set up what I think is one of the easiest ways to get the best balance of speed, accuracy, and long-context support on an RTX 5090 or another Blackwell GPU. We will compile llama.cpp with native Blackwell support, download the Qwen3.8-27B NVFP4-MTP GGUF, run it with GPU acceleration and MTP speculative decoding, test the OpenAI-compatible API and built-in web interface, and finally connect it to Pi so we can use Qwen3.8-27B as a fully local coding agent.

Associate AI Engineer

Train and fine-tune the latest AI models for production, including LLMs like Llama 4. Start your journey to becoming an AI Engineer today!
Explore Track

1. Set Up llama.cpp for Blackwell GPUs

First, we will make sure the GPU is detected properly and check the NVIDIA driver and CUDA version.

nvidia-smi

RTX 5090 GPU summary

You should see your RTX 5090, driver version, CUDA version, GPU memory, and current GPU usage.

Note: This setup is specifically for NVIDIA Blackwell GPUs, such as the RTX 5090. The build below targets SM120, which is the compute architecture used by the RTX 5090.

Next, we will download and compile the latest version of llama.cpp with CUDA support.

cd /workspace

git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp

cmake -B build \
  -DGGML_CUDA=ON \
  -DCMAKE_CUDA_ARCHITECTURES=120

cmake --build build --config Release -j$(nproc)

Building llama.cpp for the RTX 5090  GPU

The important part here is -DCMAKE_CUDA_ARCHITECTURES=120. This tells llama.cpp to build specifically for the Blackwell architecture used by the RTX 5090.

Once the build finishes, we will make llama-server available globally so we can run it from any folder:

sudo ln -sf "$(realpath ./build/bin/llama-server)" /usr/local/bin/llama-server

Now, check that everything is working:

llama-server --version

You should get output similar to:

version: 0.1.1-dev (build 10479, commit 0021a77de)
built with GNU 13.3.0 for Linux x86_64

That is it. We now have a CUDA-enabled llama.cpp build that can take advantage of the RTX 5090 and its native Blackwell NVFP4 support.

2. Download the Qwen3.8-27B NVFP4-MTP Model

Now we will download the Qwen3.8-27B model.

First, install the Hugging Face CLI:

pip install -U huggingface_hub

Create a folder where we will keep the model:

mkdir -p /workspace/models/qwen38

Then download the NVFP4-MTP GGUF:

hf download felippeburk/Qwen3.8-27B-NVFP4-MTP-GGUF \
  --local-dir /workspace/models/qwen38

Downloading the Qwen3.8-27B-NVFP4-MTP-GGUF

This is the version we want for this setup because it uses NVFP4 and includes MTP support, which is where a lot of the speed improvement comes from on the RTX 5090.

3. Start Qwen3.8-27B Server

Now comes the fun part. We will serve Qwen3.8-27B fully on the GPU with Flash Attention, a 131K context window, and MTP speculative decoding for faster generation. 

Run:

cd /workspace/llama.cpp

llama-server \
  -m /workspace/models/qwen38/qwen3.8-27b-text-nvfp4-mtp.gguf \
  --alias qwen3.8-27b \
  --host 0.0.0.0 \
  --port 8910 \
  --ctx-size 131072 \
  --n-gpu-layers all \
  --flash-attn on \
  --cache-type-k q8_0 \
  --cache-type-v q8_0 \
  --parallel 1 \
  --spec-type draft-mtp \
  --spec-draft-n-max 4 \
  --spec-draft-p-min 0.75 \
  --spec-draft-ngl all \
  --spec-draft-type-k q8_0 \
  --spec-draft-type-v q8_0 \
  --reasoning-effort medium \
  --jinja

There are a lot of options here, but most of them are simply there to get the best performance from the 5090.

The main ones to know are:

  • --ctx-size 131072 gives us roughly a 131K context window.

  • --n-gpu-layers all keeps the model on the GPU.

  • --flash-attn on enables Flash Attention.

  • --cache-type-k q8_0 and --cache-type-v q8_0 help reduce KV cache memory usage.

  • --spec-type draft-mtp enables Qwen3.8's MTP speculative decoding.

  • --spec-draft-n-max 4 controls how many speculative tokens MTP can generate at once.

For this setup, we are using n-max 4 as a starting point for an RTX 5090. You can experiment with values such as 2 (which the model card recommends for this GGUF) or 3 later, since the fastest setting can vary slightly depending on your system.

Once llama-server finishes loading the model, Qwen3.8 will be available locally at http://127.0.0.1:8910.

Serving the Qwen3.8-27B-NVFP4-MTP-GGUF using the llama.cpp

We now have Qwen3.8-27B running locally. Next, we will test the model through both the API and the built-in browser interface.

4. Test Qwen3.8-27B Speed and Coding Performance

With the server running, open another terminal and send a test request to the OpenAI-compatible API:

curl http://127.0.0.1:8910/v1/chat/completions \
 -H "Content-Type: application/json" \
 -d '{
   "model": "qwen3.8-27b",
   "messages": [
     {
       "role": "user",
       "content": "Write a Python FastAPI application that monitors GPU usage."
     }
   ],
   "max_tokens": 2000
 }'

Testing the Qwen3.8-27B-NVFP4-MTP-GGUF using the CURL command

In this test, Qwen3.8-27B generated 2,000 tokens at 122 tokens/sec with an impressive 84.9% MTP acceptance rate. 

llama.cpp also includes a browser interface, so you can test the model without using the API.

Open http://127.0.0.1:8910 in your browser to see the UI.

Testing the Qwen3.8-27B-NVFP4-MTP-GGUF inside the llama.cpp webui

For a more complex test, I used this prompt:

Create a stunning single-file animated HTML website with a dark futuristic 
theme, smooth scrolling, glowing gradients, floating particles, animated cards,
hover effects, and responsive design using only HTML, CSS, and JavaScript.

Testing the Qwen3.8-27B-NVFP4-MTP-GGUF inside the llama.cpp webui on coding task

On my RTX 5090, I was getting around 142 tokens per second on average, with generation speeds occasionally reaching around 170 tokens per second, which is extremely fast for a 27B model running locally. 

image4.png

Qwen3.8-27B generated a polished, fully working website that ran right out of the box. This is a good way to quickly test both the model's coding ability and the speed of the local setup. 

5. Use Qwen3.8-27B with Pi

In this section, we will connect Qwen3.8-27B to Pi and use it as a fully local coding agent.

Pi is a lightweight terminal-based coding agent that can help you build, edit, test, and debug projects directly from the command line.

Install Pi with:

curl -fsSL https://pi.dev/install.sh | sh

The installer requires Node.js and npm. It installs Pi into your global npm prefix. If you don't have Node yet, install it first with nvm or your package manager.

Once the installation finishes, restart your terminal.

Next, install the pi-llama extension and point Pi to our local llama.cpp server:

pi install git:github.com/huggingface/pi-llama

export LLAMA_BASE_URL=http://127.0.0.1:8910/v1

Create a new project and start Pi:

mkdir new-project
cd new-project

Pi

Setting up the qwen3.8-27b in the Pi coding agent

Inside Pi, run /model, search for llama-cpp and select Qwen3.8-27B.

For testing, I gave it this prompt:

Build a polished personal finance dashboard from scratch that imports CSV 
bank statements, categorizes spending, shows monthly trends and charts, and 
detects unusual expenses; also generate a realistic sample CSV, import it, 
test the full app end-to-end, and fix any errors automatically.

Testing the qwen3.8-27b model with Pi coding agent

It built the entire project within a few minutes. 

Testing the qwen3.8-27b model with Pi coding agent

I then asked it to start the server and test both the frontend and application logic. It spent more time debugging and testing to make sure everything was working properly.

web dashboard generated with qwen3.8-27b model and Pi coding agent

When I tested the dashboard myself, the app worked well, the graphs looked great, and the overall experience was smooth.

web dashboard generated with qwen3.8-27b model and Pi coding agent

The main weakness was making precise UI changes. After several follow-up prompts, it started making unrelated changes instead of understanding exactly what I wanted, so I eventually stopped there.

Final Thoughts

Qwen3.8-27B is still very new, and the community is actively figuring out the best combination of quantization and speculative decoding. MTP works extremely well, but newer approaches such as DFlash 2 and DSpark are also being tested, with some users reporting even higher speeds depending on the hardware and workload. 

Unsloth has also just released Dynamic v3.0 GGUFs for Qwen3.8-27B, claiming around 10% higher accuracy at the same model size compared with its previous quants. This makes Unsloth another very interesting option if you want better quality while keeping roughly the same local inference setup. 

For now, I think NVFP4 + MTP + llama.cpp is one of the easiest and fastest setups for an RTX 5090. Getting around 140 tokens per second from a 27B model while still having a large context window and enough capability to run a real coding agent is impressive. The setup will probably get even faster as llama.cpp, Unsloth, DFlash 2, and DSpark continue to improve.

FAQs for Running Qwen3.8-27B Locally

Do you need an RTX 5090 to run Qwen3.8-27B locally?

No. Standard 4-bit GGUF quants of Qwen3.8-27B fit in roughly 16–19 GB of VRAM, so an RTX 5080, a 4090, or a 24 GB Mac will run the model. The RTX 5090 matters for this specific setup because NVFP4 needs Blackwell tensor cores. On older cards, NVFP4 files run but only give you the memory savings, not the speedup.

How much VRAM does this configuration actually use?

The NVFP4-MTP GGUF is around 19 GB on disk, and the KV cache is what pushes the total up as context grows. With q8_0 K/V quantization at very long context, published RTX 5090 runs land in the mid-20s GB, so a 32 GB card is comfortable. On 24 GB you will need to drop --ctx-size well below 131072.

What does MTP speculative decoding do, and is it lossless?

Qwen3.8 ships with multi-token prediction layers baked into the GGUF, which act as a built-in draft model, with no second file needed. The draft head proposes several tokens at once, and the full model verifies them, so accepted drafts cost a fraction of a normal forward pass. Output quality is unchanged, because every token the main model accepts is one it would have produced anyway.

Should you use NVFP4 or a regular Q4_K_M quant?

Pick NVFP4 if you have a Blackwell GPU and want maximum speed; pick a standard GGUF like Q4_K_M or Unsloth's UD-Q4_K_XL if you are on Ampere or Ada, or if you care more about output quality per gigabyte. NVFP4 support in llama.cpp is also newer than the K-quant path, so expect more rough edges around conversion and tooling.

Can this setup handle images, since Qwen3.8-27B is a vision model?

Qwen3.8-27B is a native vision-language model, but text-only GGUF conversions strip the vision tower. To use images, you need to pass a multimodal projector alongside the model with --mmproj, usually the mmproj file published in the same repo or in Unsloth's GGUF repo.


Abid Ali Awan's photo
Author
Abid Ali Awan
LinkedIn
Twitter

As a certified data scientist, I am passionate about leveraging cutting-edge technology to create innovative machine learning applications. With a strong background in speech recognition, data analysis and reporting, MLOps, conversational AI, and NLP, I have honed my skills in developing intelligent systems that can make a real impact. In addition to my technical expertise, I am also a skilled communicator with a talent for distilling complex concepts into clear and concise language. As a result, I have become a sought-after blogger on data science, sharing my insights and experiences with a growing community of fellow data professionals. Currently, I am focusing on content creation and editing, working with large language models to develop powerful and engaging content that can help businesses and individuals alike make the most of their data.

Topics

Become an AI Engineer With DataCamp!

Track

Associate AI Engineer for Developers

29 hr
Learn how to integrate AI into software applications using APIs and open-source libraries. Start your journey to becoming an AI Engineer today!
See DetailsRight Arrow
Start Course
See MoreRight Arrow
Related

Tutorial

Multi-Token Prediction Tutorial: How To Speed Up LLMs

Run Qwen3.6 27B on an RTX 3090 and learn how Multi-Token Prediction (MTP) with llama.cpp can boost local LLM inference by almost 2x without upgrading your GPU.
Abid Ali Awan's photo

Abid Ali Awan

Tutorial

How to Run Qwen3.5-27B Locally for Agentic Coding

Set up vLLM on a H100 GPU, serve Qwen3.5-27B, connect OpenCode, and test fast agentic coding with long context support.
Abid Ali Awan's photo

Abid Ali Awan

Tutorial

How to Run Qwen 3.5 Locally on a Single GPU: Step-by-Step Guide

Run the latest Qwen model on a single GPU VM, set up llama.cpp, and securely access it locally over SSH through a private OpenAI-compatible endpoint.
Abid Ali Awan's photo

Abid Ali Awan

Tutorial

How to Run Fable 5-Enhanced Gemma 4 Locally

Learn how to run Fable 5-Enhanced Gemma 4 locally with prebuilt llama.cpp binaries on an RTX 5070 Ti, test MTP speculative decoding, connect Pi for private AI coding-agent workflows, and troubleshoot common setup issues.
Abid Ali Awan's photo

Abid Ali Awan

Tutorial

How to Run GLM-4.7 Locally with llama.cpp: A High-Performance Guide

Setting up llama.cpp to run the GLM-4.7 model on a single NVIDIA H100 80GB GPU, achieving up to 20 tokens per second using GPU offloading, Flash Attention, optimized context size, efficient batching, and tuned CPU threading.
Abid Ali Awan's photo

Abid Ali Awan

Tutorial

Run Qwen3-Coder-Next Locally: Vibe Code an Analytics Dashboard

Run Qwen3-Coder-Next locally on an RTX 3090 with llama.cpp, then vibe code a complete analytics dashboard in minutes using Qwen Code CLI.
Abid Ali Awan's photo

Abid Ali Awan

See MoreSee More