Arun Pandian M

Arun Pandian M

Android Dev | Full-Stack & AI Learner

Written by: Arun Pandian M•Published on: Jun 5, 2026

Understanding LLMs, Ollama, and Inference

Before building AI applications, we need to understand three fundamental concepts:

LLM
↓
Ollama
↓
Inference
https://storage.googleapis.com/lambdabricks-cd393.firebasestorage.app/img_understand_olm_inference.svg?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=firebase-adminsdk-fbsvc%40lambdabricks-cd393.iam.gserviceaccount.com%2F20261206%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20261206T042929Z&X-Goog-Expires=3600&X-Goog-SignedHeaders=host&X-Goog-Signature=22e416461afaeba440f49d1311e9fee057a7c9d9b1fdc2d9efc886e573f5c740bff440459795e6a6c5dda92002ca11b29e949b61540179d1efa1848423730f893eba8cb3cef07db5342a999432531a0047435534eec833e2a8083154c9491913002de4a6a2028df35b1ddf0698ffe5e6277e6ea6c48e12173b40afc08ecd980a89ce0eb5c9244fa5c6f045cc4d5d53eebaa59ca93a3ba49f33df2ba2a7adeaea4b69dbb76b21b21d90efd42465276c40e1e51d35525057303c7809942d56ef9a07f0b36d06186ac5fa38f433d81ec71fe3fde96bb3054e8bff1ec60dd564824d38e0da64f62e8bfb0bfae05e0c3572afcbe799b379ba4775ec328131815d12d7

What is an LLM?

LLM stands for Large Language Model.

Examples:

  • Llama
  • Phi
  • Mistral
  • A language model predicts the next piece of text.

    Example:

    Input:

    The capital of France is

    Prediction:

    Paris

    Every response from an LLM is generated one token at a time.

    Training vs Inference

    Two terms you’ll hear frequently:

    Training

    The model learns patterns.

    Books
    Code
    Articles
    ↓
    Training
    ↓
    Model

    Inference

    The model answers questions.

    Question
    ↓
    Model
    ↓
    Answer

    As AI application engineers, we mostly perform inference.

    What is Ollama?

    Think of Ollama as a runtime.

    Java
    ↓
    JVM
    
    Python
    ↓
    Interpreter
    
    LLM
    ↓
    Ollama
    Java
    ↓
    JVM
    
    Python
    ↓
    Interpreter
    
    LLM
    ↓
    Ollama

    Ollama loads and runs models on your machine.

    Example:

    ollama run phi3:mini

    Calling a Model

    Once Ollama is running:

    import ollama
    
    response = ollama.chat(
        model="phi3:mini",
        messages=[
            {
                "role": "user",
                "content": "What is Kotlin?"
            }
        ]
    )
    
    print(response["message"]["content"])

    Flow:

    Python
    ↓
    Ollama
    ↓
    Model
    ↓
    Response

    Experiment

    Try:

    What is Android?

    Then:

    Explain Android to a beginner.

    Notice how the model changes its answer based on the input.

    #MachineLearning#SoftwareEngineering#BuildInPublic#LearningInPublic#LocalLLM#TechEducation#AIJourney#ArtificialIntelligence#AIEngineering#AIAgents#LLM#GenerativeAI#LargeLanguageModels#Ollama#Inference#OpenSourceAI#Python#PromptEngineering#AIApplications#DeveloperTools
    LAMBDA BRICKS