1. Home
  2. Explore
  3. Computer Science
  4. Artificial Intelligence Introduction

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Artificial Intelligence Introduction

Speaker 1Speaker 2

Artificial Intelligence Introduction

16:10
0:00-16:10
  1. Anna

    Welcome to CS221, Artificial Intelligence, and welcome to Stanford if you're new here. I'm Anna, and I'm joined by Corey. The course is taught by Percy and Dorsa, with a diverse teaching team interested in areas including natural language processing, machine learning, data mining, and computer vision.

  2. Corey

    That diversity matters because students can draw on the teaching team's different perspectives, especially when developing final projects. Before the technical material begins, there are weekly sections covering both review and advanced topics. The first section includes an overview for anyone who is rusty on Python or probability.

  3. Anna

    And there are a few practical details to remember. The first homework is posted on the course website and is due next Tuesday at 11:00 PM. Assignments are submitted through Gradescope, with the course's Gradescope code posted on Piazza.

  4. Corey

    Now, why study artificial intelligence? At this point, AI is difficult to miss. Systems have achieved superhuman performance in games such as Jeopardy, Go, Dota 2, and poker, while other systems can read documents and answer questions, recognize speech and faces, and assist with medical imaging.

  5. Anna

    Those successes have also led to broad claims about AI transforming work and society, sometimes including predictions of catastrophic consequences. No one knows exactly what the future holds, but it is reasonable to say that AI will be transformative. To understand how we got here, we need a little history.

  6. Corey

    A key starting point is the summer of 1956 at Dartmouth College. John McCarthy organized a workshop with researchers including Marvin Minsky and Claude Shannon. Their ambitious goal was to capture every aspect of learning and intelligence precisely enough that a machine could simulate it.

  7. Anna

    The workshop did not solve AI, but it produced influential programs and ideas. Systems could play checkers, prove theorems, and sometimes produce proofs that were better than human versions. The optimism was enormous, and some researchers predicted that AI would be solved within a few years.

  8. Corey

    A famous machine-translation story shows why those predictions failed. The English sentence, 'The spirit is willing but the flesh is weak,' was translated into Russian and then back into English as, 'The vodka is good but the meat is rotten.' The result became a symbol of early AI's limitations, and funding cuts contributed to the first AI winter.

  9. Anna

    Two major problems were involved. First, the available computing power was millions or even billions of times smaller than what we have now. Second, many early formulations required exponential search, so simply adding more computation could not make the approach practical.

  10. Corey

    There was also a deeper issue: some tasks are not merely computation problems. Translation requires learning a language and experiencing its subtleties. Even with unlimited computation, a system lacking the relevant information and experience could not simply calculate its way to a good translation.

  11. Anna

    Still, early AI contributed substantially to computer science. Lisp influenced ideas found in later high-level languages, and work on garbage collection and time-sharing became important. Another lasting idea was separating what you want to compute—modeling—from how you compute it—inference.

  12. Corey

    In the 1970s and 1980s, enthusiasm returned through expert systems. The central idea was that knowledge is power: if experts' knowledge could be encoded as rules, a system could diagnose diseases or convert customer orders into parts. These systems had narrower goals than the original dream of solving all AI, and they produced some of the field's first useful industrial applications.

  13. Anna

    But deterministic rules were not rich enough to capture all the nuances of the world. They also required substantial manual effort to create and maintain. Once again, over-promising and under-delivering contributed to a second AI winter.

  14. Corey

    A parallel tradition began in 1943, when neuroscientist Warren McCulloch and logician Walter Pitts developed a theory of artificial neural networks. They connected neurons and logic mathematically, laying part of the foundation for modern deep learning. Since computing was limited, much of the early work was mathematical rather than large-scale model training.

  15. Anna

    In 1969, Minsky and Papert's book Perceptrons mathematically analyzed neural networks and showed that linear classifiers could not solve the XOR problem. XOR asks whether two inputs are different. Although the result concerned single-layer linear models and did not show what deeper networks could do, it helped shift attention away from neural networks and toward symbolic, logic-driven AI.

  16. Corey

    Neural-network research continued within a smaller community. In the 1980s, researchers renewed interest in backpropagation, a general method for training multilayer networks. In 1989, Yann LeCun used a convolutional neural network to recognize handwritten digits, and the approach was deployed by the United States Postal Service to read ZIP codes.

  17. Anna

    Neural networks truly took off in the 2010s under the name deep learning. AlexNet's 2012 results on the ImageNet benchmark transformed computer vision, and systems such as AlphaGo demonstrated the power of neural networks in games. This history reveals two intellectual traditions: the logical tradition associated with McCarthy and the neuroscience-inspired neural-network tradition.

  18. Corey

    Those traditions have often been portrayed as opposites, but they also connect deeply. McCulloch and Pitts linked neural networks to logic from the beginning. Go is itself a mathematically defined logical system, yet neural networks can learn models that play it extraordinarily well. Understanding how these forms of structure and learning work together remains a major challenge.

  19. Anna

    AI also draws from many other fields. Maximum likelihood comes from statistics, games connect to economics, and optimization techniques such as gradient descent developed outside AI. AI is like a melting pot: it combines ideas developed in different contexts and applies them to interesting problems.

  20. Corey

    There are two useful ways to think about AI's goals. The first is AI as agents: recreating or creating intelligence. The second is AI as tools: using technology to benefit people. These views overlap technically, but they are philosophically different.

  21. Anna

    The agent view asks how to build systems with capabilities associated with humans. Humans perceive the world, recognize objects, grasp and manipulate things, communicate through language, know facts, use procedural skills such as riding a bike, reason with knowledge, and learn through experience.

  22. Corey

    Each capability has generated its own area of AI, including language, vision, robotics, and learning. But current systems are generally successful on narrow tasks using millions or billions of examples and substantial computation. Humans operate differently: they handle diverse tasks and often learn from very few examples. Building machines with that breadth and efficiency remains a grand challenge.

  23. Anna

    The tools view does not require making a human-like system. It focuses on systems that help humans. Examples include using computer vision on satellite images to estimate indicators such as GDP in areas affected by poverty, or predicting when to cool data centers to save energy.

  24. Corey

    Deployment also introduces serious risks. Adversarial examples can fool recognition systems: specially designed glasses can cause a face-recognition system to identify someone as another person, and stickers placed on a stop sign can make a system interpret it as a speed-limit sign.

  25. Anna

    Bias is another concern. Malay does not distinguish between 'he' and 'she' in its written form, but a translation system may produce gendered outputs such as 'she is a nurse' and 'he is a programmer.' That reflects societal patterns in the data and shows how models can reproduce biases.

  26. Corey

    Fairness becomes especially important when systems affect people's lives. The COMPAS system attempted to predict criminal risk. ProPublica reported that among people who did not reoffend, Black people were incorrectly classified as risky more than twice as often as non-Black people. Northpointe responded with a different fairness measure, noting that people with a particular risk score reoffended at similar rates across groups.

  27. Anna

    The important lesson is that different reasonable definitions of fairness can be mathematically incompatible. Deciding which notion to use is not merely a technical question; it is an open area of research and a societal decision. AI systems should not automatically inherit human biases simply because their data comes from society.

  28. Corey

    The course organizes its technical approach around modeling, inference, and learning. Modeling turns a complicated real-world situation into a mathematically precise simplification. Inference asks questions about that model, and learning determines model parameters from data rather than requiring people to specify every detail manually.

  29. Anna

    Consider finding the best route through a city. A model could represent intersections as nodes, roads as edges, and travel costs as edge weights. Inference would then ask for the lowest-cost path from one point to another. If the edge costs are unknown, learning can estimate them from data about how long people took to travel between locations.

  30. Corey

    This paradigm is broader than any one algorithm. You specify a model skeleton, collect data, use a learning procedure to fill in parameters, and then perform inference. Machine learning is powerful because it shifts complexity from code to data: instead of writing an unmanageable amount of code, you can use more naturally collected data with a smaller amount of general-purpose code.

  31. Anna

    That power involves a leap of faith called generalization. A model can fit its training data, but what matters is how it performs on new experiences. Probability and statistics provide ways to formalize this question, but the distinction between memorizing old examples and handling new ones is fundamental.

  32. Corey

    The course then moves from lower-level to higher-level models. Reflex models apply a fixed computation directly from input to output. A visual system instantly recognizing a zebra is an intuitive example. Linear classifiers and deep neural networks are also examples of models that can operate in this reflex-like way.

  33. Anna

    Reflex models are fast, but some tasks require planning. State-based models represent situations as states and possible actions that move an agent between states. This applies to games, robotics, motion planning, navigation, and even some forms of language or image generation.

  34. Corey

    The course distinguishes search problems, where the agent controls the choices; problems involving randomness, such as traffic or dice; and adversarial games, where another agent actively tries to defeat you. Some settings contain both an opponent and randomness, as in games such as backgammon.

  35. Anna

    Pac-Man is a concrete example. You can ask what the states are, what actions Pac-Man can take, and how an agent should eat all the dots while avoiding ghosts. The course includes an assignment and competition built around creating such an agent.

  36. Corey

    Other problems are better represented using variables and constraints. Sudoku is a good example: the goal is to assign numbers to variables while satisfying row, column, and three-by-three-block constraints. Although Sudoku can be formulated as a sequence of states, a variable-based formulation is more natural and can enable more efficient algorithms.

  37. Anna

    Constraint satisfaction problems use hard constraints, such as the idea that one person cannot occupy two places at once. Bayesian networks use variables with soft dependencies. For example, variables might represent a car's positions over time, while noisy sensor readings provide evidence. Inference then estimates where the car was given those observations.

  38. Corey

    At a higher level, logic lets a system store heterogeneous facts and derive consequences. If you tell a system that Alice is a student and that students are people, it can conclude that Alice is a person. If you tell it that Alice is from Phoenix and Phoenix is hot, it can use rules involving hot places and cold conditions to reason about whether Alice is happy.

  39. Anna

    This differs from a typical machine-learning system trained on millions of examples for one task. A logic system can receive a statement once and immediately use its consequences in many kinds of questions. The tradeoff is that logic systems can be brittle, but they demonstrate how explicit knowledge supports deeper reasoning.

  40. Corey

    For logistics, the course expects programming, discrete mathematics, probability, and basic proof skills. Students complete eight homeworks combining written and programming problems, an exam, and a project. Homework problems focus on applications and particular model types, and there are extra-credit opportunities including a competition.

  41. Anna

    The exam tests whether students can model and solve new problems, not simply recall facts. It is written, closed-book, and allows one page of notes. The project is an opportunity to apply course ideas to something meaningful, ideally in groups of three, with milestones including a proposal, progress report, poster session, and final report.

  42. Corey

    Each project group receives a teaching-assistant mentor, and students can also use office hours. Assignments are submitted on Gradescope, with seven total late days and at most two late days per assignment. Piazza is the main communication channel, and students are encouraged to help one another there.

  43. Anna

    Collaboration has clear limits under the Honor Code. Students may discuss ideas and debug by comparing input-output behavior, but each person must independently write the homework and code. Do not copy another student's write-up or code, use code from GitHub, or post homework assignments publicly. Code-duplication detection is used to enforce these rules.

  44. Corey

    Let's finish with two optimization ideas. Discrete optimization searches for the best discrete object, such as a minimum-cost path. Dynamic programming is useful when a large problem can be expressed in terms of smaller overlapping subproblems. Continuous optimization searches for a real-valued vector that minimizes an objective, and gradient descent is a simple but powerful method for doing that.

  45. Anna

    Edit distance illustrates dynamic programming. Given two strings, the goal is to find the minimum number of insertions, deletions, and substitutions needed to transform one into the other. For example, the distance between identical strings is zero, while changing 'cat' to 'dog' requires three substitutions.

  46. Corey

    Rather than trying every possible sequence of edits, define a subproblem: the minimum edit distance between the first m characters of one string and the first n characters of the other. If the final characters match, remove both and solve the smaller problem. If they differ, consider substitution, deletion, and insertion, add one for the chosen edit, and take the minimum.

  47. Anna

    The base cases are simple. Comparing an empty string with a string of length n requires n insertions, and comparing a string of length m with an empty string requires m deletions. A recursive implementation is correct in principle, but without caching it repeatedly solves the same subproblems and becomes exponentially slow.

  48. Corey

    Memoization fixes that redundancy. Store the answer for each pair of indices m and n in a cache. Whenever the same subproblem appears again, return the stored result instead of recomputing it. With memoization, the algorithm pays for the distinct subproblems rather than for every path through the recursion tree.

  49. Anna

    For continuous optimization, consider regression. Given data points such as pairs of input and output values, choose a line, represented here by a slope w, that best fits the data. Least squares defines the error as the sum over all points of the squared difference between the prediction w times x and the actual value y.

  50. Corey

    To minimize that objective, gradient descent starts with some value of w, computes the derivative of the error, and moves in the opposite direction. The derivative indicates which direction makes the function increase, so moving against it decreases the objective. A step-size parameter controls how far each update moves.

  51. Anna

    In the example with points such as (2,4) and (4,2), repeated updates begin at w equals zero, move through values such as 0.3 and 0.8, and converge to an objective value of 7.2 with an optimal slope of 0.8. The example is simple, but gradient descent underlies essentially all of the machine-learning algorithms discussed later.

  52. Corey

    So the course's central message is both technical and practical: represent complicated worlds with useful models, reason efficiently through inference, and learn unknown parameters from data. At the same time, evaluate how systems generalize and how their deployment affects security, bias, fairness, and society.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent