Running & Controlling Local LLMs

๐Ÿค– Ollama Beginner Guide: Running & Controlling Local LLMs

In this tutorial, we will learn how to use Ollama to run Large Language Models (LLMs) locally on your system. This guide is beginner-friendly and covers everything from running models to customizing their behavior.


๐Ÿš€ What is Ollama?

Ollama is a tool that allows you to run AI models like LLaMA, Qwen, and Gemma locally on your machine without needing cloud APIs.

  • ✔ No internet required after setup
  • ✔ Full control over models
  • ✔ Faster and private execution

⚙️ Initializing Ollama

Before using any model, you need to download and run it.


ollama pull llama   # Download the model
ollama run llama    # Run the model

If the model is not already downloaded, ollama run will automatically download it.


๐Ÿ’ฌ Talking to the Model

Once the model is running, you can interact with it like a chatbot.

  • /? → Show help commands
  • /clear → Clear chat history
  • /bye → Exit the model

⚡ Running One-Time Queries

If you don’t want to maintain conversation history, you can run a single query directly:


ollama run llama "Enter your query"

This is useful for quick tasks like summarization or Q&A.


๐Ÿ–ผ️ Working with Image Models

Ollama also supports image-based models for tasks like summarization.


ollama run gemma3:4b

Then provide an instruction like:


Summarize "C:\path\to\your\image.jpg"

This allows the model to extract and explain information from images.


๐Ÿง  Thinking Models

Some models like Qwen or DeepSeek-style models have thinking capabilities.

  • ✔ Show reasoning steps
  • ✔ Better for coding and problem solving
  • ✔ More accurate for complex tasks

๐Ÿ” Model Exploration Commands

1️⃣ /show Command

Used to explore model details and capabilities:


/show

Available options include:


/show info
/show license
/show parameters
/show system
/show template

2️⃣ /set Command

Used to customize how the model behaves.


/set system "You are a funny assistant"

This sets a system instruction that affects all responses.

๐Ÿ“Œ Example Output


User: hi
Model: Hey there! Ready for some laughs? ๐Ÿ˜„

๐Ÿงพ JSON Mode (Very Important)

You can force the model to return structured output using JSON format:


/set format json

Example:


{
  "name": "Atul Kushwaha",
  "institution": "KIET College, Ghaziabad",
  "year": 1,
  "stream": "AIML"
}

This is very useful for APIs and automation.


๐Ÿ’พ Saving Your Own Model

You can customize a model and save it for future use.

Steps:


/set parameter temperature 0.5
/save MyModel

Now your model is saved and can be reused without reconfiguration.

๐Ÿ“Œ View Models


ollama ls

❗ Important Note

Saved models may include previous conversation history. This can affect future responses.

To avoid this, use:


/load MyModel

๐Ÿ—‘️ Deleting a Model


ollama rm MyModel:latest

This removes the model from your system.


⚠️ Limitations

  • ✔ Large models require high RAM
  • ✔ Initial download size can be large
  • ✔ Saved models may retain history

๐Ÿš€ Conclusion

Ollama is a powerful tool for running AI models locally. It gives you full control over how models behave and allows you to build AI-powered applications without relying on external APIs.

Post a Comment

Do Leave Your Comments...

Previous Post Next Post

Contact Form