Lý thuyết
20 phút
Bài 3/6

Giới thiệu Generative AI

Tổng quan về Generative AI - công nghệ đang thay đổi thế giới

🤖 Giới thiệu Generative AI

Generative AI là một trong những bước tiến lớn nhất trong lịch sử AI. Bài này giới thiệu các khái niệm cơ bản và ứng dụng.

Generative AI là gì?

Definition

Generative AI là các hệ thống AI có khả năng tạo ra nội dung mới:

  • Text, code, documents
  • Images, videos
  • Audio, music
  • 3D models
Diagram
graph LR
    P[Prompt/Input] --> G[Generative AI]
    G --> T[Text]
    G --> I[Images]
    G --> A[Audio]
    G --> C[Code]

Lịch sử phát triển

NămMilestone
2014GANs (Generative Adversarial Networks)
2017Transformer architecture
2018GPT-1, BERT
2020GPT-3
2021DALL-E, Codex
2022ChatGPT, Stable Diffusion
2023GPT-4, Claude, Gemini
2024GPT-4o, Claude 3.5, multimodal models

Large Language Models (LLMs)

Kiến trúc cơ bản

Diagram
graph TD
    I[Input Text] --> T[Tokenizer]
    T --> E[Embeddings]
    E --> TR[Transformer Layers]
    TR --> O[Output Probabilities]
    O --> G[Generated Text]

Các LLMs phổ biến

ModelProviderĐặc điểm
GPT-4oOpenAIMultimodal, reasoning mạnh
Claude 3.5AnthropicDài context, an toàn
GeminiGoogleMultimodal, tích hợp Google
Llama 3MetaOpen source
MistralMistral AIEfficient, EU-based

Cách LLMs hoạt động

1. Tokenization

Text được chia thành tokens:

Text
1"Hello world" → ["Hello", " world"]
2"Xin chào" → ["X", "in", " ch", "ào"]

2. Next Token Prediction

LLM dự đoán token tiếp theo:

Text
1Input: "The cat sat on the"
2Predictions:
3- "mat" (30%)
4- "floor" (25%)
5- "chair" (20%)
6- ...

3. Sampling

Chọn token dựa trên probability và temperature:

  • Temperature = 0: Luôn chọn highest probability (deterministic)
  • Temperature = 1: Random sampling theo distribution
  • Temperature > 1: More random/creative

Prompting Basics

Zero-shot Prompting

Text
1Prompt: "Dịch sang tiếng Anh: Tôi yêu Việt Nam"
2Output: "I love Vietnam"

Few-shot Prompting

Text
1Prompt:
2"Phân loại sentiment:
3Text: 'Sản phẩm tuyệt vời!' → Positive
4Text: 'Dịch vụ quá tệ' → Negative
5Text: 'Giao hàng nhanh, đóng gói đẹp' → "
6
7Output: "Positive"

Chain of Thought

Text
1Prompt: "Giải bài toán sau, giải thích từng bước:
2Nếu một cửa hàng có 50 táo, bán 30%, còn lại bao nhiêu?"
3
4Output:
5"Bước 1: Tính số táo bán
650 × 30% = 50 × 0.3 = 15 táo
7
8Bước 2: Tính số táo còn lại
950 - 15 = 35 táo
10
11Đáp án: Còn lại 35 táo"

Ứng dụng thực tế

1. Content Creation

  • Viết blog, marketing content
  • Tạo social media posts
  • Draft emails, reports

2. Code Generation

  • Viết code từ requirements
  • Debug và explain code
  • Code review và optimization

3. Data Analysis

  • Phân tích và tóm tắt data
  • Generate insights
  • Create visualizations

4. Customer Service

  • Chatbots thông minh
  • Auto-reply emails
  • FAQ generation

5. Education

  • Personalized tutoring
  • Explain concepts
  • Generate exercises

Hạn chế của Gen AI

Limitations
  1. Hallucinations: Tạo ra thông tin sai
  2. Knowledge Cutoff: Không biết events mới
  3. Context Limits: Giới hạn input length
  4. Bias: Reflect biases trong training data
  5. No Real Understanding: Pattern matching, không "hiểu"

Responsible AI

Best Practices

  1. Verify Output: Luôn kiểm tra thông tin
  2. Human in the Loop: Người review trước publish
  3. Transparency: Cho biết khi dùng AI
  4. Privacy: Không share sensitive data
  5. Bias Awareness: Nhận thức về potential bias

Công cụ và Platforms

APIs

  • OpenAI API (GPT-4)
  • Anthropic API (Claude)
  • Google AI (Gemini)

No-code Tools

  • ChatGPT
  • Claude.ai
  • Google AI Studio
  • Microsoft Copilot

Development Frameworks

  • LangChain
  • LlamaIndex
  • Semantic Kernel

Bài tập thực hành

Hands-on Exercise

Explore GenAI:

  1. Tạo account trên ChatGPT hoặc Claude
  2. Thử các prompting techniques:
    • Zero-shot
    • Few-shot
    • Chain of thought
  3. So sánh kết quả với các prompts khác nhau

Ghi chú: Quan sát khi nào model "hallucinate" và cách prevent


Tiếp theo

Trong các bài tiếp theo, chúng ta sẽ đi sâu vào:

  • Prompt Engineering nâng cao
  • Sử dụng APIs
  • Build applications với LangChain

Tài liệu tham khảo