AI Models and Foundation Models
Table of Contents + β
In the last lesson, you learned Introduction to AI. Now let us understand the word βmodelβ from zero, because AI people use this word all the time.
Here is how a model fits into AI:
π€ Why Do We Need Models?
Before AI, we usually wrote rules by hand.
- Button click: If the user clicks
Save, the app runs the save function. - Wrong password: If the password does not match, the app shows βWrong passwordβ.
- Price limit: If the price is above the allowed limit, the app rejects the order.
That works when the rules are clear. But language, images, speech, and messy real-world data do not fit neatly into simple rules.
An AI model helps here. It studies many examples first. Later, when it sees a new input, it compares the new input with what it learned from those examples.
For example:
- If the model sees many dog photos during training, it starts noticing shapes like ears, eyes, nose, and body structure.
- Later, when you upload a new photo, it checks whether the photo has similar things, like ears, face shape, fur, and body shape.
- If many things match dog photos it saw during training, it predicts that the photo may contain a dog.
At this point, do not think of a model as a robot or a person.
- A model is not a human brain: It does not understand life like a person. It compares the new input with examples it learned from before.
- A model is not the full app: The app still needs UI, backend, database, auth, and safety checks.
- A model is a trained software part: It has already studied examples before you use it.
- It takes input and gives output: You send text, image, audio, or other data, and it returns a prediction or generated result.
Trained part
Before your app uses it, the model has already studied many examples, like text, images, code, or audio.
Input to output
You send something in, like a question or image, and the model returns something out, like an answer or label.
Needs app logic
The model still needs UI, backend, rules, checks, and error handling around it.
π§ What Is an AI Model?
An AI model is a trained system that takes input and produces an output.
Training means the model has already studied many examples before you use it.
Input |AI model |OutputLet us understand that input-output idea properly:
- Text in, reply out: You type βexplain photosynthesisβ. The model receives that text, uses patterns it learned about plants and sunlight, and generates an explanation.
- Image in, label out: You upload a photo of a dog. The model studies shapes, colors, and patterns in the image, then predicts that the image contains a dog.
- Audio in, transcript out: You speak into an app. The model listens to the sound patterns, matches them with words, and writes the spoken sentence as text.
- Prompt in, image out: You write βa red car on a rainy roadβ. The model uses that text description to generate an image that matches the idea.
The model is not the full application. It is one important part inside the application.
For example, in a chatbot:
| Part | What happens |
|---|---|
| Text box | You type your question inside the text box. This is only the user input area. |
| Send button | The send button only sends your question to the app. |
| Website design | The website design only shows the chat screen nicely. |
| Backend | The backend sends your question to the model. The server prepares the request and calls the model safely. |
| Model | The model reads the question and generates the reply. |
| Screen again | Then the app shows that reply back on the screen. |
A model is like a function, but not exactly
This comparison helps, but use it carefully.
| Normal function | AI model |
|---|---|
| Follows exact code written by a developer. | Uses signals it learned during training. |
| Usually gives the same output for the same input. | Can give varied output depending on settings and model behavior. |
| Works best when the rule is clear, like checking an empty password. | Works best when the rule is hard to write by hand, like recognizing an image or generating text. |
So from application code, you can call a model like a service.
But you should not trust it like a simple pure function.
π Model Names You May Hear
GPT, Claude, Gemini
These are model families or model-backed products people often use through chat apps.
Llama, Gemma, Mistral, Qwen
These are examples of model families developers may run locally or through providers.
Ollama
Ollama is not a model. It is a local runner that can run models like Llama or Gemma.
π Training, Parameters, and Inference
Three words will come again and again.
- Training is when the model learns from examples.
- Parameters are internal numbers the model adjusts while learning.
- Inference means using the trained model to answer a new request.
If these words feel new, remember this simple version:
- Training is learning time: The model studies examples and adjusts itself.
- Inference is using time: A user sends new input and the trained model responds.
- Parameters are learned internal values: They are not normal user settings; they are inside the model.
Here is the flow in simple words:
Training data |Training process |Trained model |Inference for usersRead it like this:
- First, the model learns from many examples. That is training.
- After training, the model is ready to use: Developers can call it through an API or run it locally.
- Then a user sends a new question: This new input was not manually prepared during training.
- The trained model responds: It uses the signals learned during training to generate or predict output.
Training and using are different
Most developers do not train large AI models from zero. They usually use an already trained model through an API or run an available model locally.
π§ What Is a Foundation Model?
A foundation model is a large general-purpose model trained on broad data.
General-purpose means it can help with many kinds of tasks, not only one tiny task.
It is called βfoundationβ because many applications can be built on top of it.
- Writing assistant: The app gives writing instructions, and the foundation model drafts or rewrites text.
- Coding tool: The app sends code context, and the model explains or suggests code.
- Support bot: The app sends customer issue and policy context, and the model drafts a reply.
- Search app with RAG: The app retrieves documents first, then asks the model to answer from those documents.
So instead of training one model for every tiny task, developers often start with a foundation model and add prompts, data, tools, or fine-tuning.
π οΈ How Developers Use Foundation Models
Most developer work happens around the model, not inside model training.
- Prompting: You give clear instructions and examples.
- RAG: You retrieve documents and add them as context.
- Tool calling: You let the app call search, database, email, or other APIs.
- Fine-tuning: You train further only when the task needs a stronger behavior change.
- Evaluation: You test whether answers are good for your use case.
This is why foundation models are powerful. One base model can support many products when the surrounding application is designed well.
π§© Types of Generative AI Models
| Model type | Common output |
|---|---|
| Large language model | Text, summaries, answers, code |
| Image generation model | Images from text or image prompts |
| Speech model | Speech-to-text or text-to-speech |
| Video model | Short video clips or video edits |
| Multimodal model | Works with text, images, audio, or other inputs together |
π§© What Youβve Learned
- β A model is the trained AI part that takes input and returns output.
- β Training creates the model; inference means using it for a new request.
Check Your Knowledge
Test what you learned. Pick an answer for each question, then click Check.
- 1
What does inference mean?
Why: Inference is when a trained model processes new input and returns output.
- 2
What is a foundation model?
Why: Foundation models are broad models that can support many different tasks.
- 3
What are model parameters?
Why: During training, the model adjusts internal numbers called parameters.
- 4
Why should developers keep models replaceable?
Why: Model choices change, so isolating provider-specific code makes future changes easier.
π Whatβs Next?
When we ask a chatbot, βExplain this errorβ, it must understand our sentence and reply in sentences. That is why language models matter. Next, let us understand LLMs.