How to Run Qwen 4 Locally
Run Qwen4-35B-A3B with Ollama, LM Studio, llama.cpp or vLLM. Match GGUF sizes to your GPU or Mac and leave room for context.
Published

If you want Qwen 4 answering in your terminal tonight, install Ollama and run ollama run qwen4. Its default download is 36 to 37 GB. If you have a 24 GB GPU or a 24 GB Apple Silicon Mac, there’s a more deliberate choice: Unsloth recommends a 4-bit copy called UD-IQ4_XS that keeps a lookup table on SSD. Download the right copy once and you can bring a code sample or an internal document to the model on your desk.
Can my machine run Qwen4-35B-A3B?
Check two numbers before you download anything: free SSD space and available working memory. The “3B active” in Qwen’s model card tells you how much of the main model works on each token, a small piece of text. The runtime still needs access to all 35 billion main parameters, the learned numbers that shape its answers. Qwen also has an engram, a lookup table for short sequences of tokens. Think of it as a reference book you can leave on a shelf and open as needed.
A quantization, or quant, stores the numbers at lower precision. The table pairs Unsloth’s suggested machine sizes with the actual two files for each quant on Hugging Face. The second file holds the engram. Disk totals add the rounded file sizes shown by the publisher. Leave extra space for the runtime and, for vision, the separate 903 MB BF16 projector.
On Apple Silicon, the CPU and GPU share one pool of unified memory. Count it once and leave space for macOS and your apps. With a separate graphics card, system RAM and GPU memory are distinct pools. The table assumes the Unsloth loading settings below. It doesn’t predict how much of a different package will land on your GPU.

The Qwen4-35B-A3B model overview explains the name and inputs. This is the downloadable model in the Qwen 4 family. The Qwen4-Max guide covers a different model.
Four ways to get a first answer
Pick the route by what you want to have open when the download finishes: a terminal, a chat window, a browser with a particular GGUF loaded, or an endpoint for your application.

