Skip to content

Using Small LLM Models Locally with Ollama

6 min

Let's play locally with the smallest LLM models available. We'll go through Ollama server installation, model setup and code integration.

What's the smallest Ollama model? As of November 2026, the smallest models in the official Ollama library are smollm2:135m (271 MB) and gemma3:270m (292 MB). Models this small are best for simple, narrow tasks. For prompts that need some reasoning, start with gemma3:1b (806 MB) or qwen3:1.7b (1.4 GB), the two models I try below. Gemma 4 is out too, but its smallest variant (gemma4:e2b) is a 4.3 GB+ download and needs a recent Ollama version, so Gemma 3 1b is still the smallest Gemma worth starting with.

Which small model for what? Download sizes are for the default tags in the Ollama library as of November 2026.

Need Model (download size)
Check that Ollama works smollm2:135m (271 MB) or gemma3:270m (292 MB)
Chat and simple text tasks gemma3:1b (806 MB)
Reasoning and tool calling qwen3:1.7b (1.4 GB), or qwen3:0.6b (523 MB) to stay under 1B
Coding qwen2.5-coder:0.5b (398 MB) or qwen2.5-coder:1.5b (986 MB)
Embeddings all-minilm (46 MB) or nomic-embed-text (274 MB)

Tool calling only works with models that support it. In my test, qwen3:1.7b and gemma4:e2b called a tool and used its result, while gemma3:1b rejected the request. Gemma 3n isn't listed with tool support in Ollama either, so Gemma 4 is the Gemma to pick for tools.

Ollama Installation

To install Ollama server, as your entry point for all OpenSource LLMs, run:

curl -fsSL https://ollama.com/install.sh | sh

If you're a poor macOS or Windows user, download it here :-)

Model Setup

Now let's download and run a model you're interested in playing with.

I will try two models: Gemma 3 and Qwen 3, which thinks before it answers.

Gemma 3 (1b parameters; 806MB):

ollama run gemma3:1b

When it finishes downloading model, it will ask for your prompt. You may try something like what would happen if people stopped blogging? to test reasoning.

Qwen 3 (1.7b parameters; 1.4GB):

ollama run qwen3:1.7b

Try the same prompt what would happen if people stopped blogging? here and compare the results.

In my November 2026 test, both models returned a structured list of consequences. Qwen 3 first prints its reasoning ("Thinking..."), so it takes longer to start answering, but you can follow how it got there.

By the way, you don't need to host the models locally, you can install Ollama on VPS with better GPU and RAM if you need it.

Integration

Updated in November 2026 for AI SDK 7 and ollama-ai-provider-v2 4.x, tested with Ollama 0.30. The original ollama-ai-provider package only works with AI SDK 4.

If you want to use local models in your TS/JS app, consider using Vercel AI SDK with ollama-ai-provider-v2 like so:

// index.ts
import { generateText } from "ai";
import { ollama } from "ollama-ai-provider-v2";

async function main() {
  const prompt = "what would happen if people stopped blogging?";

  const { text: responseGemma } = await generateText({
    model: ollama("gemma3:1b"),
    prompt,
  });

  console.log(responseGemma);
  console.log("\n\n----------\n\n");

  const { text: responseQwen } = await generateText({
    model: ollama("qwen3:1.7b"),
    prompt,
  });

  console.log(responseQwen);
}

main().catch(console.error);

Vercel AI SDK also supports text streaming and built-in frontend components, which can come in handy in real app. If you want to go deeper and develop your own tool for Vercel AI SDK, I've got a good example of it in my post on @suiware blog.

Once a model runs locally, you can make it available through your own API. I show three ways to do that in Build Your Own AI-Powered API with Ollama, Hono and Vercel AI SDK.

That's it for now. A quick experiment that I think has opened doors to unlimited opportunities which you can now explore yourself.

Relevant Posts