What You Will Learn

By the end of this lesson, you should be able to:

  • Clearly define and distinguish Artificial Intelligence (AI), Machine Learning (ML), and Deep Learning (DL).
  • Visualize and explain the nested relationship (the Russian matryoshka doll model) connecting these three disciplines.
  • Understand how traditional rule-based software differs fundamentally from machine learning systems.
  • Explain the key branches of machine learning: supervised, unsupervised, and reinforcement learning.
  • Understand what makes deep learning "deep" and how multi-layer neural networks learn hierarchical representations.
  • Explain why deep learning superseded earlier classical ML techniques for computer vision, audio, and natural language processing.
  • Understand where Large Language Models (LLMs) and Generative AI sit within this technological hierarchy.
  • Identify common industry misconceptions and marketing buzzwords regarding AI and machine learning.
  • Understand the hardware implications of this hierarchy—why classical ML runs fine on basic CPUs, while deep learning and local LLMs demand massive memory bandwidth, RAM, and GPUs.
  • Relate this hierarchy directly to Loco and running AI models locally on your personal computer.

2.1 The Confusion Around AI Terminology

Open any technology news site, product brochure, or social media feed today, and you will see the words AI, Machine Learning, and Deep Learning used almost interchangeably.

A company might advertise an "AI-powered toothbrush."
A bank might talk about using "Machine Learning to detect fraud."
A research lab might publish a paper on a "Deep Learning model for protein folding."
And a colleague might announce they just built a customer support assistant with "Generative AI."

To someone new to the field, this vocabulary feels like an intimidating sea of jargon designed to impress investors rather than inform learners.

The good news is that these terms are not arbitrary buzzwords, nor are they competing technologies. They describe a clear, logical hierarchy of concepts developed over seventy years of computer science.

Understanding this hierarchy is essential for anyone interested in local AI. When you understand the difference between broad artificial intelligence, machine learning, and deep learning, you immediately understand:

  • Why some models require a 24GB graphics card while others run in milliseconds on an ordinary laptop processor.
  • Why modern language models are capable of surprising conversational nuance, yet still struggle with basic arithmetic.
  • What software like Loco is actually doing when it loads a model into memory.

Let's unpack the relationship from the ground up.


2.2 The Nested Hierarchy: Russian Dolls of Computing

The most accurate mental model for AI, machine learning, and deep learning is a set of nested Russian matryoshka dolls or concentric circles:

+-------------------------------------------------------------+

| ARTIFICIAL INTELLIGENCE (Broadest Field - Since 1950s)      |

|  Any technique enabling computers to mimic human behavior  |

|                                                             |

|  +-------------------------------------------------------+  |

|  | MACHINE LEARNING (Subset - Since 1980s)               |  |

|  |  Systems that learn patterns directly from data       |  |

|  |                                                       |  |

|  |  +-------------------------------------------------+  |  |

|  |  | DEEP LEARNING (Subset of ML - Since 2010s)      |  |  |

|  |  |  Multi-layer neural networks learning complex   |  |  |

|  |  |  hierarchical representations                   |  |  |

|  |  |                                                 |  |  |

|  |  |  +-------------------------------------------+  |  |  |

|  |  |  | TRANSFORMERS & LLMs (Modern GenAI)        |  |  |  |

|  |  |  |  Large language models, diffusion models, |  |  |  |

|  |  |  |  multimodal architectures                 |  |  |  |

|  |  |  +-------------------------------------------+  |  |  |

|  |  +-------------------------------------------------+  |  |

|  +-------------------------------------------------------+  |

+-------------------------------------------------------------+

Every Deep Learning system is a Machine Learning system.
Every Machine Learning system is an Artificial Intelligence system.
However, the reverse is not true: not all AI is machine learning, and not all machine learning is deep learning.

Let's examine each layer of this hierarchy in detail.


2.3 Artificial Intelligence: The Broad Umbrella

As established in Lesson 1, Artificial Intelligence is the broadest overarching category. It was formally established as an academic discipline in 1956 at the Dartmouth Summer Research Project on Artificial Intelligence.

