Video summary
Qwen4 in Just 4GB VRAM? Surprisingly Fast!
Main summary
Key takeaways
Summary
The video tests whether Qwen4-35B-A3B, a mixture-of-experts model, can run with only 4 GB of available VRAM. The presenter used an RTX 3090 with most of its VRAM deliberately occupied, an 8-core Ryzen 7 limited to 8 threads, llama.cpp, and Unsloth’s 2-bit IQ2_XS model file, which is about 24 GB.
The key finding is that how the model is split between GPU and system RAM matters more than simply putting as many layers as possible on the GPU. The usual approach—placing just four layers on the GPU—generated about 12 tokens per second. Because Qwen4 is a mixture-of-experts model, the presenter instead placed the model’s layers on the GPU while keeping its expert blocks and large embedding table in system RAM. This raised output speed to about 45 tokens per second. Moving some expert layers back to the GPU used the remaining VRAM and increased speed to 50.7 tokens per second.
With a roughly 4,000-token prompt, the optimized setup produced around 50 tokens per second. With a 32,000-token prompt, output speed remained about 47 tokens per second, though prompt processing took longer—about 550 tokens per second, with roughly a minute before generation began. The presenter notes that the RTX 3090’s memory is faster than that of many actual 4 GB cards, so the results should be treated as a best-case test for a 4 GB VRAM limit.
Task Results
- Coding bug hunt: Qwen4 found four hidden bugs in a shopping-cart app, returned corrected files, and passed all eight hidden tests in about 67 seconds.
- Long-document analysis: It processed a warehouse log exceeding 45,000 tokens and correctly calculated 1,645 units. The first attempt ran out of context space; the successful run used a 60,000-token context and adjusted expert placement to make room.
- Game generation: It produced a single-file HTML game, Orbit Defense, featuring a rotating turret, asteroids, scoring, waves, shields, and a game-over screen. The code took about 107 seconds to generate, and the game worked when tested.
The presenter also limited system memory to 16 GB. In that test, output speed was about 49 tokens per second, and the bug-hunt tests still passed. The explanation offered is that the 2-bit experts fit in RAM and the embedding table is accessed as needed, avoiding mid-generation SSD access.
Setup Guidance
The video recommends the following approach for a 4 GB graphics card:
- Use llama.cpp with the IQ2_XS 2-bit Qwen4 model.
- Put the layers on the GPU while placing the experts in system RAM with the CPU-MoE option.
- Keep the embedding table in RAM and use an 8-bit context cache to reduce memory use.
- Set enough context capacity for both the prompt and response; long documents and reasoning can require more room than the prompt alone.
- If VRAM remains available, move some expert layers back to the GPU to improve speed.
Overall, the test suggests that a system with 4 GB of VRAM and 16 GB of RAM can handle useful local-model tasks at roughly 50 tokens per second with this configuration. The presenter cautions that this does not replace a high-end GPU for heavy workloads, but may be practical for everyday coding, writing, and smaller projects.
Source and Tools
- Main speaker/source: NetworkCoder presenter and the video’s local hardware tests
- Software and model: llama.cpp and Unsloth’s Qwen4-35B-A3B IQ2_XS model
Rate this summary
Your feedback will help improve summaries.
Improve this summary
Reprocess with a stronger model when the summary feels incomplete or inaccurate.
Translate summary in another language
Ask questions to this video
Chat for follow-up questions, clarifications, and source-backed answers.