Which Ollama model is best for coding? Local, agentic, tools, reasoning and embeddings

The best Ollama models for coding, local and agentic coding, cloud models, tool support, reasoning, image generation, embeddings, reranking, and training.

Presenting to a room
Presenting to a room

Key takeaways

  • Coding-specialised models such as the Qwen Coder family, Devstral and DeepSeek Coder are strong Ollama choices; pick the largest that fits your hardware.
  • For agentic coding, choose models trained for tool use and long context, and test them on your own repository.
  • Models tagged with tool support in the Ollama library can call functions, including Llama, Qwen, Mistral and gpt-oss families.
  • Ollama focuses on language and vision-understanding models; use ComfyUI or similar tools for image generation.
  • Ollama does not train models; fine-tune elsewhere, convert to GGUF and import with a Modelfile.

The best Ollama model for coding is usually the largest coding-specialised model your hardware runs comfortably: the Qwen Coder family is a common first choice, with Devstral, DeepSeek Coder and general models such as gpt-oss as strong alternatives. Benchmarks change monthly, so test two or three on your own code. I run local models for private document work alongside cloud APIs, so this page covers coding, agentic and cloud models, tool support, reasoning, image generation, embeddings, reranking, and training models for Ollama.

Which Ollama model is best for coding?

Coding-specialised models, especially the Qwen Coder series, are widely regarded as the best open coding models on Ollama, with Devstral, DeepSeek Coder and Codestral as other strong options. General models such as gpt-oss and Qwen also code well.

Size matters: a 7 to 8 billion parameter coder runs on a laptop GPU with 8 GB of VRAM when quantised, handling autocomplete and small functions; 14 to 32 billion models need 16 to 24 GB but reason much better about larger code. Compare models on tasks from your real projects: writing a function, fixing a bug and explaining unfamiliar code. Community comparisons, such as Reddit threads, are useful starting points, but your stack and languages decide.

What is the best local Ollama model for coding?

Locally, choose by VRAM: on 8 GB, a 7B coder in 4-bit; on 12 to 16 GB, a 14B model; on 24 GB or more, a 30B-class coder such as a larger Qwen Coder variant. Apple silicon Macs with unified memory can run larger models with enough RAM.

Also asked as: best ollama local model for coding

Practical tips:

  • Use the instruct versions for chat and the base or FIM-capable versions for autocomplete.
  • Increase the context length setting for multi-file work, if memory allows.
  • Pair Ollama with editor extensions such as Continue for in-editor use.
  • Keep a smaller model for fast completions and a larger one for chat.

Local models keep code private, which matters for client or proprietary work.

What is the best Ollama model for agentic coding?

Agentic coding needs models trained for tool use, instruction following and long context, so they can read files, run commands and edit code over many steps. Models built for this, such as Devstral and newer Qwen Coder releases, are the best local candidates.

Even strong open models are less reliable at long agent loops than frontier cloud models, so keep tasks small, provide good project instructions, and review every change. Run agents with tools such as Cline, Continue or OpenHands configured to use Ollama. Increase the context window, since agents accumulate long histories. Test on your repository with a handful of realistic tasks before trusting a model for bigger changes.

What is the best Ollama cloud model for coding?

Ollama offers cloud models that run large open models on Ollama's servers through the same interface, letting you use models too big for your machine, such as very large Qwen Coder or gpt-oss variants, for coding tasks.

Cloud models trade privacy for capability: code is sent to Ollama's servers, so review their data policy before using them with sensitive code. They are useful when local hardware cannot run strong models, or for occasional heavy tasks. Check the Ollama library for models marked as cloud, their limits and pricing, and compare results with local models and other providers on the same tasks.

Which Ollama models support tools?

Models tagged "tools" in the Ollama library support function calling, including recent Llama, Qwen, Mistral, gpt-oss and other families. You pass tool definitions with the chat request, and the model returns tool calls with arguments for your code to execute.

import ollama
tools = [{"type": "function", "function": {"name": "get_order_status",
          "parameters": {"type": "object", "properties": {"order_id": {"type": "string"}}}}}]
resp = ollama.chat(model="qwen3", messages=[{"role": "user", "content": "Where is order 4521?"}], tools=tools)
print(resp.message.tool_calls)

Validate tool arguments before executing them, and test reliability, since smaller models sometimes call tools incorrectly.

Which Ollama model is best for reasoning?

Reasoning-tuned models, such as DeepSeek-R1 distilled models, Qwen models with thinking modes, and gpt-oss with adjustable reasoning effort, perform best on maths, logic and multi-step problems. They think step by step before answering, which takes longer.

