متقدم
البحث فيالملخصات
طريقة البحث
  • الكلمات تجد عناوين الدروس والنص والكود. صفِّ حسب النوع (أدلة، دورات، برامج، كتب) أو ابقَ في هذا الكتاب.
  • book:rhcsa و ch:8 يضيّقان البحث؛ ‎#code يجد الكلمة داخل أوامر الدروس فقط.
  • "كلمتان" تجد العبارة بالضبط.
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث
جرّب:

الدورة 7الاسم في الدورة: Generative AI and LLMs: Architecture and Data Preparation

Generative AI and LLMs: Architecture and Data Preparation

Course 7 of 13 in the IBM AI Engineering certificate. What generative AI is and why it matters now.

Course page: Coursera

  • 6 الدروس
  • 0 الأوامر

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

$ مستخدم عادي# بصلاحية root (أو مع sudo)

7.1

What the course covers

What generative AI is and why it matters now.

  • The main model families: RNN, transformer, GAN, VAE and diffusion.
  • How large language models such as GPT and BERT help with NLP tasks.
  • What a hallucination is, and how to reduce it.
  • The libraries and tools used to build LLM applications.
  • How to prepare text data: tokens, data loaders, quality and diversity.
ModuleMain focus
Module 1 · about 3 hoursGenerative AI Architecture: value of gen AI, model families, gen AI for NLP, hallucination, tools
Module 2 · about 3 hoursData Preparation for LLMs: tokenization, data loaders, data quality and diversity

7.2

Module 1: Generative AI Architecture

Generative AI Architecture: value of gen AI, model families, gen AI for NLP, hallucination, tools.

  • Generative AI makes new content: text, images, code or audio.
  • A model learns patterns in training data. Then it makes new samples.
  • RNN reads data step by step and keeps a hidden state. It is slow and weak on long context.
  • Transformer uses attention. It reads all tokens in parallel. GPT and BERT are transformers.
  • GAN has two parts: a generator makes data, a discriminator judges it. Good for images.
  • VAE learns a small hidden space. You sample from that space to make new data.
  • Diffusion learns to remove noise step by step. Strong for image generation.
  • GPT is decoder-only. It predicts the next token. Good at writing and generating.
  • BERT is encoder-only. It reads text in both directions. Good at understanding and classification.
  • LLM means large language model. It has many parameters and a lot of training text.
  • Common NLP tasks: classify, summarize, translate, answer questions, write code.
  • Hallucination: the model gives a confident answer that is false. The cause is weak data or no real source.
  • Fix ideas: give real documents (RAG), ask for sources, keep a human check.
  • Tools: PyTorch, Hugging Face Transformers, LangChain and IBM watsonx.

7.3

Module 2: Data Preparation for LLMs

Data Preparation for LLMs: tokenization, data loaders, data quality and diversity.

  • A token is a piece of text: a word, a subword or a character.
  • The tokenizer splits text into tokens. Then it gives each token an integer ID.
  • The vocabulary is the list of all tokens that the model knows.
  • Word-level tokens: easy to read, but the vocabulary is big and new words fail.
  • Character-level tokens: small vocabulary, but the sequences become very long.
  • Subword tokens are a balance. They can build new words from parts.
  • BPE (byte pair encoding) merges the most frequent pairs of characters, step by step.
  • Token IDs go into an embedding table. The output is a dense vector.
  • Padding makes all sequences in a batch the same length. Truncation cuts text that is too long.
  • A data loader feeds data to the model in small batches. In PyTorch use Dataset and DataLoader.
  • Set the batch size and shuffle the data. Shuffling stops the model from learning the file order.
  • Data quality: remove noise, duplicates and private data. Check the labels.
  • Data diversity: use many domains, languages and styles. This lowers bias.
  • Good training needs enough data, clean data and diverse data.

7.4

Check yourself

Answer each question first, then open it to check the answer.

1What does generative AI do? a) It only sorts database tables · b) It creates new content such as text or images · c) It only stores files · d) It only tests software

b) It creates new content such as text or images. Gen AI makes new text, images, code and audio from a prompt.

2Which model family has a generator and a discriminator? a) VAE · b) RNN · c) n-gram · d) GAN

d) GAN. The GAN generator makes samples, the discriminator says if they look real.

3Which model type removes noise step by step to build an image? a) Diffusion model · b) BERT · c) Linear regression · d) k-means

a) Diffusion model. A diffusion model learns to undo noise, step by step.

4GPT models are mainly... a) encoder-only · b) decoder-only · c) encoder-decoder with no attention · d) rule-based systems

b) decoder-only. GPT reads left to right and predicts the next token.

5BERT is mainly an... a) GAN model · b) image model · c) encoder-only model · d) SQL engine

c) encoder-only model. BERT reads the full text in both directions, so it understands context.

6What is a hallucination? a) A very slow tokenizer · b) A type of data loader · c) A missing token · d) A confident answer that is not true

d) A confident answer that is not true. The answer sounds sure, but the fact or number is wrong.

7Which action can reduce hallucination? a) Delete all training data · b) Ground the answer in real documents · c) Increase the batch size only · d) Ask for longer answers

b) Ground the answer in real documents. Real documents give the model a source to copy from.

8What is a token? a) A GPU · b) A whole document · c) A piece of text: a word, a subword or a character · d) A loss function

c) A piece of text: a word, a subword or a character. Text is cut into small pieces before the model sees it.

9What does a tokenizer do? a) It splits text into tokens and gives each one an ID · b) It trains the model · c) It cleans the database · d) It draws the charts

a) It splits text into tokens and gives each one an ID. The tokenizer makes tokens, then maps them to numbers.

10Which method merges the most frequent pairs of characters? a) BLEU · b) PCA · c) SGD · d) BPE

d) BPE. BPE starts from characters and merges frequent pairs.

11Why do we add padding? a) To make all sequences in a batch the same length · b) To delete short sentences · c) To grow the vocabulary · d) To stop the training

a) To make all sequences in a batch the same length. The model needs a fixed shape, so short rows get padding.

12What is the job of a data loader? a) It sets the GPU clock · b) It writes the final report · c) It feeds batches of data to the model · d) It scores the quiz

c) It feeds batches of data to the model. The loader groups samples into batches and can shuffle them.

13Why does data diversity matter for LLM training? a) It speeds up the tokenizer only · b) It makes the files smaller · c) It removes the need for tokens · d) It helps the model in many domains and cuts bias

d) It helps the model in many domains and cuts bias. Many domains and styles make the model more general and less biased.

7.5

Study and exam tips

Learn the five families: RNN, transformer, GAN, VAE and diffusion.

  • Keep this pair in mind: GPT = decoder, BERT = encoder.
  • Follow the data path: text → tokens → IDs → embeddings → model.
  • For data questions, think of three words: clean, diverse, enough.
  • Read each question twice. Words like "only" and "always" are often wrong.