This is not an AI research course. It is a course to make you understand building AI-powered applications especially in your application like Ruby On Rails. You can use any interface or frameworks, but the idea is the same.
Day 1 – AI Fundamentals & LLMs (The Big Picture)
Goal
By the end of today, you should be able to confidently answer:
- What is AI?
- What is Machine Learning?
- What is Deep Learning?
- What is Generative AI?
- What is an LLM?
- How does ChatGPT actually work (at a high level)?
- What is a Token?
- What is a Context Window?
- What is Temperature?
- Why are there different models?
- Where does Ruby on Rails fit into the AI ecosystem?
What you must learn?
A senior developer isn’t expected to explain transformer mathematics or derive attention equations.
Instead, they expect something like this:
“We integrated GPT-5 into our Rails application using the OpenAI API. We stored conversation history in PostgreSQL, streamed responses to the browser using Turbo Streams, and later improved answer quality by introducing a RAG pipeline backed by pgvector.”
That level of understanding is the target.
The Big Picture
Let’s zoom out.
Artificial Intelligence │ ▼Machine Learning │ ▼Deep Learning │ ▼Generative AI │ ▼Large Language Models │ ▼ChatGPT / Claude / Gemini
often ask about this hierarchy.
Step 1 – What is Artificial Intelligence?
Artificial Intelligence (AI) is the broad field of creating software that performs tasks normally associated with human intelligence.
Examples:
- Recognising images
- Translating languages
- Understanding speech
- Writing code
- Answering questions
- Driving cars
Notice that AI is an umbrella term.
Rails Analogy
Think of AI like Web Development.
Inside Web Development there are many areas:
- Frontend
- Backend
- DevOps
- Security
- Performance
Similarly,
AI contains
- Machine Learning
- Robotics
- Computer Vision
- NLP
- Reinforcement Learning
- Generative AI
AI is not one single technology.
Step 2 – What is Machine Learning?
Traditional software follows explicit rules.
Example:
if age >= 18
"Adult"
else
"Minor"
end
The programmer writes every rule.
Machine Learning is different.
Instead of writing rules,
we provide:
Data↓Algorithm↓Model↓Prediction
The model learns patterns from data.
Example:
100,000 spam emails↓Machine Learning↓Spam detector
Nobody writes:
if subject contains "FREE MONEY"
The model discovers useful patterns itself.
Question Answer
Machine Learning is a subset of AI where models learn patterns from data instead of relying solely on hand-written rules.
Step 3 – What is Deep Learning?
Deep Learning is a subset of Machine Learning.
Instead of simpler algorithms like decision trees or linear regression, it uses neural networks with many layers.
AI↓Machine Learning↓Deep Learning↓LLMs
Question Answer
Deep Learning uses multi-layer neural networks to learn complex patterns from large datasets.
You don’t need to know the maths unless you’re interviewing for an ML engineering role.
Step 4 – What is Generative AI?
Most older AI systems classify or predict.
Examples:
Cat or Dog?Spam or Not?Fraud or Safe?
Generative AI creates new content.
Examples:
TextImagesMusicVideoCode
ChatGPT generates text.
GitHub Copilot generates code.
Midjourney generates images.
Step 5 – What is an LLM?
This is the most common interview question.
LLM stands for Large Language Model.
Break it down:
Large
Trained on enormous datasets.
Language
Designed to understand and generate human language (and code).
Model
A trained neural network that predicts the next token.
The Most Important Sentence
An LLM predicts the most likely next token given the previous context.
That’s fundamentally what it does.
Everything else — chatting, coding, summarising, translation — is built on top of that capability.
Rails Analogy
Think of ActiveRecord.
You write:
User.where(active: true)
Rails converts that into SQL.
Similarly, when you type:
Write a Rails controller.
The LLM converts your prompt into a sequence of likely output tokens.
How ChatGPT Works (Simplified)
You type↓Prompt↓Tokenizer↓Tokens↓LLM↓Next Token Prediction↓Next Token↓Next Token↓Next Token↓Final Response
Notice that the model does not generate an entire paragraph at once. It generates one token after another.
What is a Token?
This is one of the most frequently asked concepts.
A token is a chunk of text that the model processes.
It is not always a word.
Example:
Hello world
may be split into tokens similar to:
Helloworld
But longer or uncommon words can be split into multiple tokens.
For example:
internationalization
might become several tokens.
Models operate on tokens, not characters or words.
Why Tokens Matter
Every API request is billed based on tokens.
Input Tokens+Output Tokens=Cost
Tokens also affect:
- latency
- context limits
- pricing
What is a Context Window?
The context window is the maximum amount of information (measured in tokens) the model can consider in one request.
It includes:
- your system prompt,
- conversation history,
- retrieved documents (for RAG),
- and the model’s response.
If you exceed the context window, older information may need to be removed or summarised before sending the request.
Rails Analogy
Imagine your Rails app sends this:
System PromptConversationPDFUser Message
Everything together must fit inside the model’s context window.
What is Temperature?
Temperature controls how deterministic or creative the model’s output is.
Low temperature (e.g. 0.0–0.2):
- More consistent
- Better for code
- Better for SQL
- Better for structured JSON
Higher temperature (e.g. 0.8–1.0):
- More varied
- Better for brainstorming
- Better for creative writing
A useful interview answer:
Temperature influences randomness in token selection. Lower values produce more predictable outputs, while higher values encourage greater variation.
Why Are There Different Models?
A common misconception is that there’s one “best” model.
In reality, different models optimise different trade-offs:
| Model Characteristic | Better For |
|---|---|
| Small model | Lower cost, lower latency |
| Large model | More reasoning ability, richer responses |
| Vision model | Image understanding |
| Audio model | Speech recognition and synthesis |
| Embedding model | Semantic search and RAG |
| Code-oriented model | Programming assistance |
As a senior engineer, you’ll often choose the model that best fits the use case rather than always selecting the most capable one.
Where Ruby on Rails Fits
A common question is:
“Does Rails perform the AI?”
No.
Rails orchestrates the AI workflow.
Browser↓Rails↓OpenAI / Anthropic / Gemini API↓LLM↓Rails↓Browser
Rails is responsible for:
- authentication,
- storing conversations,
- business logic,
- background jobs,
- rate limiting,
- streaming,
- persistence,
- caching,
- monitoring,
- and integrating AI into the product.
The LLM performs the language generation.
Common Questions – Day 1
Try answering these aloud without looking back.
- What is Artificial Intelligence?
- How is Machine Learning different from traditional programming?
- What is Deep Learning?
- What is Generative AI?
- What is an LLM?
- Why is it called a Large Language Model?
- How does an LLM generate text?
- What is a token?
- Why do tokens matter?
- What is a context window?
- What is temperature?
- Does Ruby on Rails perform AI?
- Why are there different AI models?
If you can answer these clearly in your own words, you’ve built a strong foundation.
Practical Exercise 1 (30 minutes)
Use ChatGPT or Claude and experiment with temperature-like behaviour conceptually by changing the prompt.
Try:
Write a professional Ruby methodthat calculates tax.
Then ask:
Write the same codebut optimise it for readability.
Then:
Write the same solutionusing functional Ruby.
Observe how prompt specificity changes the output. This will prepare you for Day 2, where we’ll focus on prompt engineering.
Practical Exercise 2 (Optional Rails)
Create a new Rails app (or use a scratch project) and sketch a minimal architecture for an AI feature.
For example:
app/ controllers/ chats_controller.rb models/ conversation.rb message.rb services/ ai/ client.rb jobs/ ai_response_job.rb
You don’t need to call an AI API yet. Just think about where the responsibilities belong. We’ll implement this later in the bootcamp.
Homework
- Draw the AI hierarchy from memory:
AI↓Machine Learning↓Deep Learning↓Generative AI↓LLMs
- Explain, in your own words, how an LLM generates text.
- Explain why tokens matter to both cost and context.
- Explain why a Rails application still needs authentication, databases, background jobs, and business logic even when it uses an LLM.
- Practice answering the 13 interview questions above without notes.
What’s Coming on Day 2
Day 2 will move from “What is an LLM?” to “How do we make LLMs useful?”
We’ll cover:
- Prompt Engineering fundamentals
- System vs User vs Assistant prompts
- Zero-shot and Few-shot prompting
- Structured outputs (JSON)
- Function/Tool Calling
- Prompt injection
- Hallucinations and mitigation strategies
- API request/response flow
- Practical Ruby examples using an LLM API
By the end of Day 2, you’ll understand how to communicate effectively with LLMs – one of the most valuable practical skills for a senior Rails developer building AI-powered applications.
Happy Learning!