Choose the largest reasoning model that runs at acceptable speed. For quick questions, disable or reduce thinking to save time. Reasoning models help with debugging complex code, planning and analysis, but can overthink simple tasks. Evaluate on problems from your domain with known answers, because reasoning benchmarks do not always reflect practical usefulness.

Which Ollama model is best for image generation?

Ollama is designed mainly for language models and vision models that understand images, such as LLaVA, Gemma and Qwen vision variants, rather than for generating images. For image generation, use tools such as ComfyUI or Automatic1111 with Stable Diffusion or Flux models.

Vision models in Ollama can describe photos, read text in screenshots and answer questions about diagrams, useful for document and accessibility tools. For generation workflows, ComfyUI with GGUF-quantised models runs well on consumer GPUs. Check Ollama's release notes for any newer multimodal capabilities, since the project evolves quickly.

What is the best embeddings model on Ollama?

Popular Ollama embedding models include nomic-embed-text, mxbai-embed-large, bge-m3 for multilingual use, and newer options such as Qwen3 Embedding and EmbeddingGemma. The best choice depends on language, document type and speed needs.

Also asked as: best embeddings model ollama

For English RAG, start with nomic-embed-text or mxbai-embed-large; for Hindi and other languages, try bge-m3 or a multilingual Qwen embedding. Evaluate retrieval recall on your own questions before deciding. Use the same model for indexing and queries, record the model name with your index, and re-embed everything if you switch. Local embeddings keep private documents on your machine.

What is the best reranking model for Ollama?

Ollama does not provide a dedicated reranking endpoint, so most people run rerankers, such as BGE rerankers or other cross-encoders, through Sentence Transformers, a separate inference server, or a framework integration, alongside Ollama for generation.

Also asked as: best reranking model ollama

A typical local RAG stack: Ollama for embeddings and the chat model, a vector store for retrieval, and a cross-encoder reranker in Python to reorder the top 20 to 50 candidates before generation. Some people prompt an LLM to score relevance as a workaround, but dedicated rerankers are faster and more consistent. RAG.NextUpgrad's reranking step after fusion is where much of its answer quality comes from.

How do I train an Ollama model?

Ollama runs models but does not train them. Fine-tune a base model elsewhere with tools such as Unsloth or Hugging Face TRL using LoRA or QLoRA, merge or export it to GGUF format, then create an Ollama model from it with a Modelfile.

Also asked as: which ollama model supports tools · how to train ollama model

Steps:

  • Fine-tune with QLoRA on your instruction data, as FineTune Studio does.
  • Merge the adapter into the base model or export it.
  • Convert to GGUF and quantise with llama.cpp tools, or export directly with Unsloth.
  • Write a Modelfile with FROM ./model.gguf, the chat template and parameters.
  • Run ollama create mymodel -f Modelfile, then test it.

Compare the tuned model against the base on held-out prompts before relying on it.

Sources

  1. Ollama, Model libraryollama.com
  2. Ollama, repository and documentationgithub.com
  3. Ollama, Tool supportollama.com
  4. Ollama, Embedding modelsollama.com
  5. Hui et al., Qwen2.5-Coder Technical Report (2024)arxiv.org
  6. Unsloth, documentationdocs.unsloth.ai
Pranjul Rathour
Pranjul Rathour
GenAI Engineer · India

GenAI engineer and AI product builder with 2+ years shipping production-grade AI systems: RAG pipelines, fine-tuned LLMs, hybrid retrieval and multi-modal apps across vision, speech and OCR, architected end to end from ingestion to deployment. Leads engineering for SCULT INDIA's 14-member team, founded the 500+ member TechVerse Enclave community and has mentored 200+ students. Three hackathon first prizes: Changethon 2025 (IIT Roorkee), Product Genesis at Vividhotsava 2025 (CSJMU) and BYTEBATTLE (MeetKats).

Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at colleges. For campus sessions the inviting institution covers the visit end to end: travel (a First AC train ticket for journeys up to five hours, a flight for anything longer), accommodation, meals, and pickup and drop; the honorarium and workshop fees are negotiable on WhatsApp or on the call, and requests are welcome from institutions that can cover the visit this way. Email pranjulrathour41@gmail.com.

Keep reading

More on RAG & retrieval

All RAG & retrieval guides →
Campus talks · hackathon judging · mentoring

Want this as a live session at your college?

Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at colleges. For campus sessions the inviting institution covers the visit end to end: travel (a First AC train ticket for journeys up to five hours, a flight for anything longer), accommodation, meals, and pickup and drop; the honorarium and workshop fees are negotiable on WhatsApp or on the call, and requests are welcome from institutions that can cover the visit this way.

Pranjul Rathour, GenAI engineer in India