The Basics of AI

What it is and how it works?

Dr. Arun Mitra
Assistant Professor, Dept of Community & Family Medicine
All India Institute of Medical Sciences, Bibinagar - Hyderabad

What we will cover


  • What is “AI”, and what it is not
  • How LLMs actually work
  • Limits of AI

What is AI?

And, just as important, what it is not.

Terminilogy

  • Artificial Intelligence (AI): machines doing tasks that need “intelligence”
  • Machine Learning (ML): systems that learn patterns from data, not rules
  • Deep Learning: ML using large neural networks
  • Generative AI / LLMs: networks that produce text, images, code


AI ⊃ Machine Learning ⊃ Deep Learning ⊃ Generative AI ⊃ Large Language Models

When people say “AI” in 2026 they usually mean the inner-most circles: GenAI / LLMs

What AI is good at


  • Language at scale: summarise, rephrase, translate, draft
  • Structure from mess: pull fields out of free text
  • Code: write, explain, and debug analysis scripts
  • A tireless first draft: never the final word

What AI is not


  • Not a database. It generates plausible text; it can invent facts and citations
  • Not a search engine. Its knowledge has a training cut-off
  • Not “understanding”. It models patterns in language, not meaning or truth
  • Not reproducible by default. Ask twice, get two answers
  • Not a clinician or a method. It has no accountability; you do
  • Not private. Cloud tools may store and reuse what you type

A confident answer is not a correct answer.

How LLMs work

It is a prediction machine


An LLM predicts the next piece of text, over and over.


  • Given everything so far, it picks the most likely next token
  • A token is a chunk of text: roughly ¾ of a word
  • “Healthca” … most likely next token: “re”
  • Everything else is this idea, scaled up enormously


Google Search, Autocomplete

Lets visualize it! : tokenization


The model never sees words. It first breaks text into tokens.

Lets visualize it! : next-token prediction


The model guesses the next word. Keep clicking to watch it write.

How it is built


  • Pre-training: read a huge slice of the internet; learn to predict text
  • Fine-tuning: practise on curated examples of good answers
  • Alignment (RLHF): humans rate answers; the model learns what we prefer
  • Result: a model that is helpful, honest, harmless … usually


The training is frozen. The model does not learn from your chat.

Two dials worth knowing


Context window

How much text it can “hold” at once: prompt + documents + reply.


Modern models: up to ~1 million tokens (a small book).

Temperature

How random the next-token choice is.

  • Low: focused, repeatable (use for analysis)
  • High: varied, creative (use for brainstorming)

“Attention Is All You Need”


  • The transformer was introduced by Vaswani et al. in 2017
  • Before it: models read text one word at a time (slow, forgetful)
  • The transformer reads the whole sequence at once
  • That made training parallel, so models could grow huge

The key idea: attention


Each word looks at every other word and decides which ones matter.


“The patient reached the clinic because he was sick.”


To resolve “he”, the model attends back to “patient”, not “clinic”.


Self-attention does this for every word, in parallel, across the text.

Lets visualize it! : self-attention


How LLMs works?

How LLMs are built?

Limits of AI

The failure modes


  • Hallucination: fluent, confident, and wrong
    (fake references, fake stats)
  • Stale knowledge: unaware of anything after its cut-off
  • Weak at exact work: arithmetic, counting, precise tables
  • Bias: it reflects the data it was trained on
  • Sycophancy: it tends to agree with how you ask
  • Opacity: it cannot reliably explain why it answered

Major LLM providers

Provider Model family Access
Anthropic Claude API, chat, in tools
OpenAI GPT API, chat (ChatGPT)
Google Gemini API, chat, Workspace
Meta Llama Open weights (self-host)
Mistral Mistral API + open weights
DeepSeek DeepSeek API + open weights


Rankings change every few months. Pick by fit, not by hype.

Two kinds of model


Proprietary (closed)

Run on the provider’s servers, reached by API or chat.

Most capable; data leaves your machine.

Open-weight

You download and run it yourself.

More private and controllable; needs hardware and setup.


For sensitive health data, an open-weight model run locally keeps data in-house.

Three ways to use them


  • Chat interface: quick questions, drafting, learning
  • API: plug a model into your own R or Python pipeline
  • Local: run an open-weight model on your own machine, fully offline

Considerations when chosing a model


  • Capability: does the task need deep reasoning, or is it simple?
  • Cost: stronger models cost more per use
  • Speed: small models reply faster
  • Context window: how much text must it read at once?
  • Privacy: can the data leave your machine at all?
  • Modality: text only, or also images, tables, audio?

Tiers, with one provider as an example


Tier Use it for Claude example
Frontier Hard reasoning, long agentic work Claude Opus
Balanced Most everyday tasks Claude Sonnet
Fast / small Simple, high-volume, cheap Claude Haiku


Every major provider offers a similar flagship / balanced / small ladder.

A simple decision guide


  • Simple, repetitive task? Use a small, fast, cheap model
  • Hard reasoning or long document? Use a frontier model
  • Sensitive patient data? Use an open-weight model locally
  • Not sure? Start with the newest balanced model, then adjust


Default to the latest capable model; the field moves fast.

Cost and reproducibility


  • Cost is per token: input + output both count
  • Long documents and long answers add up quickly
  • For analysis, set a low temperature and record the model + prompt
  • Treat the prompt as part of your methods

Take-home Message


  • AI today means generative LLMs: powerful, but not magic
  • They predict text; they do not know, search, or understand
  • The transformer + scale is why they suddenly work so well
  • Choose a model by task, cost, and privacy, not by hype
  • Verify everything, protect patient data, stay in the loop

VERIFY EVERYTHING!!!!!!

Questions?

Thank You!