Arun Pandian M

Arun Pandian M

Android Dev | Full-Stack & AI Learner

Written by: Arun Pandian MPublished 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%2F20260906%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20260906T090007Z&X-Goog-Expires=3600&X-Goog-SignedHeaders=host&X-Goog-Signature=0c2874242eec7847ff23161ac2b0ac51bc7c0e2d7f8bf132b316350e557b3642fe2176ecc54dc696d4c07a669e07427cdbf621bc26f9022189ea99d7e6ea8d2c877c949b46c7af20c730cbfc4827120f8ae35a078167d6f135e633656b55794fe5246620f586b565b5a85dcbd762ef331e97499167d02072b1eebc2aedfbbacf0dd09c4381e54e62fb46a0edfc2c8c12182e278696f1e823b8903d8ceb4010e5e7cc5dba25857fce6a01fe64319228fe652c0cd540ee5e3edd2bb8a3894c1f026a266487e9c1012432dba46271fc252f36f6dca0ac4e5be5e0ce695a90c15fd4a6cd95e8fa0beb8b2a814934799e7f550500739c7ad77e1fd59b697a5590030b

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