# Stanford CS193T Thinking with AI | Autumn 2026 | Introduction to AI

## Executive summary

This lecture provides a foundational, technical overview of Large Language Models (LLMs) and generative AI. It demystifies how LLMs function by defining them as statistical fingerprints of language usage. The core mechanics involve predicting the next token using complex neural networks, which are trained through two phases: pre-training (ingesting massive, raw data) and fine-tuning (using curated data and human feedback, often via RLHF). The model's output is governed by the 'context window,' a finite resource that dictates the model's ability to maintain coherence. The lecture also highlights critical failure modes, including hallucination and sycophancy, and discusses the importance of the 'transformer' architecture and the 'attention' mechanism for improving context sensitivity.

## Key takeaways

- LLMs are Statistical Predictors: LLMs are defined as statistical fingerprints of how language is used across massive text collections, predicting the next token (word or part of a word) based on probability, rather than understanding meaning in a human sense.
- The Transformer Architecture: The transformer is a major technological shift that enhances the neural network by implementing an 'attention' mechanism, allowing the model to assign varying weights (importance) to different words within the input context.
- Training Phases: Pre-training and Fine-tuning: Models undergo pre-training (ingesting all available data) and fine-tuning (using highly curated data and human feedback, known as RLHF) to refine weights and improve desirable response patterns.
- The Context Window is a Finite Resource: The model's performance is limited by the context window size, which dictates the maximum number of tokens the network can process. Managing this window is crucial for maintaining accuracy.
- Failure Modes (Hallucination, Sycophancy): LLMs are prone to hallucination (generating plausible but untrue information) because their ability to generalize and make best guesses in uncertainty is inherent to their structure. Sycophancy is a failure mode where the model prioritizes pleasing the user over providing factual truth.

## Technical details

- Tokens and Parameters: A 'token' is generally treated as a word, or sometimes a part of a word. 'Parameters' or 'weights' are the numerical values representing the strength of connections (lines) between concepts (nodes) in the neural network. GPT-5.6 is rumored to have between two and four trillion parameters.
- Neural Network Mechanics: The network processes input from left to right. Each node represents a concept, and the connection lines (weights) quantify how relevant that concept is to the input text. The calculation is a weighted average of activations from previous layers.
- The Transformer and Attention: The transformer is an enhancement that replaces the assumption of equal word weight with an adjusted weight based on the importance of context. This is achieved by focusing the model's attention on key input elements.
- Model Types and Limitations: LLMs are generative, meaning they create new content. They differ from classifiers, which only sort existing data into categories. LLMs are 'black box' models, lacking explainability, which can be a legal concern in regulated fields (e.g., loan applications).

## Practical implications

- Understanding the finite nature of the context window allows engineers to strategically manage input data to maintain model accuracy.
- Recognizing the difference between generative AI (LLMs) and classification models is critical for selecting the appropriate AI tool for a specific business function.
- The concept of 'guardrails' involves providing explicit, detailed instructions to the AI (e.g., 'act like a well-trained TA') to constrain its output and mitigate hallucination.
- The need for nuanced AI policy is emphasized, requiring consideration of specific use cases, tool types, and special populations (e.g., English language learners).

## Topics

Large Language Models (LLMs), Generative AI, Neural Networks, Transformer Architecture, Context Window Management, AI Ethics and Governance, Stanford AI playground, GPT-4o, GPT-5.6, Claude, Gemini, Grok, Haiku, Sonnet, Opus

Source: https://www.youtube.com/watch?v=I7zvCSGMkoc
