Skip to content

Supported models

twinny works with any model your server can run, but the three jobs want different kinds of model. The lists below are models that have been tried and work well. If you find another that works, please open an issue or pull request.

Chat

Any model trained to follow instructions works for chat, inline edits, code review and commit messages. Smaller models are fine for short questions and edits; reviews and long conversations benefit from a bigger one.

ModelSizesNotes
qwen2.5-coder -instruct1.5b, 3b, 7b, 14b, 32bThe best all-round code family at every size
llama3.1, llama3.23b, 8b, 70bStrong general chat
deepseek-coder-v216bGood at code, needs memory
codestral22bExcellent for code; also a FIM model
mistral, mistral-nemo7b, 12b
codellama:7b-instruct7b, 13b, 34bOlder but reliable
phind-codellama34b

Hosted chat models are listed on Hosted APIs.

Vision models (llama3.2-vision, llava, hosted GPT and Claude models) accept images pasted into the chat.

Code completion (fill-in-the-middle)

Only models trained with fill-in-the-middle (FIM) tokens can complete code between what is before and after the cursor. For most families that is the base or code variant. Instruct models will produce suggestions, but they tend to chatter or explain instead of completing.

twinny picks the prompt format from the model name when the FIM template is set to Automatic. The table shows which names it recognises.

FamilyRecommended tagsTemplateRepo-level context
Qwen2.5-Coderqwen2.5-coder:1.5b-base, qwen2.5-coder:7b-basecodeqwen (any name containing qwen)
CodeLlamacodellama:7b-code, codellama:13b-codecodellama
DeepSeek Coderdeepseek-coder:6.7b-base, deepseek-coder:1.3b-basedeepseek
Codestralcodestral, or Mistral’s hosted codestral-latestcodestral
StarCoder2starcoder2:3b, starcoder2:7bstarcoder
Granite Codegranite-code:3b-base, granite-code:8b-basestarcoder
CodeGemmacodegemma:2b-code, codegemma:7b-codecodegemma
Stable Codestable-code:3b-codestable-code
CodeGeeXcodegeex4starcoder

Repo-level context means the model has tokens for naming files, so neighbouring files are passed as separate blocks rather than commented text.

Notes:

  • A 1.5B to 7B model is the sweet spot for autocomplete: fast enough to keep up with typing, good enough to be useful. Start with qwen2.5-coder:1.5b-base and move up if your hardware has room. The 34b CodeLlama does not do well at FIM.
  • starcoder2 and codegemma sometimes fail to stop. Lowering twinny.temperature and twinny.maxLines helps.
  • If a model’s name does not match any family, twinny falls back to the CodeLlama format. Set the template by hand in the provider form.
  • For a model that needs its own prompt format, choose custom-template and edit ~/.twinny/templates/fim.hbs; see Prompt templates.

Embeddings

Embedding models turn text into vectors for the workspace index. twinny recognises a model as an embedding model if its name contains embed, minilm, bge, e5 or nomic.

ModelSizeNotes
nomic-embed-text137MGood quality, 8k token context. The recommended default
all-minilm23MVery small and fast; its 256-token window means twinny embeds each chunk in windows
mxbai-embed-large335MHigher quality, slower
bge-m3567MMultilingual
snowflake-arctic-embed22M to 335M
OpenAI text-embedding-3-smallhostedVia the OpenAI embeddings preset

Changing the embedding model means rebuilding the index, since vectors from different models do not mix. The reranker that orders results is separate and built in; it does not depend on the embedding model.