AI & GENERATIVE AI / SYSTEM CONCEPT BRIEF

AI vs Machine Learning vs Deep Learning vs Generative AI

These four terms are nested circles, not competitors.

BeginnerPhase 09 / Topic 1 of 30RequirementsTrade-offsFailure modes
01

Overview

These four terms are nested circles, not competitors. Artificial intelligence is the broad goal of making software act intelligently. Machine learning is the subset of AI where behavior is learned from data instead of hand-written rules. Deep learning is the subset of ML that uses many-layered neural networks. Generative AI is the subset of deep learning whose models produce new content (text, images, audio, code) instead of only labeling or scoring existing data.

For system design the distinction matters because each circle brings different engineering needs. A rules engine needs no training data. A classic ML model (gradient-boosted trees on tabular data) trains in minutes on a CPU. A deep model needs GPUs and large labeled datasets. A generative model is usually consumed as a hosted API or served on GPU clusters, is billed per token, and produces non-deterministic output that must be evaluated and guarded.

Transportation, cars, electric cars, self-driving cars

Transportation is the whole field (AI). Cars are one way to do it (machine learning). Electric cars are a particular kind of car with a different engine (deep learning). Self-driving electric cars are a newer kind that does something earlier cars could not (generative AI). Every self-driving electric car is a car, but not every car drives itself.

02

When to use it

  • Explaining which technique a product feature really needs before choosing infrastructure.
  • Deciding between a simple rules engine, a classic ML model, or an LLM.
  • Setting expectations with stakeholders about data, cost, and accuracy.
03

Where it shows up in interviews

Pick the simplest tool that works

Recognize it when: the interviewer asks how you would add "AI" to a feature.

  • Design a fraud detection system
  • Design an AI customer-support system
Generative vs discriminative

Recognize it when: does the feature create content or make a decision?

  • Design an AI recommendation system
  • Design an AI content-generation platform
04

Where it is used in real software

Spam filters

Long-running example of classic machine learning that classifies email using learned features rather than fixed rules.

Photo search

Deep learning image models recognize faces, pets, and places so a phone can search photos by content.

Writing and coding assistants

Generative models draft emails, summarize documents, and suggest code completions.

05

Key terms

Artificial intelligence
Any technique that lets a machine perform tasks we associate with human intelligence, including hand-written rules and search.
Machine learning
Algorithms that learn patterns from examples and improve with more data.
Deep learning
Machine learning with multi-layer neural networks that learn their own features from raw data.
Generative AI
Deep learning models that produce new content by modeling the distribution of their training data.
Discriminative model
A model that predicts a label or score for an input, such as spam or not spam.
06

How it works, step by step

  1. 1
    Start with rules

    If the logic is known and stable (tax brackets, discount eligibility), plain code is cheaper, faster, and explainable.

  2. 2
    Move to classic ML when patterns are fuzzy

    When rules become too many to maintain, train a model such as logistic regression or gradient-boosted trees on labeled data.

  3. 3
    Use deep learning for unstructured data

    Images, audio, and free text benefit from neural networks that learn features automatically.

  4. 4
    Use generative AI when output is open-ended

    Summaries, answers, drafts, and conversation need a model that produces content, usually an LLM accessed through an API.

  5. 5
    Combine them

    Real systems mix all four, for example rules for hard limits, a classifier for routing, and an LLM for the reply.

Nested circles
Step 1 / 4
AI
Machine learning
Deep learning
Generative AI

STEP 1AI is the widest circle. It includes rules engines, search algorithms, and every learning method.

07

Matching a feature to the right circle

An online store wants to add intelligence to five features.

Step 1 / 5
FeatureBest fitWhy
Free shipping over a thresholdRulesLogic is fixed and must be exact
Fraud score on checkoutClassic MLTabular signals with labeled history
Find similar product photosDeep learningUnstructured image data
Write product descriptionsGenerative AIOpen-ended text output
Support chatbotGenerative AI plus rulesLLM answers with policy guardrails

NOWFeature: Free shipping over a threshold | Best fit: Rules | Why: Logic is fixed and must be exact

Only two of five features need generative AI. Picking the smallest circle keeps cost and risk down.

08

Implementation

# Same task, three approaches: flag a risky order. # 1. Rules (AI without learning)def is_risky_rules(order):    return order["amount"] > 1000 and order["account_age_days"] < 7 # 2. Classic machine learningfrom sklearn.ensemble import GradientBoostingClassifiermodel = GradientBoostingClassifier().fit(X_train, y_train)   # learned from labeled ordersrisk = model.predict_proba([features(order)])[0][1] # 3. Generative AI (explains the decision in plain language)from openai import OpenAIclient = OpenAI()reply = client.chat.completions.create(    model="gpt-4o-mini",    messages=[{"role": "user", "content": f"Explain why this order may be risky: {order}"}],)print(reply.choices[0].message.content)
09

Complexity and performance

Rulesno training cost

Microsecond latency on a CPU.

Classic MLminutes to train

Millisecond inference on a CPU.

Deep learninghours to days on GPUs

Needs large labeled datasets.

Generative AIpay per token

Hundreds of milliseconds to seconds per response.

10

Trade-offs

Explainability vs flexibility

Rules are fully explainable but brittle. Larger models handle messy inputs but are harder to explain and audit.

Cost vs capability

Each inner circle is usually more capable and more expensive to train, serve, and evaluate.

11

Variants and related techniques

Reinforcement learning

A branch of ML where an agent learns by trial and reward. It is also used to align LLMs with human preferences.

Traditional NLP

Before LLMs, text tasks used smaller task-specific models such as named-entity recognizers and sentiment classifiers.

12

Common mistakes

  • Using an LLM for a problem with exact rules.

    Fix: Keep deterministic logic in code and use the model only where judgment or language is needed.

  • Treating the terms as separate technologies.

    Fix: Remember they are nested. Generative AI is deep learning, which is machine learning, which is AI.

13

Interview questions

What is the difference between machine learning and deep learning?

Machine learning is any algorithm that learns from data. Deep learning is the subset that uses multi-layer neural networks, which learn features automatically and excel at images, audio, and text but need more data and compute.

When would you not use generative AI?

When the logic is exact and must be auditable, when latency or cost budgets are tight, or when a smaller classifier already meets the accuracy target. Generative models add non-determinism, token cost, and safety work.

14

Practice problems

ProblemDifficultyWhat it trains
Classify ten product features into rules, ML, deep learning, or generative AIEasyChoosing the smallest effective approach.
Design a support system that combines rules, a classifier, and an LLMMediumRouting and guardrails.