Ollama Basic Concepts
Ollama is a localized machine learning framework that supports a variety of natural language processing (NLP) tasks, focusing on model loading, inference, and generation tasks.
Through Ollama, users can easily interact with large pre-trained models deployed locally.
1. Model
In Ollama, models are the core component. They are pre-trained machine learning models capable of performing different tasks, such as text generation, text summarization, sentiment analysis, and chat generation.
Ollama supports many popular pre-trained models; common models include:
- deepseek-v3: A large language model provided by DeepSeek, specialized for text generation tasks.
- LLama2: A large language model provided by Meta, specialized for text generation tasks.
- GPT: OpenAI's GPT series models, suitable for a wide range of tasks such as chat generation and text reasoning.
- BERT: A pre-trained model for sentence understanding and question-answering systems.
- Other custom models: Users can upload their own custom models and use Ollama for inference.
Main functions of a model:
- Inference: Generate output results based on user input.
- Fine-tuning: Users can train on top of an existing model using their own data, thereby customizing the model to suit specific tasks or domains.
A model is typically a neural network composed of a large number of parameters; by training on large amounts of text data, it can learn language patterns and perform efficient inference.
Supported Ollama models can be accessed at:https://ollama.com/library

Click a model to view its download command:

The table below lists download commands for some models:
| Model | Parameters | Size | Download command |
|---|---|---|---|
| Llama 3.3 | 70B | 43GB | ollama run llama3.3 |
| Llama 3.2 | 3B | 2.0GB | ollama run llama3.2 |
| Llama 3.2 | 1B | 1.3GB | ollama run llama3.2:1b |
| Llama 3.2 Vision | 11B | 7.9GB | ollama run llama3.2-vision |
| Llama 3.2 Vision | 90B | 55GB | ollama run llama3.2-vision:90b |
| Llama 3.1 | 8B | 4.7GB | ollama run llama3.1 |
| Llama 3.1 | 405B | 231GB | ollama run llama3.1:405b |
| Phi 4 | 14B | 9.1GB | ollama run phi4 |
| Phi 3 Mini | 3.8B | 2.3GB | ollama run phi3 |
| Gemma 2 | 2B | 1.6GB | ollama run gemma2:2b |
| Gemma 2 | 9B | 5.5GB | ollama run gemma2 |
| Gemma 2 | 27B | 16GB | ollama run gemma2:27b |
| Mistral | 7B | 4.1GB | ollama run mistral |
| Moondream 2 | 1.4B | 829MB | ollama run moondream |
| Neural Chat | 7B | 4.1GB | ollama run neural-chat |
| Starling | 7B | 4.1GB | ollama run starling-lm |
| Code Llama | 7B | 3.8GB | ollama run codellama |
| Llama 2 Uncensored | 7B | 3.8GB | ollama run llama2-uncensored |
| LLaVA | 7B | 4.5GB | ollama run llava |
| Solar | 10.7B | 6.1GB | ollama run solar |
2. Task
Ollama supports a variety of NLP tasks. Each task corresponds to a different application scenario of the model, mainly including but not limited to the following:
- Chat Generation: Generate natural conversational replies through interaction with the user.
- Text Generation: Generate natural language text from a given prompt, such as writing articles or generating stories.
- Sentiment Analysis: Analyze the sentiment of a given text (e.g. positive, negative, neutral).
- Text Summarization: Compress long text into a concise summary.
- Translation: Translate text from one language into another.
Through the command-line tool, users can specify different tasks and load different models to complete specific tasks.
3. Inference
Inference refers to the process of processing input on a trained model to generate output.
Ollama provides easy-to-use command-line tools or APIs, allowing users to quickly provide input to a model and obtain results.
Inference is one of Ollama's main functions and the core of interacting with models.
Inference process:
- Input: The user provides text input to the model, which can be a question, a prompt, or conversational content.
- Model processing: The model generates appropriate output based on the input through its built-in neural network.
- Output: The model returns the generated text content, which may be a reply, a generated article, translated text, etc.
Ollama interacts with local models through APIs or the CLI, allowing users to easily perform inference tasks.
4. Fine-tuning
Fine-tuning refers to further training on a pre-trained model based on specific domain data, so that the model performs better on specific tasks or domains.
Ollama supports fine-tuning; users can fine-tune a pre-trained model with their own dataset to customize the model's output.
Fine-tuning process:
- Prepare a dataset: The user prepares a dataset for a specific domain; the data format is usually a text file or JSON.
- Load a pre-trained model: Select a pre-trained model suitable for fine-tuning, such as LLama2 or a GPT model.
- Training: Train the model with the user's specific dataset so it better adapts to the target task.
- Save and deploy: After training is complete, the fine-tuned model can be saved and deployed for later use.
Fine-tuning helps the model perform more accurately and efficiently when handling domain-specific problems.