GenAI Lesson 1 – What is Generative AI | Dataplexa

What is Generative AI?

Let’s start like an engineer.

Imagine you’re working at a company and your manager says: “Build a system that can write emails, summarize documents, generate images, and answer customer questions.”

Classic AI can help classify things (spam vs not spam), predict numbers (sales forecast), or detect objects (cat vs dog). But it doesn’t naturally create new content from scratch. That’s where Generative AI (GenAI) changes the game.

The Real Meaning of “Generative”

Generative AI is a type of AI that can generate new outputs that look like things humans create: text, images, audio, code, video, and even structured data.

The key difference is:

Instead of predicting a label, GenAI predicts the next piece of content.

For text, that “next piece” is usually the next token (word/part of a word). For images, it could be the next denoising step. For audio, it could be the next chunk of waveform.

Why GenAI Suddenly Became “Big”

GenAI existed before, but it wasn’t practical. What changed?

  • Much larger datasets (internet-scale text and images)
  • Better model architectures (Transformers)
  • Huge compute (GPUs/TPUs, distributed training)
  • Better training techniques (instruction tuning, RLHF)

So GenAI isn’t magic. It’s the result of scale + architecture + training.

GenAI in One Sentence (Developer Version)

GenAI is a probability machine that learns patterns from data and then samples from those patterns to create new content.

That word “samples” matters. If you always pick the single most likely next token, you get boring output. If you sample intelligently, you get creativity.

Mini Build: The Simplest “Generator” (So You Feel It)

Before we talk about giant LLMs, let’s build a tiny generator. Not because it’s powerful — but because it teaches the exact mindset.

Goal: learn word-to-word transitions from a small dataset and generate a sentence.


import random
from collections import defaultdict

text = "genai learns patterns from data and generates new content from patterns"
words = text.split()

# Build a simple transition map: word -> possible next words
next_words = defaultdict(list)
for i in range(len(words) - 1):
    next_words[words[i]].append(words[i+1])

print(next_words["from"])
  

What you did here is extremely important: you converted raw text into a probabilistic transition memory. Large models do the same idea — just at massive scale with neural networks.

['data', 'patterns']

Now let’s generate a sentence by repeatedly picking a next word. This is the “generation loop” concept you’ll see again and again in GenAI.


def generate(start="genai", steps=12):
    word = start
    out = [word]
    for _ in range(steps):
        choices = next_words.get(word)
        if not choices:
            break
        word = random.choice(choices)
        out.append(word)
    return " ".join(out)

print(generate())
  

This is not “AI” like ChatGPT — but it demonstrates the core: learn patterns → sample next step → repeat → produce output.

genai learns patterns from data and generates new content from patterns

So How Do Real GenAI Models Do This?

Real GenAI models don’t store next words in a dictionary. They learn a function:

f(context) → probability distribution over next token

Then they sample from that distribution and keep going.

That’s why GenAI is often described as “next-token prediction” for text models. It sounds simple — but at scale it becomes unbelievably powerful.

What GenAI Can Generate Today

In practice, GenAI systems generate:

  • Text: emails, reports, chat responses, stories
  • Code: scripts, functions, tests, SQL queries
  • Images: product mockups, posters, concept art
  • Audio: voice, music, sound effects
  • Video: clips, animations, editing assistance

But the most valuable systems are not “generate anything”. They are built to solve a business problem.

GenAI vs Traditional AI (What You’ll Do Differently at Work)

Traditional ML:

  • You define features and train a model to predict labels
  • Output is usually a number or class
  • Evaluation is clear (accuracy, precision, recall)

GenAI:

  • You define behavior and constraints (prompt, tools, retrieval, guardrails)
  • Output is free-form content
  • Evaluation needs humans + automated metrics + monitoring

This is why GenAI engineering is not just ML engineering. It’s a system discipline: prompts, retrieval, tools, safety, cost, latency.

Where People Go Wrong (And Why Projects Fail)

Most beginners think: “Just call an API and we’re done.”

In real apps, you must handle:

  • Hallucinations (model says confident wrong things)
  • Data privacy and security
  • Cost per request and scaling
  • Latency (user experience)
  • Bad prompts, messy inputs, unclear instructions

Dataplexa’s goal is to make you job-ready by teaching GenAI as systems engineering.

Mini Build: A “Prompt” as a Specification

A prompt is not “asking nicely”. A prompt is a specification that tells the model:

  • Role
  • Goal
  • Constraints
  • Output format

Let’s create a strong prompt template you can reuse.


def build_prompt(task, constraints, format_hint):
    return f"""
You are an expert assistant.
Task: {task}

Constraints:
{constraints}

Output format:
{format_hint}
""".strip()

prompt = build_prompt(
    task="Write a short professional email asking for a project update",
    constraints="- Keep it under 80 words\n- Be polite\n- Include a clear deadline",
    format_hint="Subject: ...\nBody: ..."
)

print(prompt)
  

This is how GenAI becomes controllable. Not by hoping for the best — but by writing a specification.

You are an expert assistant. Task: Write a short professional email asking for a project update Constraints: - Keep it under 80 words - Be polite - Include a clear deadline Output format: Subject: ... Body: ...

What You’ll Build in This Module

You won’t just “learn GenAI”. You will learn the full stack:

  • Embeddings + similarity search
  • Vector databases
  • Transformers and LLMs
  • Fine-tuning techniques (LoRA, quantization)
  • Function calling and tool use
  • RAG (retrieval-augmented generation)
  • Agents, memory, evaluation, monitoring, cost control

By the end, you should be able to design a GenAI product, not just write prompts.

Practice

In simple words, what does Generative AI do?



Most text GenAI models work by predicting what?



What acts like a specification for model behavior?



Quick Quiz

GenAI mainly focuses on:





What makes outputs more creative than always picking the top token?





In real products, GenAI is best treated as:





Recap: GenAI generates new content by learning patterns from data and sampling outputs, and real GenAI apps are engineered as full systems.

Next up: We’ll trace the evolution from classic AI to modern GenAI and understand why foundation models changed everything.