Introduction to Artificial Intelligence⚓
Welcome!
All course slides are on this github repository.
The links to all lab sessions and ressources can be found on the left panel.
Do not hesitate to ask us any question on Discord! It is our main communication channel, so check it regularly!
Outline of the Labs⚓
The module is segmented into 5 Labs, following the subjects of the courses.
- Tools, and definition of your project
- Supervised Learning
- Unsupervised Learning
- Deep Learning
- Foundation Models, with an optional extension on adapting a model
Labs are designed following several objectives:
- Provide an introduction to the main frameworks in AI (mainly,
scikit-learn,PyTorch, andHuggingFace). - Present basic tutorials about "how to code an AI".
- Give you the reflexes to compare what you build: a dummy baseline, a classical model, a network you trained yourself, and an open-source foundation model, on the same data with the same metric.
- Integrate the idea that, for most applications, you should use an open-source Foundation model rather than redeveloping your own deep learning model.
In that context, Labs will follow a chronological path on the developments of AI, and require autonomy.
The labs feed your project⚓
The project is the backbone of this course, and the labs are where you build it. Each lab has two halves: a toy example, where you learn the tools on data whose answer you already know, and your own project data, where you apply the very same pipeline to the task your binôme defined. Everything you produce there (numbers, curves, 2D projections, comparison tables) may be used as material for your graded presentations, so it's a best practice to keep your code and write your results down as you go. See the project page for the rules, the calendar and the evaluation criteria.
Nothing is collected at the end of a lab session: we trust you to do the work, and what is graded is your project. You are free to use any external source for help (StackOverflow, Claude, ChatGPT, ...), although we strongly recommend that you try to solve the problem yourself first, and use these external sources only for debugging. These tools can certainly solve most of the labs; but the labs are not the deliverable, and the presentations evaluate your comprehension, which no assistant will have for you.
Using these tools without first trying to solve the problem yourself will not provide you with any pedagogical benefit.
Important Concepts⚓
The course follows one thread: a model is only as good as the representation of the data you feed it. You will see three ways of obtaining that representation, in this order: features you design by hand (sessions 2 and 3), features learned from your own data (session 4), and features reused from a model pre-trained on far more data than you will ever have (session 5).
We put a particular emphasis on this last option, foundation models, presented in detail in lesson 5, because:
- They are powerful and general-purpose feature extractors: they turn an image, a sentence or a sound into a vector in which the concepts you care about are already, largely, separated.
- Many of them are open source, downloadable in three lines, and usable frozen, i.e. without training anything. Spoiler: In lab 5 you will see a classifier with les than 10.000 trained parameters, built on frozen features, beat the network you trained yourself in lab 4.
- Not redeveloping a model that already exists is, most of the time, the reasonable engineering decision.
But three nuances matter as much as the message itself, and they are the reason the other four sessions exist:
- A foundation model is not always the winner. For instance, on a few thousand rows of tabular data, a well-tuned classical model usually will surely win. If your data is far from what the backbone was pre-trained on (the domain gap), the frozen features can be mediocre. You are expected to measure this, not to assume it.
- Any result needs something to be compared to. A score means nothing on its own: it must be read against a dummy baseline (chance level), against a simpler model, and on a test split you never used to make your choices.
- Occam's razor: among models that perform equally well, prefer the simplest. "Equally well" means on the same test split, with the same metric, and with a gap small enough to be noise. The simpler model usually generalizes better, costs far less to train and to run, and is easier to explain, audit and debug. It is a prior, not a theorem: it tells you how to break a tie, not which model is right.
Important
A negative result you diagnose correctly is worth more than a lucky positive one. "The foundation model does not help here, and here is the experiment showing why" is a good result in this course.
Key Definitions⚓
Data and representations⚓
-
Sample, feature, dataset: one sample is one object of your data (a penguin, an image, a recording); its features are the numbers describing it. Throughout the course, a dataset of \(N\) samples with \(d\) features is an array of shape
(N, d): one row per sample, one column per feature. -
Vectors, Matrices, Tensors: representations of data. If you do not feel at ease with concepts of linear algebra, we invite you to study this guide.
-
Distance: because a sample is a vector, two samples can be compared by a distance (the euclidean distance, by default). Most of the methods of this course, from kNN to clustering, only ever look at your data through distances, which is why the units of your features matter.
-
Representation (or features): the version of your data that the model actually sees. Choosing it is most of the work: the same task can be trivial or impossible depending on how the data is represented.
-
Latent space: a vector space produced by a model, in which the data is expected to be better organised than in its original form (e.g. the concept of a cat in an image). You will meet several: the components of a PCA (session 3), the output of an intermediate layer of a network (session 4), and the output of a foundation model (session 5).
-
Embedding: the coordinates of one sample in a latent space, i.e. the vector a model outputs for it. Models that process sequences (image patches, words, audio frames) return one vector per element, so obtaining a single embedding per sample requires a pooling choice (a summary token, or an average), which is yours to make and to justify.
Learning and evaluating⚓
-
Supervised / unsupervised: with labels (you predict a known target) or without (you look for structure). In code, this is the difference between
fit(X, y)andfit(X). -
Generalization, train / validation / test: a model is useful on data it has never seen. The train set is what it learns from, the validation set is what you use to make your choices (hyperparameters, when to stop), and the test set is touched once, at the end. A hyperparameter chosen on the test set destroys the meaning of the test score.
-
Overfitting / underfitting: a model that memorizes its training data (excellent train score, poor test score), or one too simple to capture anything. Comparing train and test scores is the reflex that detects both.
-
Baseline: the score you must beat, and the only thing that makes your own score interpretable. Always compute the trivial one (chance level, or always predicting the majority class).
-
Metric: a number that answers one particular question. Accuracy, F1, silhouette, ARI: each encodes a definition of "good". Choose it from what is costly in your application (a false alarm? a missed detection?), and be able to say what it does not measure.
-
Parameters / hyperparameters: parameters are learned by the algorithm (the weights of a network); hyperparameters are chosen by you (the \(k\) of kNN, the number of clusters, the learning rate).
Foundation models⚓
-
Foundation model: a large model pre-trained once, on very large amounts of data, in a task-agnostic way, and reusable for many downstream tasks (e.g. LLMs for text, DINOv2/DINOv3 for images, CLIP for image–text, wav2vec2 or CLAP for audio).
-
Backbone, checkpoint, model card: the backbone is the pre-trained network without any task-specific head; a checkpoint is one set of published weights (identified on Hugging Face as
owner/name); the model card documents its training data, its intended use and its licence. Read it before using a model. -
Probe: a small classifier (kNN, logistic regression, one linear layer) trained on frozen embeddings. It answers the question "is the information already there in this representation?".
-
Particularization: adapting a general model to your task, along a spectrum: transfer learning (train a head only), fine-tuning (update the backbone, at a very low learning rate), and PEFT / LoRA (train a few small added matrices). See adapt.md.
-
Domain gap: how far your data is from the data the model was pre-trained on. It is the best predictor of whether frozen features will be enough for you.
Ethical Considerations⚓
When discussing Artificial Intelligence (AI), several important ethical considerations must be taken into account. They are not decoration: most of them are questions you can (and should) actually ask about your own project.
-
Environmental Impact: AI algorithms require computing resources to run, which can vary significantly depending on the model's complexity. While small models, such as PCA, have a negligible computational footprint, large foundation models demand extensive processing power. Training and deploying such models, especially in cloud-based environments, contribute to energy consumption and carbon emissions. Even personal usage of AI models can have a non-trivial impact, as highlighted in this paper, which analyzes the computing power required for different tasks and models. Note also that the cost is not only in training: a model used by many people, many times, spends most of its energy at inference. This is measurable, and you will measure it in an extension of lab 5, with tools such as codecarbon.
-
Data Ethics and Intellectual Property: Deep learning models, particularly foundation models, rely on vast amounts of training data. This data may be sourced with or without the explicit consent of its original creators. This raises significant ethical and legal questions: Should AI models be allowed to train on publicly available data without permission? Who holds the intellectual property rights to AI-generated content—its users, developers, or the original data contributors? Current regulations and industry standards on these matters remain evolving, making it an active area of debate. The practical counterpart, for you, is provenance: check the licence of the datasets you use in your project, and read the model card of the checkpoints you download. "I found it on the internet" is not a licence, for data nor for weights.
-
Personal Data and Privacy: many interesting datasets describe people (medical records, messages, faces, voices, traces of activity). Anonymisation is weaker than it looks: samples can often be re-identified by crossing them with other sources, and a trained model can leak fragments of its training data. In Europe, processing personal data is regulated (GDPR): purpose limitation, data minimisation, and a legal basis are not optional. For your project, prefer datasets that are already anonymised and openly licensed for academic use, and ask a teacher if you are unsure.
-
Bias and Fairness: AI models inherit biases present in their training data, which can lead to unfair or discriminatory outcomes. If the data used to train a model reflects societal biases (whether related to gender, race, or socioeconomic status) the AI may perpetuate or even amplify these biases. Addressing this requires careful dataset curation, transparency in AI development, and robust fairness evaluations. Note that a single average score hides this entirely: a model at 95% accuracy can be at 60% on a subgroup that represents 5% of your data. Looking at per-class and per-group performance, as you do with a confusion matrix in the labs, is the cheapest fairness check there is.
-
Reliability and Overreliance: generative models produce fluent, confident and sometimes entirely wrong outputs (hallucinations), and any model is only reliable on data resembling what it has seen. The risk is as much human as technical: automation bias is the well-documented tendency to accept a machine's answer because it comes from a machine. This applies to the assistants you use for these labs, and it is exactly why we ask you to try first and verify after: a solution you cannot explain is a liability, not a result.
-
Accountability, Transparency and Regulation: As AI systems increasingly assist in or automate decision-making processes in critical areas such as healthcare, finance, and law enforcement, questions of accountability arise. Who is responsible when an AI-driven decision leads to harm? Ensuring that AI remains explainable, auditable, and subject to human oversight is crucial for maintaining trust and accountability. This is now also a legal matter: the European AI Act entered into force in 2024 and applies progressively.
-
Misuse and Dual Use: the same technique serves opposite purposes. A face recognition model identifies a missing person and enables mass surveillance; a voice synthesis model restores speech to a patient and produces convincing fraud. The question "who could use this, and against whom?" belongs to the design phase, not to the post-mortem.
Any consideration of these ethical dimensions in your study of AI will contribute to a more responsible and informed approach to AI development and deployment.