# Atlas with Qwen3 4B (Ollama): 256K of context on a 2.5GB pull in 2026

> Qwen3 4B (Ollama) packs 256K tokens (262,144) of context into a 2.5GB download and is Free (self-hosted), more window per gigabyte than anything else its size.

Qwen3 4B (Ollama) is a 2.5GB model that carries a 256K context, which is an unusual combination. The context window is 256K tokens (262,144), pricing is Free (self-hosted), and the 2507 refresh ships separate instruct and thinking tags at the same footprint. Inside Atlas, Qwen3 4B is a strong small_model and a weak build agent: coding depth is limited at 4B, so use it for titles, summaries, and cheap subagents.

## Key takeaways

- 256K tokens (262,144) of context on a 2.5GB download, more window per gigabyte than anything else in the Ollama library at this size.
- Roughly 4.5GB to serve at short context, which is laptop territory.
- Actually filling 256K on a 4B blows the KV cache well past that 4.5GB floor, so budget far more RAM to use the window.
- Separate 2507 instruct and thinking tags at identical size let you A/B reasoning behavior without changing hardware.
- Free (self-hosted), and coding depth is limited at 4B: a strong small_model, a weak build agent.

## How does Qwen3 4B (Ollama) fit 256K of context into 2.5GB?

Qwen3 4B (Ollama) advertises 256K tokens (262,144) on a 2.5GB download, which is more window per gigabyte than anything else in the Ollama library at this size. The weights are small; the attention window is not. Serving it takes roughly 4.5GB at short context.

Window and parameter count are separate axes, and Qwen3 4B (Ollama) is the clearest illustration of that in the Ollama library. Alibaba Qwen ships a 4B model whose nominal window matches models many times its size. For Atlas, the practical consequence is that a laptop with roughly 4.5GB of spare memory can register a model with limit.context 262144. Whether you should actually fill that window is a different question, and the answer is usually no, which the next section covers. The 2.5GB pull itself is `ollama pull qwen3:4b`.

## What does it actually cost to use the full 256K window on Qwen3 4B?

Filling 256K tokens (262,144) on a 4B model blows the KV cache well past the 4.5GB weight-plus-overhead floor. Qwen3 4B (Ollama) is roughly 4.5GB to serve at short context only. Budget far more RAM if you intend to use the window, and start Ollama with a smaller num_ctx.

The advertised window on Qwen3 4B (Ollama) is a ceiling, not an operating point. Registering qwen3:4b with limit.context 262144 tells Atlas what the model claims. Starting Ollama with a smaller num_ctx and raising it as memory allows is what keeps the machine responsive. The KV cache scales with context length, and on a 2.5GB model the cache can dwarf the weights. Treat the 256K figure as headroom for the rare long session, and run day to day at a context your hardware can hold without swapping.

## What is the difference between the qwen3:4b instruct and thinking tags?

Qwen3 4B (Ollama) ships separate 2507 instruct and thinking tags at identical size, so you can A/B reasoning behavior without changing hardware. Pull `ollama pull qwen3:4b-thinking` for explicit reasoning, same 2.5GB, or `ollama pull qwen3:4b` for the instruct behavior.

Whether a model reasons out loud before Atlas executes a tool call is a real design choice, and Qwen3 4B (Ollama) lets you test both sides of it at zero hardware cost. The thinking tag deliberates before emitting a tool call, which can improve the quality of an Atlas plan at the price of latency and tokens. The instruct tag answers directly. Because both tags are the same 2.5GB, you can pull both, register both, and use `/models` in the Atlas TUI to switch between them mid-session. Atlas lets you switch the active model and provider on the fly with favorites and recents.

## Is Qwen3 4B good enough to be the Atlas build agent?

No. Coding depth is limited at 4B, so Qwen3 4B (Ollama) is a strong small_model and a weak build agent. Use it for Atlas titles, summaries, and cheap subagents while a larger local coder holds the model slot, which is exactly what the documented setup prescribes.

