Chapter 20 of 22 Part IV: Information Processing

Inside the Mind of Artificial Intelligence

Each project below is tailored to a specific algorithm and scientific question from Chapter 20, with concrete inputs, verifiable numerical outputs, boundary cases, and links to the related lab and pioneer.

Project 1 of 3 · v1-c20-p01 Intermediate · ~30 min

Perceptron Learning & Train/Test Split Lab

Lab activity: 1. Teach a tiny model · Related code: block-01.js, block-04.js · Pioneer: View profile

Real-World Problem: How does a machine learn a classification boundary from labeled examples without hard-coded if-statements?
Scientific Question: Why must a model be evaluated on held-out unseen test data rather than only the examples it trained on?

Objective: Train a 2-input perceptron using the perceptron update rule and compare training accuracy vs. held-out test accuracy.

Hypothesis to Test: On linearly separable points, perceptron weights converge to 100% accuracy; on XOR points, a single linear boundary cannot exceed 75%.

Step-by-Step Implementation

  1. Initialize weights w1, w2 and bias b to 0 with learning rate eta = 0.1.
  2. For each training point, predict y_hat = (w1*x1 + w2*x2 + b >= 0 ? 1 : 0) and update w += eta*(y - y_hat)*x.
  3. Evaluate final weights on a disjoint held-out test set.
  4. Test XOR inputs (0,0)->0, (0,1)->1, (1,0)->1, (1,1)->0 to observe the classic linear-separability limit.
Concrete Input: Linearly separable dataset (AND gate) vs. non-linearly separable XOR dataset.
Expected Output: AND -> converges to 100% accuracy; XOR -> stuck at <= 75% (proving need for multi-layer networks).

Test Cases: AND gate -> 4/4 correct; OR gate -> 4/4 correct; XOR -> impossible for 1 linear neuron.

Boundary Condition: Never leak test points into the training loop (data leakage inflates apparent accuracy).

Common Mistake to Avoid: Reporting 100% training score as proof of generalization.

Interpreting Results: Frank Rosenblatt's perceptron launched neural learning, and its XOR limitation led to multi-layer backpropagation (Hinton, LeCun, Bengio).

Show Hint, Extension Challenge & Reflection

Hint: Review the worked example and equation in Chapter 20 before testing the boundary case: Never leak test points into the training loop (data leakage inflates apparent accuracy).

Extension Challenge: Add a 2-neuron hidden layer to solve XOR cleanly.

Reflection Question: Why is keeping train and test sets strictly separated the golden rule of empirical machine learning?

Project 2 of 3 · v1-c20-p02 Intermediate · ~25 min

Bigram Next-Word Probability Predictor

Lab activity: 2. Predict the next word · Related code: block-02.js, block-05.js · Pioneer: View profile

Real-World Problem: Autocomplete keyboards and large language models predict likely next words from preceding context.
Scientific Question: How do frequency counts and sampling temperature control the trade-off between predictable and creative continuations?

Objective: Build a transparent bigram next-word probability table from a short corpus and compare greedy vs. temperature-scaled sampling.

Hypothesis to Test: Greedy decoding always picks the highest-probability next word, while higher temperature flattens probabilities toward rarer words.

Step-by-Step Implementation

  1. Tokenize a small educational paragraph into lowercase words.
  2. Count transitions (word_i -> word_{i+1}) and normalize each row to sum to 1.0.
  3. Inspect the probability distribution for a chosen prompt word.
  4. Generate 8-word continuations with greedy argmax vs. seeded weighted sampling.
Concrete Input: Short science corpus; prompt "the digital" -> candidate next words with exact conditional probabilities.
Expected Output: P("world" | "digital") = 0.67, P("signal" | "digital") = 0.33; greedy outputs "world".

Test Cases: Row probabilities always sum to 1.0; Unseen prompt word -> graceful fallback message.

Boundary Condition: Small corpora easily repeat loops (e.g., "the digital world of the digital world...").

Common Mistake to Avoid: Mistaking fluent statistical word chaining for true factual comprehension.

Interpreting Results: Even massive modern transformers extend this core idea: predicting conditional token distributions over long contexts.

Show Hint, Extension Challenge & Reflection

Hint: Review the worked example and equation in Chapter 20 before testing the boundary case: Small corpora easily repeat loops (e.g., "the digital world of the digital world...").

Extension Challenge: Upgrade from bigrams (1-word context) to trigrams (2-word context) and observe coherence vs. sparsity.

Reflection Question: Why can a next-token predictor state a completely wrong historical date in smooth, confident prose?

Project 3 of 3 · v1-c20-p03 Foundational · ~25 min

AI Study-Assistant Fact-Verification Audit

Lab activity: 3. Ask a study assistant · Related code: block-03.js, block-04.js, block-05.js · Pioneer: View profile

Real-World Problem: Students increasingly ask AI assistants science questions, yet models can hallucinate formulas, dates, or citations.
Scientific Question: How can a structured verification checklist catch plausible-sounding AI errors before they enter homework or code?

Objective: Audit 5 synthetic study-assistant answers (containing planted subtle errors in units, dates, and formulas) against chapter sources.

Hypothesis to Test: Checking numerical examples, units, and primary references exposes subtle errors that read smoothly at first glance.

Step-by-Step Implementation

  1. Read each synthetic assistant explanation in Activity 3.
  2. Re-compute any numerical claim independently (e.g., c × 10^-6 s).
  3. Verify named standards and inventor dates against the chapter references.
  4. Rewrite each flawed claim into an accurate, sourced statement.
Concrete Input: 5 synthetic assistant responses (e.g., claiming 1 μs GPS error = 3 meters instead of 300 meters).
Expected Output: All planted errors identified with exact mathematical counter-proof and primary source.

Test Cases: 1 μs × 3×10^8 m/s = 300 m (catches 3 m error); RFC 6238 allows SHA-256 (catches SHA-1-only error).

Boundary Condition: Even when an assistant cites a real-looking URL or RFC number, verify the actual source.

Common Mistake to Avoid: Trusting confident tone or long formatting as a proxy for factual accuracy.

Interpreting Results: Scientific literacy means treating AI as a draft assistant whose claims must be verified like any instrument.

Show Hint, Extension Challenge & Reflection

Hint: Review the worked example and equation in Chapter 20 before testing the boundary case: Even when an assistant cites a real-looking URL or RFC number, verify the actual source.

Extension Challenge: Write a 3-step verification rubric your class can use whenever checking AI-generated code.

Reflection Question: How did John McCarthy's original 1955 Dartmouth vision compare to modern statistical AI?