Artificial Intelligence · Grade 8 · Chapter 2
What is AI? Deeper Systems View
Exploring the end-to-end architecture of artificial intelligence — from raw sensors to model inference and feedback loops.
Real-World Case Study
50 Milliseconds to Decide
An autonomous car speeds down a rain-slicked road. In less than 50 milliseconds, cameras capture pixels, LiDAR measures distances, neural networks compute probabilities, and actuators apply the brakes before a human driver could even blink.
Systems Inquiry: What subsystems must communicate inside the car to execute this instant decision?
Learning Blueprint
What We Will Master Today
- Map the 4-layer AI systems architecture (Data, Model, Inference, Action).
- Distinguish between Model Training (heavy compute) and Model Inference (real-time prediction).
- Analyze data preprocessing pipelines, feature extraction, and tokenization.
- Evaluate Edge AI vs. Cloud AI trade-offs (Latency, Bandwidth, Privacy).
Prior Knowledge Connection
Traditional Code vs. AI Systems
Traditional Software
Rules + Data → Answers
Human programmers explicitly write every single if/else condition by hand.
Machine Learning System
Data + Answers → Rules (Model)
Algorithms discover hidden mathematical patterns across massive datasets automatically.
Core Architecture
The 4-Layer AI Systems Model
Every modern AI application operates across four distinct system layers working in sequence.
1. Data Layer
Sensors, cameras, databases, web scrapers, and data cleaning pipelines.
2. Model Layer
Neural network weights, mathematical transformations, and feature maps.
3. Inference Engine
Software runtime executing predictions on new unseen data in real time.
4. Action & Feedback
UI displays, motor actuators, API alerts, and logging for continuous training.
End-to-End Pipeline
Data Pipeline Flowchart
STEP 1
IngestionRaw text/images collected from sensors or web.
STEP 2
PreprocessingClean, normalize & convert to numbers (Vectors).
STEP 3
Model Forward PassMultiply inputs by trained weights & matrices.
STEP 4
Action / OutputReturn class score, bounding box, or generated word.
Core Concept 2
Data Preprocessing & Vectorization
AI models cannot read words or look at raw photos directly — everything must be converted into numerical matrices (tensors).
- Tokenization: Breaking text into smaller sub-word units (tokens).
- Embeddings: Mapping tokens into high-dimensional vector spaces where similar concepts sit close together.
- Normalization: Scaling image pixel values from [0, 255] down to [0.0, 1.0].
Garbage In, Garbage Out
Clean Data vs. Noisy Data
Clean Data Pipeline
Balanced classes, high-resolution images, labeled correctly.
Outcome: High accuracy, low bias, reliable predictions.
Noisy / Biased Data
Missing labels, corrupt files, skewed demographic samples.
Outcome: Hallucinations, systematic errors, catastrophic failures.
Core Concept 3
Model Training: Weights & Biases
Training is an optimization process where a model adjusts millions (or billions) of internal mathematical parameters to minimize error.
Forward Pass
The model computes an initial guess based on current weights.
Loss Function
Measures how far the guess was from the actual correct target answer.
Backpropagation
Calculates exact calculus gradients showing how to adjust each weight.
Optimizer (Gradient Descent)
Nudges internal parameters in the direction that lowers total error.
Training Loop Mechanics
The Machine Learning Training Cycle
1. INPUT
Feed training batch through network.
2. PREDICT
Generate prediction output probabilities.
3. COMPARE
Calculate Loss (Error score).
4. UPDATE
Adjust weights via Gradient Descent.
Core Concept 4
Training vs. Inference
Understanding the profound difference between building a model and running a model.
Model Training (Heavy)
Requires massive supercomputing clusters with thousands of GPUs running for weeks/months. Consumes megawatts of power.
Model Inference (Light)
Runs the finalized frozen model parameters to answer single requests in milliseconds. Can run on phones or microchips.
Smartboard Voting
Where Should Inference Run?
Should a smartphone face-lock AI model run on a Cloud Server or Edge Device on the phone?
Option A: Cloud Server
More compute power, but requires internet connection and adds network latency.
Option B: Edge Microchip
Instant zero-latency processing, works offline, keeps face data private on device.
Deep Learning Architecture
Neural Network Layers
Deep neural networks organize nodes into layers that extract increasingly abstract features.
- Input Layer: Receives raw numerical values (e.g., RGB pixel values).
- Hidden Layers: Early layers detect edges/textures; deeper layers detect eyes, noses, and full facial shapes.
- Output Layer: Produces final confidence scores (e.g., 98% Cat, 2% Dog).
Scenario Analysis
Autonomous Drone Navigation System
SYSTEM CHALLENGE
A delivery drone flies through a thick forest at 30 km/h. Its onboard camera loses Wi-Fi connection. How must its hardware architecture handle real-time obstacle avoidance without cloud connectivity?
Discussion Question: What sensor inputs and edge-AI accelerators are required onboard?
Core Concept 5
Feedback Loops & Model Drift
AI models are not static; their performance changes over time as real-world environments evolve.
Model Drift
When user behavior changes (e.g., new slang or fashion trends), older models become inaccurate.
Reinforcement Learning (RLHF)
Human feedback scores steer model responses to become safer and more helpful over continuous iterations.
Spot the Mistake
Flawed AI System Architecture
A hospital designs an AI triage assistant with the following architecture. What critical mistake is present?
Architecture: Hospital streams unencrypted high-resolution patient X-rays to an external third-party server to run inference over public 4G networks.
Identify 2 Flaws: Privacy violation (HIPAA) & latency risk during network congestion.
Guided System Tracing
Tracing a Smart Voice Assistant
Trace the path of your voice when you say "Hey Siri, play music":
1. Edge Wake-Word
Mic buffer detects local keyword.
2. ASR Engine
Audio converted to text tokens.
3. NLU Intent
Classifier extracts intent:
play_music.
4. API Execution
Music app streams audio stream.
Interactive Design Activity
Designing an AI Plant Health Inspector
Design an AI application for farmers to diagnose crop diseases using a smartphone camera.
- Data Needed: 10,000 photos of healthy vs. diseased plant leaves.
- Preprocessing: Crop leaf box, resize to 224x224, normalize colors.
- Inference Location: Mobile device app (works in remote rural fields without internet).
Check Your Understanding
What is the primary role of Data Preprocessing in an AI system?
ATo manufacture fake images when real data is missing
BTo clean, normalize, and convert raw inputs into numerical tensors
CTo increase the hardware clock speed of the graphics card
DTo encrypt user passwords before storing them in SQL
Click to reveal answer
Check Your Understanding
Which statement correctly contrasts Training and Inference?
ATraining runs on phones while Inference requires supercomputers
BTraining updates weight parameters; Inference uses frozen weights to predict
CTraining is done in real-time; Inference takes months to complete
DTraining uses clean data; Inference requires noisy corrupt data
Click to reveal answer
Check Your Understanding
Why would a self-driving car prefer Edge Computing over Cloud Computing for braking decisions?
ACloud servers do not support computer vision models
BEdge computing is always cheaper to build
CEdge computing eliminates network latency and does not depend on cell signal
DCloud servers store data in vectors instead of numbers
Click to reveal answer
Systems Safety & Fallbacks
Fail-Safe Systems in Critical AI
When a high-stakes AI system (medical diagnosis, aviation, power grid control) encounters uncertainty, how should the architecture trigger human intervention?
Discussion: What is a "Confidence Threshold" and why should low confidence trigger a manual override?
Systems Design Workshop
Blueprint an AI Homework Helper
In small teams, draw the 4-layer architecture of an AI system that checks handwritten math homework:
Inputs & Vision
OCR camera capture, line segmentation, formula extraction.
Model & Output
Math solver engine, step generator, feedback UI card.
Chapter Summary
Core AI Systems Takeaways
- AI is an integrated system: Data Ingestion → Preprocessing → Model → Inference → Action.
- Training adjusts mathematical weights; Inference executes frozen predictions.
- Edge AI delivers ultra-low latency; Cloud AI provides massive compute power.
- Clean data and continuous feedback loops prevent model drift and system failures.
Exit Ticket
Systems Knowledge Check
1. Name the 4 layers of an end-to-end AI system.
2. State one major advantage of running model inference locally on an Edge device rather than in the Cloud.
Looking Ahead
Next Chapter: Python Refresher
Now that we understand the big-picture architecture of software and AI systems, we return to the keyboard to master Python programming foundations!