Generative AI exercises with solutions

45 practice problems from the 15 lessons of the Generative AI course, in lesson order and from easy to hard inside each lesson. Open a problem, write your code and press Submit: the tests run in your browser and nothing is sent to a server.

15 easy problems 15 medium problems 15 hard problems

What generative AI is

3 problems · Read the lesson

Sampling and randomness

3 problems · Read the lesson

Generating text with a Markov model

3 problems · Read the lesson

Tokens and context windows

3 problems · Read the lesson

Next-token prediction

3 problems · Read the lesson

Decoding: temperature, top-k, top-p and beam search

3 problems · Read the lesson

Embeddings and similarity

3 problems · Read the lesson

3 problems · Read the lesson

Retrieval-augmented generation (RAG)

3 problems · Read the lesson

Prompt engineering

3 problems · Read the lesson

Structured output and tool calling

3 problems · Read the lesson

Evaluating generative models

3 problems · Read the lesson

Image generation

3 problems · Read the lesson

Fine-tuning and alignment

3 problems · Read the lesson

Safety and responsible use

3 problems · Read the lesson