📘 CodingMarble Learn

Generative AI: How Machines Create Text, Images and More

Generative AI is artificial intelligence that creates new content (text, images, audio, video, code) after learning patterns from huge amounts of example data. A large language model writes one token at a time by giving each possible next token a probability and choosing one; temperature controls how adventurous that choice is. Image models such as diffusion models start from noise and remove it step by step, guided by a prompt; GANs pit a generator against a discriminator. Generative AI helps with writing, design, coding, translation and learning, but it can invent facts (hallucinate), repeat bias, enable deepfakes and raise privacy and copyright problems. Responsible use means checking facts, being open about AI use, protecting personal data and respecting creators.

🎬 Step-by-step story

  1. Most AI sorts or predicts, like spotting spam. Generative AI creates something new: text, pictures, music, video or code.
  2. To learn, the model studies huge amounts of examples and tunes millions of numbers inside a neural network until it captures the patterns.
  3. A text model writes one piece at a time. It gives each possible next word a probability and picks one, then repeats.
  4. An image model starts with random noise and removes a little noise many times, guided by your prompt, until a picture appears.
  5. Generative AI can be wrong, biased or misused for fakes. Use it responsibly: check, credit, protect privacy and be kind.
  6. Free play: choose a prompt, change the temperature and press Generate. Watch how the chosen word changes.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

How is generative AI different from normal AI?

Normal AI mostly sorts or predicts labels; generative AI makes new content.

Does the AI copy from the internet when it answers?

It learnt patterns during training and generates new text from them; it is not pasting a page (though it can sometimes repeat famous text).

How can a machine "write"?

By choosing a likely next token again and again, using probabilities.

Why does the same prompt give different answers?

The next word is picked by chance from the probabilities; temperature sets how much chance.

How does it make a picture that never existed?

It starts from noise and removes noise step by step, steered by the prompt.

Why can AI be biased if it is a machine?

It learns from human-made data; unfair patterns in the data come out in the results.

What is generative AI?

Generative AI is a kind of artificial intelligence that creates new content similar to what it learnt from. Older AI is mostly discriminative: it sorts or predicts (spam or not, cat or dog). Generative AI makes a new email, a new picture of a cat or a new tune.

TypeCreatesExample use
Text (large language models)answers, essays, summaries, codechatbots, writing helpers
Imagespictures from a text promptposters, concept art
Audiospeech, music, sound effectsvoice-overs, read-aloud
Videoshort clipsanimation drafts

How does it work?

1. Training on huge data

A neural network with millions or billions of adjustable numbers (parameters or weights) is shown enormous amounts of data. Each time its guess is wrong, the numbers are nudged. In the end the model holds patterns, not a library of copies.

2. Text: predicting the next token

A large language model (LLM) splits text into tokens (words or parts of words). Given a prompt, it gives each possible next token a probability, picks one, adds it, and repeats. Temperature controls the choice: low temperature picks the most likely word (safe, repetitive); high temperature lets less likely words in (creative, more errors).

3. Images: diffusion and GANs

A diffusion model learns to remove noise from pictures. To create, it starts from pure noise and removes noise step by step, steered by the prompt. A GAN (generative adversarial network) has two parts: a generator makes fakes and a discriminator tries to catch them; both improve by competing.

Prompts

A good prompt is clear and specific: give the task, the audience, the format and any limits. "Explain gravity to a 10-year-old in 3 short sentences" works better than "gravity".

Uses of generative AI

Generative AI is a helper, not an expert you trust blindly. A person must stay in charge of important decisions.

Risks and ethics, and responsible use

Risks

Responsible use (C-C-P-K)

  1. Check facts with trusted sources.
  2. Credit: say when you used AI; follow your school's rules; respect creators.
  3. Protect privacy: never share passwords, addresses, phone numbers or others' photos.
  4. Kind: never use AI to bully, fake or deceive.

Try it: the 3D and at home

In free play, choose prompt 1, set temperature to 0.2 and press Generate five times. Then set 2.0 and do it again. How many different words did you get each time?

At home: play "human language model" with your family. One person says a sentence start ("Every morning I…"); each person adds one word in turn. Notice how you choose likely words, just like an LLM. Then try adding only surprising words: that is high temperature!

Key formulas and definitions

Worked examples

1. Is a spam filter generative AI? Is a chatbot that writes a poem generative AI?

The spam filter sorts emails into two groups, so it is discriminative. The poem-writing chatbot creates new text, so it is generative AI.

2. A model gives next-word probabilities: tea 0.45, coffee 0.40, milk 0.15. At very low temperature, which word is chosen? At high temperature?

Low temperature: almost always "tea" (the highest). High temperature: any of the three can be chosen, and "milk" becomes more likely than before.

3. Improve this prompt: "Write about water."

For example: "Write 5 bullet points for Class 8 students on how to save water at home, with one example each." It states task, audience, format and length.

4. A chatbot gives a book reference that you cannot find anywhere. What happened and what should you do?

It is likely a hallucination: the model produced a believable but made-up reference. Check with a library catalogue or trusted website and do not use it unless verified.

Common mistakes

Practice quiz

1. Generative AI is AI that:
2. An LLM writes text by:
3. A diffusion image model starts from:
4. When AI confidently states something false, it is called:
5. Which is responsible use?

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is generative AI in simple words?

AI that learns from lots of examples and then makes new text, pictures, music, video or code.

What is a large language model?

A generative AI model trained on huge amounts of text that writes by predicting the next token, one at a time.

Is it safe for students to use generative AI?

Yes, with care: follow school rules, check facts, never share personal data, and use it to learn, not to copy.

Where this is taught

CBSE (India)Class 9Part B: Introduction to Generative AI
CBSE (India)Class 12Generative AI

Learn first

Learn next

Related lessons

All Computer Science lessons