In its broadest sense, AI refers to any computer system, algorithm, or engineered mechanism designed to perform tasks that typically require human intelligence. These tasks include:

  • Solving logic puzzles and playing strategic games (chess, checkers, Go).
  • Understanding or generating natural language.
  • Recognizing faces, objects, and speech.
  • Navigating physical environments (robotics, autonomous vehicles).
  • Making diagnostic recommendations or decisions under uncertainty.

For the first thirty to forty years of AI history, the dominant paradigm was not machine learning at all. It was what computer scientists now call Symbolic AI or GOFAI ("Good Old-Fashioned AI").

Symbolic AI and Expert Systems

In symbolic AI, human experts and computer scientists manually translated knowledge into explicit logical rules, decision trees, and mathematical formulas:

IF patient_has_fever == TRUE

AND patient_has_rash == TRUE

AND patient_is_child == TRUE

THEN consider_measles(probability = 0.85)

During the 1970s and 1980s, large corporate systems called Expert Systems (such as MYCIN for bacterial infections or XCON for computer hardware configuration) stored tens of thousands of handwritten rules created by interviewing human domain specialists.

Another classic example of non-machine-learning AI is the chess engine Deep Blue, which defeated World Chess Champion Garry Kasparov in 1997. Deep Blue did not "learn" how to play chess from watching grandmaster games. Instead, it was an engineering marvel combining: - Handcrafted chess evaluation functions written by grandmasters. - High-speed custom hardware capable of searching up to 200 million chess board positions per second using heuristic tree-search algorithms (like Alpha-Beta pruning).

Deep Blue was indisputably artificial intelligence: it achieved superhuman performance at a complex cognitive task. But it was not machine learning. If Deep Blue made a tactical mistake, it could not learn from that mistake on the next turn; a human engineer had to manually rewrite its evaluation equations.

The Limits of Hand-Coded Rules

Symbolic AI worked brilliantly in closed, deterministic worlds governed by clear mathematical rules (like chess or tax calculations).

However, it failed catastrophically when applied to messy, ambiguous, real-world problems: - How do you write explicit rules describing every variation of a handwritten letter "A"? - How do you write rules that recognize a cat in any lighting, angle, posture, or breed? - How do you write rules describing the meaning of a sarcastic English sentence?

Humans can recognize a face or understand a sentence effortlessly, but we cannot write down the explicit mathematical rules we use to do so. To solve these problems, computer science had to shift from writing rules to learning from data.


2.4 Machine Learning: Learning from Data

Machine Learning (ML) is a subset of artificial intelligence where algorithms are designed to automatically learn patterns, associations, and decision rules directly from data, rather than having every rule explicitly programmed by a human.

Arthur Samuel, a pioneer in computer gaming and artificial intelligence, defined machine learning in 1959 as:

"The field of study that gives computers the ability to learn without being explicitly programmed."

The Paradigm Shift: Traditional Programming vs Machine Learning

The best way to understand machine learning is to contrast it directly with traditional software engineering:

Traditional Programming: [ Rules / Code ] + [ Data / Input ] ===> [ Answers / Output ]

Machine Learning: [ Data / Input ] + [ Answers / Examples ] ===> [ Rules / Model ]

  • In traditional programming, a human developer writes the algorithm (the logic and rules), feeds in data, and the computer computes the output.
  • In machine learning, the developer feeds in vast examples of data paired with the desired outcomes, and the machine learning algorithm calculates the mathematical function (the model) that connects the two.

Once that mathematical model is trained, it can be saved and deployed to predict answers for brand-new data it has never seen before.

A Concrete Example: Spam Detection

