Foundations of AI
- 1. Foundations of AI
- 2. NLP
- 3. How LLMs work
- 4. Working with LLMs
- 5. Building AI systems
- 6. Practical & responsible AI
What is Artificial Intelligence?
The term was coined by John McCarthy in the 1955 proposal for the Dartmouth Summer Research Project on Artificial Intelligence (held in 1956), which set out to study the conjecture that "every aspect of learning or any other feature of intelligence can in principle be so precisely described that a machine can be made to simulate it."
Today "AI" is used as an umbrella term. A chess engine, a spam filter, a face-unlock system on a phone and a chatbot like ChatGPT or Claude are all AI systems, but they work in very different ways. Russell and Norvig, in the standard textbook Artificial Intelligence: A Modern Approach, describe AI as the study of agents that perceive their environment and act to achieve goals as well as possible.
AI vs Machine Learning vs Deep Learning vs Generative AI
These four terms are nested inside each other, as the figure at the top of this page shows. Every deep learning system is a machine learning system, and every machine learning system is an AI system, but not the other way round.
| Term | What it means | How it gets its behaviour | Examples |
|---|---|---|---|
| Artificial Intelligence | Any technique that makes a machine act intelligently | Hand-written rules, search, logic, or learning from data | Chess engines, route planners, expert systems, all of the below |
| Machine Learning (ML) | AI that learns patterns from data instead of being explicitly programmed | An algorithm fits a model to examples | Spam filters, credit scoring, recommendation systems, decision trees, gradient boosting |
| Deep Learning (DL) | ML using neural networks with many layers | Learns its own features from raw data (pixels, audio, text) | Image recognition (CNNs), speech recognition, machine translation |
| Generative AI (GenAI) | Deep learning models that create new content | Learns the distribution of its training data and samples from it | ChatGPT, Claude, Gemini (text); Stable Diffusion, DALL·E (images) |
| Large Language Model (LLM) | A generative model trained on huge amounts of text to predict the next token | Transformer neural network, billions of parameters | GPT-4o, Claude, Llama, Mistral, Qwen (see How LLMs work) |
Narrow, general and super AI
AI is also classified by how broad its abilities are:
- Narrow AI (weak AI): built for a specific task or a set of related tasks. Every AI system that exists today is narrow AI, including LLMs, even though they handle many language tasks.
- Artificial General Intelligence (AGI): a hypothetical system that can learn and perform any intellectual task a human can, and transfer knowledge between domains. There is no agreed definition or test for it.
- Artificial Superintelligence (ASI): a hypothetical system that exceeds human ability in practically every domain.
How machines learn: programming vs learning
In traditional programming, a person writes the rules. In machine learning, the person supplies examples with the correct answers, and the algorithm works out the rules (the model) by itself.
The learned model is a mathematical function with adjustable numbers called parameters (or weights). Training means finding the parameter values that make the model's predictions match the examples as closely as possible. For more depth, see my page on Machine learning fundamentals.
Types of learning
| Type | What the model gets | What it learns | Typical tasks |
|---|---|---|---|
| Supervised | Inputs with correct answers (labels) | A mapping from input to answer | Classification (spam / not spam), regression (house price) |
| Unsupervised | Inputs without labels | Structure hidden in the data | Clustering customers, dimensionality reduction, anomaly detection |
| Self-supervised | Raw data; the labels are created from the data itself | General-purpose representations | Predict the next word (how LLMs are pre-trained), fill in a masked word (BERT) |
| Reinforcement | An environment that gives rewards or penalties | A strategy (policy) that maximises total reward | Game playing (AlphaGo), robotics, and RLHF for chatbots |
Neural networks in one picture
Deep learning uses artificial neural networks, loosely inspired by neurons in the brain. Each artificial neuron computes a weighted sum of its inputs, adds a bias, and passes the result through a non-linear activation function \(f\):
\( y = f\left(\sum_{i=1}^{n} w_i x_i + b\right) \)
Neurons are arranged in layers. "Deep" simply means there are many hidden layers between the input and the output. Modern LLMs are neural networks with tens to hundreds of layers and billions of weights.
For a deeper treatment of neurons, back-propagation and optimisers, see my Deep learning page.
Training vs inference
Every ML model has two phases in its life:
- Training: the model sees examples, measures how wrong it is with a loss function, and adjusts its weights using gradient descent and back-propagation. This is slow and expensive and happens once (or occasionally).
- Inference: the trained model, with its weights fixed, is used to make predictions on new inputs. This is what happens every time you send a message to a chatbot.
Discriminative vs generative models
| Discriminative model | Generative model | |
|---|---|---|
| Question it answers | "Which class does this input belong to?" | "What does data like this look like? Make a new one." |
| Probability learned | \(P(y \mid x)\): label given input | \(P(x)\) or \(P(x \mid \text{prompt})\): the data itself |
| Output | A label, score or number | New text, images, audio, code |
| Examples | Logistic regression, SVM, image classifiers, BERT classifiers | GPT, Claude, Llama, diffusion models, GANs, VAEs |
A short history of AI
| Year | Milestone | Why it mattered |
|---|---|---|
| 1950 | Alan Turing, "Computing Machinery and Intelligence" | Proposed the "imitation game" (Turing test) as a way to discuss machine intelligence |
| 1956 | Dartmouth workshop | Founding event of AI as a research field |
| 1958 | Rosenblatt's perceptron | An early trainable artificial neuron |
| 1966 | ELIZA (Joseph Weizenbaum, MIT) | Early chatbot using pattern matching; people attributed understanding to it |
| 1980s | Expert systems | Rule-based AI in industry; hard to maintain, which contributed to the second AI winter |
| 1986 | Rumelhart, Hinton & Williams on back-propagation | Made training multi-layer neural networks practical |
| 1997 | IBM Deep Blue defeats Garry Kasparov | Search-based AI beats the world chess champion |
| 2012 | AlexNet wins ImageNet | Deep CNNs trained on GPUs cut image-recognition error sharply; start of the deep learning era |
| 2013 | word2vec | Words represented as dense vectors (embeddings) that capture meaning |
| 2016 | DeepMind AlphaGo defeats Lee Sedol | Deep learning + reinforcement learning masters Go |
| 2017 | "Attention Is All You Need" (Transformer) | The architecture behind every modern LLM |
| 2018 | BERT (Google) and GPT-1 (OpenAI) | Pre-train on large text, then adapt: the foundation-model approach |
| 2020 | GPT-3 (175 billion parameters) | Showed that a large model can do new tasks from a few examples in the prompt |
| 2022 | ChatGPT | Instruction-tuned chat model brought LLMs to the general public |
| 2023 → | GPT-4, Claude, Llama, Gemini, Mistral, Qwen … | Multimodal models, open-weight models, tool use and agents |
Key terms
- ModelA mathematical function learned from data that maps inputs to outputs.
- Parameters / weightsThe numbers inside a model that are adjusted during training.
- FeatureA measurable property of the input used by the model.
- LabelThe correct answer attached to a training example.
- Loss functionMeasures how far the model's prediction is from the correct answer.
- OverfittingMemorising the training data instead of learning patterns that generalise.
- Foundation modelA large model pre-trained on broad data that can be adapted to many tasks.
- Training cutoffThe date after which a model has no knowledge from its training data.
Common misconceptions
| Misconception | Reality |
|---|---|
| "AI and machine learning are the same thing." | ML is one approach to AI. Rule-based and search-based systems are AI too. |
| "Neural networks work like the human brain." | They are loosely inspired by neurons, but they are mathematical functions trained by calculus, not biological simulations. |
| "The AI understands like a person." | Models learn statistical patterns. They can be very capable, but they can also fail in ways no human would. |
| "More data always means a better model." | Data quality, relevance and labelling matter as much as quantity. Biased data gives biased models. |
Next step: language is the domain where AI has advanced fastest recently. Continue with Natural Language Processing and then How LLMs work.
References
Papers & primary sources
- A. M. Turing (1950). Computing Machinery and Intelligence. Mind, 59(236), 433–460.
- J. McCarthy, M. Minsky, N. Rochester, C. Shannon (1955). A Proposal for the Dartmouth Summer Research Project on Artificial Intelligence.
- D. E. Rumelhart, G. E. Hinton, R. J. Williams (1986). Learning representations by back-propagating errors. Nature, 323, 533–536.
- A. Krizhevsky, I. Sutskever, G. E. Hinton (2012). ImageNet Classification with Deep Convolutional Neural Networks (AlexNet). NeurIPS.
- D. Silver et al. (2016). Mastering the game of Go with deep neural networks and tree search. Nature, 529, 484–489.
Books
- Artificial Intelligence: A Modern Approach (4th ed.) — Stuart Russell, Peter Norvig. aima.cs.berkeley.edu
- Deep Learning — Ian Goodfellow, Yoshua Bengio, Aaron Courville (MIT Press, 2016). Free online: deeplearningbook.org
- Hands-On Machine Learning with Scikit-Learn, Keras & TensorFlow — Aurélien Géron (O'Reilly)
- The Master Algorithm — Pedro Domingos (non-technical overview of ML approaches)
Courses & videos
- 3Blue1Brown: Neural networks (visual introduction)
- Elements of AI (free introductory course, University of Helsinki)
- AI For Everyone — Andrew Ng, DeepLearning.AI
Some other interesting things to know:
- Visit my pages on Machine learning & Deep learning
- Visit my website on Data engineering
- Visit my website on Data, Big Data, Data-modeling, Datawarehouse, SQL, cloud-compute.