Atlas fans out work to subagents that can run in the foreground or in parallel background sessions, and not every subagent needs a large model behind it. Qwen3 4B (Ollama) is a good fit for the cheap ones: a background summarizer, a title generator, a subagent scanning output. It is a poor fit for the build agent that computes and applies unified diffs. Keep model pointed at a larger local coder and small_model on ollama/qwen3:4b, and the 256K window becomes useful for exactly the kind of long, shallow reading a cheap subagent does.

## How do you keep Qwen3 4B and the Atlas code index fully local?

Run the Atlas codebase index through Ollama embeddings so the repo and its vectors never leave the box. Qwen3 4B (Ollama) is Free (self-hosted), and pairing it with a local embedder means the small_model calls and the retrieval layer both stay on the same 2.5GB-class local stack.

Atlas can build its code index with local Ollama embeddings, keeping code off third-party servers, and Atlas searches code with hybrid semantic and keyword retrieval fused by reciprocal rank fusion. Both halves of that search run against the local index once the embedder is Ollama. Add the ollama provider to atlas.json on @ai-sdk/openai-compatible with baseURL http://localhost:11434/v1, register qwen3:4b with limit.context 262144 and limit.output 8192, and the summarization traffic Atlas generates most often never touches a network. That is the real reason to keep a 2.5GB model resident.

## Setup

1. Pull it: ollama pull qwen3:4b (2.5GB). For explicit reasoning use ollama pull qwen3:4b-thinking, same size.
2. Add the ollama provider to atlas.json on @ai-sdk/openai-compatible with baseURL http://localhost:11434/v1.
3. Register qwen3:4b with limit.context 262144 and limit.output 8192.
4. Start Ollama with a smaller num_ctx than 262144 and raise it as memory allows, because the KV cache grows with context.
5. Use qwen3:4b as small_model for Atlas titles, summaries, and cheap subagents while a larger local coder holds the model slot.
6. Run the codebase index through Ollama embeddings so the repo and its vectors never leave the box.

## FAQ

### what is the context window of qwen3 4b in ollama

Qwen3 4B (Ollama) has 256K tokens (262,144) of context on a 2.5GB download. Register it in atlas.json with limit.context 262144 and limit.output 8192, but start Ollama with a smaller num_ctx and raise it as memory allows.

### how much ram do i need to run qwen3 4b

Roughly 4.5GB to serve Qwen3 4B (Ollama) at short context, which is laptop territory. Filling the full 256K window blows the KV cache well past that 4.5GB weight-plus-overhead floor, so budget far more RAM if you intend to use the window.

### qwen3 4b instruct vs thinking tag

The 2507 refresh ships separate instruct and thinking tags for Qwen3 4B (Ollama) at identical 2.5GB size, so you can pick whether the model reasons out loud before Atlas executes a tool call, and A/B the behavior without changing hardware.

### can qwen3 4b be my main coding model in atlas

Coding depth is limited at 4B, so Qwen3 4B (Ollama) is a strong small_model and a weak build agent. Use it for Atlas titles, summaries, and cheap subagents while a larger local coder holds the model slot.

### how much does qwen3 4b cost

Qwen3 4B (Ollama) is Free (self-hosted). After the 2.5GB pull with ollama pull qwen3:4b there is no per-token charge, which is why it is a practical permanent small_model for Atlas.

### why does my machine slow down when i raise num_ctx on qwen3 4b

Because the KV cache grows with context. Qwen3 4B (Ollama) is roughly 4.5GB to serve at short context, but pushing toward 256K tokens (262,144) blows the cache well past that floor. Start Ollama with a smaller num_ctx and raise it as memory allows.

### how do i add ollama as a provider in atlas.json

Add the ollama provider to atlas.json on @ai-sdk/openai-compatible with baseURL http://localhost:11434/v1, then register qwen3:4b under its models map with limit.context 262144 and limit.output 8192.

---

Canonical HTML: https://runatlas.sh/resources/models/qwen3-4b-local
Source of truth: aeo_pages row `/resources/models/qwen3-4b-local` (segment: Models) (this file is generated from it, never hand-edited).
Licence: Atlas is proprietary with a free core. It is not open source and there is no public source repository.