Ollama for a terminal chat
With Ollama installed and running, enter ollama run qwen4. Wait for the download, then try “Write a Python function that returns the larger of two dates.” A short prompt with a checkable answer makes a better first test than a whole repository.
If you’re deciding what to pull, the library lists qwen4:35b-a3b-q4_K_M at 37 GB, the MLX qwen4:35b-a3b-nvfp4 at 36 GB and the BF16 tag at 114 GB. Those are package sizes. To see the CPU/GPU split and allocated context after loading, run ollama ps in another terminal. For a side-by-side look at the desktop workflows, see Ollama vs LM Studio.
LM Studio for a chat window on your Mac or PC
Open the LM Studio model page, click Use Model in LM Studio, download the offered model and select it in chat. The page lists 22 GB minimum system memory for its package. If you already have the LM Studio CLI, the maker’s interactive command is lms chat. Pick the downloaded Qwen4-35B-A3B when prompted. Interactive chat reference.
On a Mac, an older app may mark a Qwen4 GGUF as too large. Update before abandoning the download: the Bionic release notes record a fix for that specific warning. Then check your actual available memory. The LM Studio Bionic guide covers the surrounding desktop app.
llama.cpp for a particular GGUF and SSD offload
Use this route when the table helped you pick a specific file. Start with a current build of llama.cpp. On a Debian or Ubuntu machine with the NVIDIA CUDA toolkit installed, Unsloth gives these build commands. The first two need package-manager privileges.
apt-get update
apt-get install pciutils build-essential cmake curl libcurl4-openssl-dev -y
git clone https://github.com/ggml-org/[llama.cpp](https://omidsaffari.com/go/llama-cpp?from=run-qwen4-35b-a3b-locally)
cmake llama.cpp -B llama.cpp/build \
-DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=ON
cmake --build llama.cpp/build --config Release -j --clean-first --target llama-cli llama-mtmd-cli llama-server llama-gguf-split
cp llama.cpp/build/bin/llama-* llama.cpp
On Apple Silicon, skip the Linux package-manager lines. With the Mac build tools and CMake installed, use the same clone and build sequence, changing the configure option to -DGGML_CUDA=OFF. Metal, Apple’s GPU backend, is enabled by default. Windows and other GPU backends have their own llama.cpp build instructions.
From the directory containing the built llama.cpp folder, Unsloth’s thinking-mode launch is:
./llama.cpp/llama-server \
-hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XL \
--load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0That command selects the 32 GB row. For the 24 GB row, change only UD-Q4_K_XL to UD-IQ4_XS; for another row, use its exact quant name. The -hf option fetches both shards and the vision projector. The three options on the next line let the runtime read the engram from SSD on demand. When the server is ready, open its printed local address and send your first prompt in the built-in chat interface.
Choose this over the simpler terminal route if you need to repeat the run with exactly the same files on another workstation. Ollama vs llama.cpp explains the runtime trade-offs; the Unsloth guide covers its desktop alternative.
vLLM for a GPU server your application can call
Choose vLLM’s NVIDIA launch recipe if you have a supported server GPU and Docker with GPU access. The FP8 checkpoint needs 39.7 GB for GPU-resident weights and 20.5 GB of host RAM for the engram, plus runtime headroom. Here is the maker’s NVIDIA command for its Qwen4 container:
docker run --gpus all --ipc=host -p 8000:8000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-e VLLM_USE_RUST_FRONTEND=1 \
vllm/vllm-openai:qwen4 Qwen/Qwen4-35B-A3B-FP8 \
--trust-remote-code --enable-prefix-caching --max-model-len auto --disable-flashinfer-autotune \
--kv-cache-dtype nvfp4 --attention-config.indexer_kv_dtype fp8 \
--enable-auto-tool-choice --tool-call-parser qwen4 --reasoning-parser qwen4 \
--speculative-config '{"method":"mtp","num_speculative_tokens":3,"index_share_for_mtp_iteration":true}'The application can now use an OpenAI-compatible client pointed at http://localhost:8000/v1 on that host. Read the selected context limit in the startup log. If your GPU uses a different cache format, choose its preset on the hardware-specific recipe page before launching.
If you lack the hardware, a Runpod GPU Pod lets you rent a compatible server for the trial.
How much context and thinking should you use?
Keep the default context for your first prompt. Context is the conversation the model can work with at once, including the input and room for generated tokens. Qwen supports 1,048,576 tokens natively. The runtime must also store information about earlier tokens in a working cache. For one million tokens, vLLM documents 8 GiB for the NVFP4 cache alone in its Qwen4 configuration. The weights, engram and remaining runtime costs are separate. Applying that figure to an arbitrary Mac GGUF would give you the wrong budget.
Ollama’s defaults depend on VRAM: 4K below 24 GiB, 32K from 24 to below 48 GiB, and 256K at 48 GiB or above. Use the context slider in Settings, or set the limit when starting the service. Its documented example is OLLAMA_CONTEXT_LENGTH=64000 ollama serve. Check the resulting CONTEXT and PROCESSOR columns with ollama ps. In vLLM, the example’s --max-model-len auto chooses a window the available cache can hold. Ollama context settings.
Thinking effort is a separate choice. Qwen’s chat template accepts off for direct replies, low for light reasoning, high for ordinary work (the default), and xhigh for complex tasks where quality matters most. Prior reasoning is preserved by default. The model can answer a simple prompt directly even with thinking enabled. For a multi-step coding task, try high first: retries can erase the time saved by lowering the effort. In vLLM’s top-level client field, the spelling to disable reasoning is none. In the Qwen template it’s off.
When the first run goes wrong
Which work is worth moving onto the machine?
Start with work you repeat and can check locally. A model that answers “hello” has passed the install test; a useful workstation should also pass a task you would give it again.
- A maintainer reviewing a private patch could paste the diff and ask which behavior changed, then check the answer against the tests. This is my first pick: the inputs are already on disk and the maintainer has a way to catch mistakes.
- A support engineer could give the model a short log excerpt and ask it to put the events in order, preserving each timestamp. Comparing the result with the original gives the engineer a draft incident timeline.
- A field technician could download the model before leaving the office and query a saved manual in LM Studio at a site without connectivity. Ask for the paragraph supporting each answer so the technician can check it.
- A frontend developer could give a vision-capable setup a screenshot and ask for the labels in reading order. Comparing that list with the intended layout gives the developer a focused review task.
- A platform engineer could point a staging client at vLLM and replay a small set of approved prompts. Compare the returned text and reasoning fields with what the application expects before switching any shared workflow.
Two tools worth building around the install
A machine-fit checker is the stronger opportunity. A workstation reseller could use it before quoting a GPU upgrade. Ollama’s Qwen4 listing showed 236.4K downloads on December 5. The smallest useful checker would accept SSD space, memory type and free capacity, then return one quant, both filenames and the publisher’s launch settings. Its hardest job would be keeping the sizes and offload rules current. A disk-only calculator would miss the very reason someone with 24 GB can use a 32 GB download.
A repeatable offline setup for a field team could turn a successful desktop chat into a kit an IT lead can hand to another technician. LM Studio’s model listing showed 22K downloads on December 5. A first version could pin one model, package a sample manual with known answers and record whether a laptop passes the same check disconnected. The buyer would be paying for repeatable deployment and support. Both download counts show uptake; neither measures how many teams would buy either product.
Can you run Qwen on a laptop?
Yes. A 24 GB Apple Silicon laptop is one of Unsloth’s recommended starting points for UD-IQ4_XS with the engram on SSD. If your laptop has 18 GB available for the setup, its suggested first try is UD-IQ3_XXS with a short context.
Can Qwen run without internet?
Yes. In LM Studio, download the needed runtime and model before disconnecting. Local chat, document processing and the local server can then operate offline. LM Studio offline operation.
What are the limitations of Qwen?
On a personal machine, the practical limit is often how much working memory remains after loading the weights. Small quants help with fit but can repeat themselves, and extra context needs more cache. Check a representative prompt at the context length you actually need.
If your team needs a shared endpoint for that workflow, I can help build the production setup.
- Published
- Category
- Build







