From AI to Generative AI
Objectives
- Classify examples as rule-based software, machine learning, or generative AI.
- Explain why using a pretrained model differs from training one from scratch.
1. Start with the mechanism, not the marketing
Imagine three versions of a message-handling application:
- Version A checks whether a message contains the word
refundand returns a fixed reply. - Version B uses a model trained on labeled messages to predict whether a new message concerns a refund, delivery, or something else.
- Version C asks a text-generation model to compose a reply suited to the message.
For this lesson, call these rule-based software, machine learning, and generative AI, respectively. The important difference is how the behavior is produced: explicit developer-written rules, patterns learned from data, or content generation using learned patterns. Machine learning learns from data; modern generative AI uses learned representations to produce content. [S1]
These are not three mutually exclusive boxes. Generative AI is also machine learning, and one application can combine all three mechanisms. When classifying an example, identify the component being described and use the most specific applicable label.
A product name or a chat interface is not enough evidence. A chat window might return a fixed template, retrieve a stored answer, or generate a new response. Ask: What does this component actually do, and where did its behavior come from?
Quick check: A support app always returns the same stored opening-hours sentence when you press a button. Is the sentence's natural language proof of generative AI?
Answer: No. In this example, the developer supplied the sentence. Displaying text is not the same as generating it with a learned model.
2. Map AI, machine learning, deep learning, and generation
Artificial intelligence (AI) is the broad field of building systems that perform capabilities associated with intelligence, such as recognizing patterns, interpreting language, or making decisions. Machine learning (ML) is an approach within AI in which training on data produces a model that can make predictions or decisions on new inputs. Rather than writing every decision rule, developers provide a learning procedure and data. [S1]
Deep learning is a family of machine-learning methods based on neural networks with multiple layers. For now, think of a neural network as a mathematical model with adjustable internal values. You do not need to understand its equations to build an application that uses an already-trained model. [S1]
Generative AI produces content, such as text, images, or audio, using patterns learned during training. The modern text-generation systems emphasized in this course use deep learning. A large language model (LLM) is a type of model commonly used for text generation. [S1]
Read the relationship diagram as “contains,” not “must execute next.” AI is the broadest area; ML is one approach within it; deep learning is one approach within ML; modern deep-learning-based generative AI sits within that branch. The diagram is a simplified map of this course's focus, not a claim that every historical generative technique uses deep learning. [S1]
Not all AI generates content. A model that predicts whether a transaction is suspicious is doing prediction or classification, not necessarily content generation. A deep neural network can classify an image without generating an image. [S1]
Also, ordinary programmed rules are not automatically AI. Some AI systems use explicit rules, but a simple delivery-fee calculation does not become AI just because it contains an if statement.
Quick check: A multilayer neural network assigns a photo to cat or dog. What labels apply?
Answer: AI, ML, and deep learning. As described, its task is classification, not generative AI.
3. Practice classifying concrete examples
Use these two questions:
- Is the behavior specified directly by rules, or learned through training?
- If a learned model is involved, is this component generating content or predicting a label, score, or value?
These questions apply the distinction between learned decisions and content generation. [S1] The following are invented teaching examples; classify the implementation stated, not a product you imagine behind it.
| Example implementation | Most specific label here | Reason |
|---|---|---|
| Charge a delivery fee of 5 when the order total is below 50 | Rule-based software | A developer directly set the condition and fee. |
| Fit a model on past orders to predict tomorrow's order count | Machine learning, predictive | Training data determines the model's prediction behavior. |
| Train on labeled messages to assign a spam score | Machine learning, predictive | The model learns a mapping from messages to scores. |
| Ask a pretrained language model to draft a polite apology | Generative AI | A learned model composes text in response to instructions. |
Fill Hello, {name} with a customer's name |
Rule-based software | A fixed template determines the sentence structure. |
| Ask a pretrained image model to create a picture from a description | Generative AI | A learned model generates image content. |
The small Python example accompanying this lesson shows the template case. Its output can vary with input, but variation alone is not learning. Every response path is visible in the code. There are no training examples and no learned model.
Try before reading the answer: An application first checks that a message is nonempty, then asks an LLM to draft a reply, then rejects replies longer than a specified limit. Classify all three steps.
Answer: The nonempty check is a rule. Drafting is generative AI. The length check is another rule. The overall application combines ordinary software and a learned generative model. Do not label every component generative just because the product uses an LLM.
4. Training from scratch versus using a pretrained model
A model is the learned mathematical component, not the entire application. Its internal adjustable values are called parameters. During training, a learning procedure adjusts these values using data. Training a large foundation model can require substantial data preparation, computing resources, and time. Those costs belong to creating the model, rather than merely requesting an answer from it. [S1]
Training from scratch starts without reusing an already-trained model's learned parameters. The team must choose a model and training setup, prepare data, run training, and evaluate the resulting model. The scale depends on the task: training a tiny prediction model is very different from training a large general-purpose language model. The expensive foundation-model training described above is not a requirement for every ML project. [S1]
A pretrained model has already undergone training. Application developers can reuse its learned capabilities rather than reproduce that initial training process. With a text-generation model, they supply a prompt: the input containing instructions, task material, and possibly examples. The model produces text in response. [S1][S26]
Using a trained model to produce an output is called inference. In this course's basic workflow, an inference request uses the existing parameters; writing a better prompt does not itself perform a training update. Examples inside a prompt guide that request rather than turning it into a training-from-scratch job. Further training of an existing model is a separate activity, often called fine-tuning. [S1][S26]
| Question | Train from scratch | Use a pretrained model |
|---|---|---|
| Where do learned capabilities come from? | The training process your team runs | A training process completed before your application uses the model |
| What is the central input at this stage? | Training data and a learning setup | A prompt for the current task |
| What is produced? | A trained model | An output from an existing model |
| What work still needs evaluation? | The trained model and its application | The pretrained model in your particular application |
Quick check: You provide two sample replies in a prompt and ask for a third in the same style. Have you trained a new model from scratch?
Answer: No. You supplied examples to an existing model at inference time. Prompt examples can influence the response without creating a new trained model. [S26]
5. What the application engineer still builds
Reusing a pretrained model changes the work; it does not eliminate engineering. For a small reply-drafting application, a useful starting workflow is:
- Accept a message and reject empty input with an ordinary rule.
- Build a prompt stating the task and including the message.
- Send the prompt to a pretrained text-generation model.
- Check the resulting draft against application requirements.
- Show a reviewable draft rather than automatically sending it.
Steps 1, 4, and 5 are suggested design choices for this teaching example. Step 3 uses the pretrained text-generation capability described in the model concepts documentation. [S26]
For example, an instruction might ask for a short, polite reply and forbid inventing a delivery date. That instruction communicates the desired behavior; it is not proof that the draft obeys it. Evaluation should separately examine correctness, relevance, and whether claims are supported. Model outputs can vary, so testing should not rely only on identical wording across runs. [S16]
Pretrained does not mean unlimited. A text-generation model has a bounded context capacity: the prompt and generated output must fit within the model's applicable limits. Text is processed in tokens, which are chunks of text rather than necessarily whole words. We will revisit these limits when building requests; for now, remember that you cannot keep adding material indefinitely. [S26]
Check the design: A draft says an order will arrive tomorrow, but the supplied message contains no delivery estimate. Should the app accept it just because it sounds fluent?
Answer: No. That claim is unsupported by the supplied information. The application needs a check or review process appropriate to its task; fluency alone is not correctness. [S16]
6. End-of-lesson self-check
Spend a few minutes answering without looking above. Use the most specific label, then explain your evidence.
- A developer writes
if temperature > 30, then displays a heat warning. No learned model is involved. - A model trained on historical readings predicts tomorrow's temperature.
- A pretrained text-generation model writes a weather explanation from a supplied forecast.
- A developer changes that model's prompt from “be helpful” to a detailed instruction with an example. Is this training from scratch?
- You want to build a first reply-drafting app. What does starting with a pretrained model let you skip, and what must you still do?
Suggested answers
- Rule-based software. The developer explicitly supplied the decision boundary.
- Machine learning, predictive. The implementation learns from historical examples and predicts a value; the scenario does not establish deep learning or generation.
- Generative AI. The model composes text from the supplied input. It is also ML; the narrower label describes the capability being used. [S1][S26]
- No. This changes the input instructions for inference. It does not run a training-from-scratch process. [S26]
- You skip creating the model's learned capabilities through initial training. You still define the task, prepare inputs, integrate the model, and evaluate the application. Reusing a model avoids the initial model-training work, not the need to assess outputs. [S1][S16]
Exit explanation: In your own words, complete this sentence: “My application uses an already-trained model to ___; my ordinary code still ___.”
One possible answer is: “My application uses an already-trained model to draft a reply; my ordinary code still checks inputs and presents the draft for review.” If you can identify both roles, you have the foundation needed to define a small, useful AI application next.
def reply(message):
if "refund" in message.lower():
return "Please share your order number."
return "Please describe what you need help with."
print(reply("Can I request a refund?"))
print(reply("When are you open?"))
Key takeaways
- Classify the mechanism, not the interface: explicit rules, learned predictions, or learned content generation.
- Generative AI is also machine learning; use the most specific label supported by the example. [S1]
- Deep learning uses multilayer neural networks and can support classification as well as generation. [S1]
- Training changes a model's learned parameters; inference uses an already-trained model to produce outputs. [S1][S26]
- Prompt instructions and examples guide an inference request; they are not training from scratch. [S26]
- A pretrained model avoids initial model-training work, but its application still needs output evaluation. [S1][S16]
Common mistakes
- Calling every program that returns text generative AI.: Check how the text is produced. A fixed template or a developer-written branch is rule-based in these examples.
- Treating machine learning and generative AI as unrelated categories.: Use the relationship map: modern generative AI uses learned models, so the broader ML label also applies. [S1]
- Assuming any neural network must generate content.: Separate model method from task: a deep-learning model can classify an image without generating one. [S1]
- Calling a prompt change training from scratch.: Distinguish changing the input during inference from adjusting learned parameters through training. [S1][S26]
- Assuming a pretrained model removes the need to test the application.: Evaluate representative outputs for correctness, relevance, and support; fluent text can still fail the task. [S16]
References
- What is artificial intelligence (AI)?, IBM
- Key concepts, OpenAI
- Large language model end-to-end evaluation, Microsoft
See the full course: AI Engineering from Scratch: Build Your First AI Application