TodayTools

Generative AI flashcards

How AI writes, draws and talks, from tokens to RAG.

Donate
Beginner friendly, starts from zero
Section
How to study
0
Generative AIStart from zero · 1 of 12

What is generative AI, in one plain sentence?

It is computer programs that create new text, pictures or sound when you ask in plain words, such as a birthday message, a poster idea or a summary of a long letter.

Generative = it makes something new.

All topics

Generative AI at a glance

Generative AI is software that creates new text, pictures or sound from a plain-language request.

Like a super-powered autocomplete that has read a huge library and keeps adding what usually comes next.

Words you will meet

Model
The AI's learned skill, saved as a big file of numbers
Training data
The huge pile of examples the model learned from
Token
A small piece of text that the model reads and writes
Prompt
Everything you send the model, including your question
Context window
The most text the model can read at one time
Hallucination
A confident answer that is made up
Temperature
A setting for how safe or adventurous the answers are

The steps

  1. 1. Start from zero (12 cards): What generative AI is, where you meet it, and the words you need before Core basics.
  2. 2. Core basics (16 cards): Tokens, prompts, context, sampling and where models go wrong.
  3. 3. Next steps (16 cards): Attention, embeddings, RAG, structured output, tools and cost.
  4. 4. Go deeper (17 cards): Post-training, reasoning, inference maths, security and evals.
All 12 cards in Start from zero
What is generative AI, in one plain sentence?
It is computer programs that create new text, pictures or sound when you ask in plain words, such as a birthday message, a poster idea or a summary of a long letter.
Before generative AI, what could a computer do with a request like 'write me a thank-you note'?
Almost nothing. Computers followed fixed rules or picked from ready-made options, so writing, drawing and summarising needed a person. Now a tool drafts it in seconds and you check it.
Where do you already meet generative AI in daily life?
Chat assistants, word suggestions on your phone keyboard, suggested email replies, auto captions on videos, and photo editors that fill in a missing background.
What is a simple picture of how a text AI writes?
Think of a super-powered autocomplete that has read a huge library. It keeps adding the piece of text that most often comes next, one small step at a time.
What do model, training, training data and weights mean?
A model is the AI's learned skill, saved as a huge file of numbers called weights. Training is how it learns: it reads masses of examples (training data) and adjusts those numbers.
What is an LLM?
A large language model: a model trained on a vast amount of text to predict what comes next. Chat assistants are built on top of one.
What is a token?
A token is a small piece of text, often a whole short word or part of a longer one. Models read and write in tokens, and AI services count your bill in tokens.
What do prompt and context window mean?
The prompt is everything you send the model: your question plus any instructions or documents. The context window is the most it can read at once, like the size of a desk.
Why can an AI say something false with full confidence?
It writes what sounds likely, not what it looked up. A confident made-up answer is called a hallucination, so names, numbers and quotes always need checking.
What do probability, sampling and temperature mean here?
The model gives each possible next token a chance (a probability) and picks one by those chances, which is sampling. Temperature is a dial: low plays it safe, high takes more risks.
What do you need before you start?
A web browser and a free account on any chat assistant, so you can try ideas as you read. No coding is needed; the few code samples are short and explained.
After this topic, what will you be able to do?
Explain how AI writes text and makes pictures, predict where it will go wrong, pick the right settings for a job, and use it safely with private data.
Generative AI cheatsheet

Sampling settings

  • temperature: 0 to 0.3 Extraction, code, factual answers
  • temperature: 0.7 to 1.0 Drafting, brainstorming
  • top_p: 0.9 Sample only from the top 90% probability mass
  • max_output_tokens Hard cap on reply length and cost
  • stop Strings that end generation early
  • seed Best-effort repeatable sampling where supported

Back-of-envelope maths

  • 1 English word about 1.3 tokens
  • Weights memory params x bits / 8 (70B at 4-bit is about 35 GB)
  • KV cache per token 2 x layers x kv_heads x head_dim x bytes
  • Daily tokens calls x (input + output) tokens
  • Chinchilla ratio about 20 training tokens per parameter

RAG pipeline

  • 1. Chunk Split on headings, a few hundred tokens, small overlap
  • 2. Embed One embedding model for docs and queries
  • 3. Index HNSW in pgvector or a vector store, with metadata
  • 4. Retrieve Hybrid: BM25 plus vectors, fused by rank
  • 5. Rerank Cross-encoder keeps the best 3 to 8
  • 6. Generate Answer only from sources, cite chunk ids
  • 7. Evaluate Retrieval hit rate and answer faithfulness

Model families

  • Decoder-only LLM Text, code, tool calls
  • Reasoning model Maths, planning, hard code; slower and pricier
  • Embedding model Vectors for search and clustering
  • Cross-encoder Reranking query and passage pairs
  • Latent diffusion Images and video from text
  • Speech to text / text to speech Transcripts and voices

Cut cost and latency

  • Model routing Small model first, escalate hard cases
  • Prompt caching Stable prefix first, changing input last
  • Batch API Offline jobs at a discount, results within hours
  • Streaming Lower time to first token
  • Quantisation 8 or 4-bit weights for self-hosting
  • Speculative decoding Draft model plus verify, same output
Donate