Consider building an email spam filter:

  1. The Traditional Programming Approach:
    You sit down and write a Python script with regular expressions:
  2. If the subject contains "WINNER" or "FREE ROLEX", mark as spam.
  3. If the message has more than 5 uppercase exclamation marks, mark as spam.
  4. If the sender IP is in a blacklist, mark as spam.
    Problem: Spammers immediately adapt by spelling words as "W!NNER" or inserting invisible unicode characters. You are trapped in an endless game of cat-and-mouse updating thousands of brittle rules.

  5. The Machine Learning Approach:
    Instead of writing rules, you gather 50,000 legitimate emails and 50,000 spam emails. You extract measurable features (word frequencies, capital letter ratios, sender domain characteristics). You feed these examples into an ML algorithm (such as Naive Bayes, Logistic Regression, or a Random Forest).
    The algorithm discovers statistical correlations: it finds that the simultaneous presence of certain phrasing, formatting patterns, and header structures correlates 99.4% with spam. When a new email arrives, the model calculates its probability of being spam.

The Three Main Paradigms of Machine Learning

Machine learning is traditionally categorized into three primary methodologies:

1. Supervised Learning

The system is provided with labeled data: inputs paired with the correct target outputs. - Classification: Predicting a discrete label (e.g., "spam" vs "inbox", "benign" vs "malignant", "dog" vs "cat"). - Regression: Predicting a continuous numeric quantity (e.g., predicting the sale price of a house based on square meters, location, and age).

2. Unsupervised Learning

The system is given raw data without any labels and must discover intrinsic structure, groupings, or clusters on its own. - Clustering: Grouping online shoppers into demographic segments based on browsing behavior. - Dimensionality Reduction: Compressing thousands of variables into a few essential components while preserving maximum information. - Anomaly Detection: Flagging credit card transactions that deviate sharply from a customer's typical spending patterns.

3. Reinforcement Learning (RL)

An agent interacts with an environment, takes actions, and receives feedback in the form of rewards or penalties. Through trial and error, it learns an optimal strategy (policy) to maximize cumulative rewards. - Examples include training autonomous drones to stabilize in wind tunnels, video game agents (like DeepMind's AlphaStar for StarCraft II), and the Reinforcement Learning from Human Feedback (RLHF) phase used to align modern language models like Llama, Claude, and ChatGPT.

Classical Machine Learning and Feature Engineering

Before the deep learning revolution, practitioners used what we now call "classical" or "shallow" machine learning algorithms: - Linear and Logistic Regression - Decision Trees and Random Forests - Gradient Boosting Machines (XGBoost, LightGBM) - Support Vector Machines (SVM) - k-Nearest Neighbors (k-NN)

These algorithms are fast, lightweight, and mathematically interpretable. They continue to run the financial, insurance, and enterprise analytics industries today.

However, classical machine learning had one major bottleneck: Feature Engineering.

If you wanted a classical ML algorithm to recognize cars in photographs, you could not simply hand it raw pixels. The algorithm would choke on millions of numbers. Instead, a human engineer with a PhD in computer vision had to invent mathematical filters (like edge detectors, color histograms, and SIFT features) to extract "features" like wheels, headlights, and corners before feeding them into the model.

If the human engineered poor features, the machine learning model failed. This limitation set the stage for Deep Learning.


2.5 Deep Learning: Multi-Layer Neural Networks

Deep Learning (DL) is a specialized subfield of machine learning based on Artificial Neural Networks with multiple processing layers (hence the word "deep").

Where classical machine learning requires human engineers to hand-craft the features, deep learning algorithms learn both the features and the task simultaneously, directly from raw data.

Classical Machine Learning:

  [ Raw Image ] ---> [ Human Feature Extraction ] ---> [ Simple Classifier ] ---> [ Car / No Car ]

                            (Hard manual labor)



Deep Learning:

  [ Raw Image ] ---> [ Layer 1 ] ---> [ Layer 2 ] ---> [ Layer 3 ] ---> [ Output: Car ]

                      (Edges)       (Textures)      (Parts)

                      \_______________________________________/

                          Learned automatically end-to-end

What Makes Deep Learning "Deep"?

In neural network terminology, a network consists of: 1. An Input Layer that receives raw data (e.g., pixel brightness values or audio frequencies). 2. One or more Hidden Layers that perform mathematical transformations. 3. An Output Layer that delivers the final prediction.

In the 1980s and 1990s, neural networks typically had only one or two hidden layers ("shallow" networks). They struggled to learn complex tasks and were notoriously difficult to train.

A Deep Neural Network contains dozens, hundreds, or even thousands of hidden layers stacked sequentially or in complex graphs. Each layer builds upon the representations discovered by the preceding layer:

  • Layer 1: Detects tiny, simple primitives (horizontal lines, vertical edges, color gradients).
  • Layer 2: Combines edges into textures, corners, and simple geometric shapes (circles, rectangles).
  • Layer 3: Combines shapes into object parts (wheels, windows, eyes, noses).
  • Final Layers: Combines parts into holistic conceptual representations (car, truck, golden retriever, human face).

This automated hierarchical representation learning is the superpower of deep learning. It eliminated the need for manual feature engineering across vision, audio, and language.

Why Did Deep Learning Suddenly Take Off in 2012?

The foundational mathematical principles of deep learning—such as the Perceptron (1958) and Backpropagation (popularized in 1986)—existed decades before deep learning became famous.

Why did it take until the 2010s to revolutionize computing? Three independent technological trends collided simultaneously:

  1. Massive Datasets (Big Data):
    Neural networks are data-hungry. A 50-million-parameter network trained on a few thousand images will simply memorize the data (overfitting) and perform terribly on new images. The rise of the internet, digital cameras, and datasets like ImageNet (14 million labeled images across 20,000 categories) provided the fuel neural networks needed.

  2. Parallel GPU Computing:
    Training deep neural networks requires trillions of simple matrix multiplications and additions. Traditional computer processors (CPUs) are designed to execute complex sequential instructions with low latency; they typically have 4 to 16 powerful cores. Graphics Processing Units (GPUs), created for 3D video game rendering, contain thousands of smaller cores executing identical operations simultaneously in parallel. Researchers realized that GPUs could perform neural network matrix calculations 50 to 100 times faster than CPUs.

  3. Algorithmic Refinements:
    Innovations in mathematical activation functions (such as ReLU replacing sigmoid/tanh), weight initialization techniques, dropout regularization, and optimization algorithms (Adam) prevented gradients from vanishing during backpropagation, making deep networks stable to train.

The turning point occurred in October 2012 at the ImageNet competition. A deep convolutional neural network named AlexNet (designed by Alex Krizhevsky, Ilya Sutskever, and Geoffrey Hinton) obliterated the competition, cutting the image recognition error rate from 26% to 15.3%. Within three years, every computer vision lab on Earth had abandoned classical feature engineering in favor of deep learning.


2.6 Where Large Language Models and Generative AI Fit

Now that we have established the three tiers—AI, ML, and DL—where do modern phenomena like Large Language Models (LLMs), ChatGPT, Llama, and Stable Diffusion fit?

They sit at the cutting edge of Deep Learning.

Artificial Intelligence └── Machine Learning └── Deep Learning └── The Transformer Architecture (Vaswani et al., 2017) ├── Large Language Models (LLMs: Llama, Mistral, Qwen) ├── Diffusion Models (Stable Diffusion, Midjourney) └── Multimodal Models (Vision-Language, Audio-Speech)

The Transformer Revolution

In 2017, a team of researchers at Google published a landmark paper titled "Attention Is All You Need", introducing the Transformer architecture.

Prior to transformers, deep learning systems for language processed text sequentially, one word after another (using Recurrent Neural Networks or LSTMs). This sequential bottleneck made it difficult to capture long-distance relationships between words and prevented efficient parallel training on GPUs.

The Transformer introduced the Self-Attention Mechanism, which allows a neural network to examine every token in a sentence simultaneously and calculate mathematical relationships between all words regardless of their position.

When computer scientists scaled this transformer architecture to billions of parameters and trained it on trillions of words from the public internet, they created Large Language Models (LLMs).

Generative AI vs Discriminative AI

Within deep learning, there is another key distinction you will encounter:

  • Discriminative Models: Designed to classify, filter, or predict a label from an input.
    Example: "Is this image an apple or an orange?" "Is this review positive or negative?"
  • Generative Models: Designed to produce brand-new data that resembles the distribution of its training data.
    Example: "Generate a photorealistic picture of an apple on a wooden table." "Write a 500-word essay about Roman aqueducts."

LLMs are generative models: given a prompt (a sequence of tokens), they generate the most statistically probable continuation of that text, one token at a time.


2.7 Comparison Table: AI vs ML vs DL at a Glance

To crystallize these differences, examine how each layer operates across key technical dimensions:

Dimension Artificial Intelligence (AI) Machine Learning (ML) Deep Learning (DL) Large Language Models (LLMs)
Scope Broadest field; all intelligent systems Subset of AI focused on learning from data Subset of ML using deep multi-layer neural networks Specialized DL models using transformers for language
Origin Era 1950s 1980s 2010s 2017–Present
Logic Source Human-coded rules, logic trees, or learning Statistical algorithms learning from sample data Multi-layer networks learning hierarchical representations Attention mechanisms trained on trillions of tokens
Human Labor Writing explicit rules and knowledge bases Feature engineering (selecting variables manually) Architecture design and dataset curation Data filtering, pretraining compute, alignment (RLHF)
Data Dependency Can operate with zero data (pure logic/rules) Thousands of structured data rows Millions of images, audio clips, or text samples Trillions of tokens of unstructured natural language
Hardware Need Minimal (runs on modest standard CPUs) Modest (CPUs, fast RAM, occasional GPU acceleration) High (NVIDIA GPUs, massive tensor processing capability) Extreme for training (thousands of GPUs); High for local inference
Interpretability High (you can trace every IF-THEN statement) Moderate to High (decision tree paths, feature weights) Low ("Black box" consisting of millions of weights) Very Low (emergent behavior across billions of parameters)
Primary Examples Deep Blue chess, A* pathfinding, expert systems Spam filters, credit scoring, house price estimators Face recognition, autonomous driving vision, speech-to-text Llama 3, Mistral, Qwen, DeepSeek, Loco Local AI

2.8 Common Misconceptions and Buzzword Traps

Because these terms are marketed heavily, beginners frequently absorb common fallacies. Let's dispel the most common ones:

Myth 1: "AI means a computer that thinks like a human."

Reality: Modern AI does not "think," possess consciousness, or experience self-awareness. Deep learning models are high-dimensional statistical pattern-matching engines. An LLM generates coherent text not because it understands human emotions, but because it has modeled the mathematical probability distribution of human words with remarkable accuracy.

Myth 2: "Machine Learning always replaces traditional coding."

Reality: Most software on your computer should never use machine learning. You do not want a machine learning algorithm calculating your bank account balance, parsing JSON files, or encrypting your hard drive. Traditional code is deterministic, exact, and provably correct. Machine learning is probabilistic, inexact, and best suited for perception, classification, estimation, and open-ended generation where explicit rules are impossible.

Myth 3: "If software uses an algorithm, it's AI."

Reality: Sorting a list of names alphabetically is an algorithm (e.g., QuickSort), but it is not AI. Calculating sales tax based on zip code is an algorithm, but it is not AI. Marketing teams routinely slap the label "AI" onto basic database queries and statistical sorting logic.

Myth 4: "AI models learn continuously while you talk to them."

Reality: In 99% of deployed systems—including ChatGPT, Claude, and local models running in Loco—the model weights are completely static (frozen) during use. The model is performing inference, not training. It does not update its parameters based on your conversation. When you close the session, the model returns to its exact original state. (We explore this deeply in Lesson 5: Training vs Inference).


2.9 Why This Hierarchy Matters for Local AI and Hardware

Why should someone interested in running local models on their laptop care about the distinction between AI, ML, and DL?

Because the underlying computational requirements directly dictate what your hardware can execute.

Classical ML vs Deep Learning on Local Hardware

  1. Classical Machine Learning on Your PC:
    If you train a Random Forest model with 500 trees on a dataset of 100,000 spreadsheet rows, the file size is a few megabytes. It trains on your standard Intel or AMD CPU in ten seconds. It uses less than 200MB of RAM. You do not need a GPU, special drivers, or quantization.

  2. Deep Learning (LLMs) on Your PC:
    A modern 8-billion-parameter language model (such as Llama 3 8B or Qwen 2.5 7B) contains 8,000,000,000 floating-point numbers.

  3. At standard 16-bit floating point precision (FP16), the raw weight file is 16 Gigabytes in size.
  4. To generate a single response, the computer must stream those 16 Gigabytes through memory processors for every single word generated.
  5. This workload demands immense memory bandwidth and hardware accelerators (NVIDIA CUDA cores, Apple Silicon Unified Memory, or AMD ROCm).

This explains why the local AI community focuses so obsessively on: - VRAM vs RAM: Placing weights in ultra-fast GPU memory (VRAM) rather than slower system memory (RAM). - Quantization (GGUF): Compressing 16-bit neural network weights down to 4-bit integers so an 8B model shrinks from 16GB to 4.5GB, fitting into consumer hardware. - Inference Runtimes (llama.cpp): Software engineered in pure C/C++ to execute deep neural network tensor mathematics with zero overhead.

When you use Loco, you are not running a simple rule engine or a classical regression model. You are hosting a full deep-learning transformer neural network right on your local processor and graphics card.


2.10 Summary and Key Takeaways

Let's review the fundamental lessons learned:

  1. Artificial Intelligence is the broad scientific vision of building machines capable of performing tasks that normally require human intelligence. It includes rule-based systems, search algorithms, and machine learning.
  2. Machine Learning is the subset of AI where systems learn statistical associations directly from data rather than following hand-coded rules.
  3. Supervised, Unsupervised, and Reinforcement Learning represent the three foundational paradigms of machine learning.
  4. Deep Learning is the subset of machine learning based on multi-layer artificial neural networks that learn hierarchical representations directly from raw inputs, bypassing manual feature engineering.
  5. Transformers and LLMs represent modern state-of-the-art architectures within deep learning, powering generative text, image, and multimodal systems.
  6. Hardware Demands Scale with the Hierarchy: As you move from symbolic AI and classical ML to deep learning and LLMs, the computational demands shift from standard sequential CPU operations to massive parallel matrix math, demanding high memory bandwidth and specialized accelerators.
  7. Loco's Focus: Loco brings deep learning transformer models to your personal device, allowing private, offline execution of models that were once restricted to cloud data centers.

2.11 Self-Check Review Questions

Test your understanding of the core concepts:

  1. Question: Is a chess program that evaluates 50 million moves per second using hand-coded piece-value rules an example of Machine Learning?
    Answer: No. It is Artificial Intelligence (specifically symbolic/heuristic AI), but it does not learn from data, so it is not Machine Learning.

  2. Question: What is the primary difference between Classical Machine Learning and Deep Learning regarding input features?
    Answer: Classical ML relies on human engineers to manually design and extract features from raw data. Deep learning automatically learns hierarchical features directly from raw data across its hidden layers.

  3. Question: Can a software system be Deep Learning without being Machine Learning?
    Answer: No. Deep learning is strictly a subset of machine learning; every deep learning system is by definition a machine learning system.

  4. Question: Why do modern LLMs require specialized inference runtimes like llama.cpp on personal computers?
    Answer: Because LLMs are massive deep neural networks consisting of billions of parameter weights that require continuous high-speed matrix multiplications across every generated token.


2.12 Sources and Further Reading

  • NIST AI Risk Management Framework (AI RMF 1.0): Definitions of AI systems and autonomy boundaries.
  • Google Machine Learning Glossary: Standard taxonomy of AI, ML, Deep Learning, and neural network terminology.
  • Vaswani et al. (2017): "Attention Is All You Need" - The foundational paper introducing the Transformer architecture.
  • Goodfellow, Bengio, and Courville (2016): Deep Learning (MIT Press) - Comprehensive textbook on deep neural network foundations.
  • Arthur Samuel (1959): "Some Studies in Machine Learning Using the Game of Checkers" - The historical origin of machine learning terminology.

Loco Academy: Lesson Status

Completed: Lesson 2: AI vs Machine Learning vs Deep Learning

Next: What Is Generative AI?

Course: Local AI 101

Local AI 101 Navigation