Word Embedding, LLM Safety, and RLHF

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

What type of similarity is word embedding capable of capturing?

  • Syntactic
  • Semantic
  • Both semantic and syntactic (correct)
  • Neither semantic nor syntactic

What are the basic units of a sentence considered in the context of language models?

  • Sentences
  • Documents
  • Tokens (correct)
  • Paragraphs

What is a potential risk associated with LLMs due to their broad knowledge?

  • Over-reliance on data
  • Exposure to hazardous and harmful knowledge (correct)
  • Inability to process information
  • Limited creativity

What is a key characteristic of Reinforcement Learning (RL)?

<p>Maximizing cumulative rewards through decision-making (A)</p> Signup and view all the answers

What does RLHF stand for in the context of aligning LLMs?

<p>Reinforcement Learning from Human Feedback (B)</p> Signup and view all the answers

What is a primary function of Reinforcement Learning from Human Feedback (RLHF)?

<p>To reduce harmful and biased responses from LLMs (B)</p> Signup and view all the answers

What mechanism does the Generative Pretrained Transformer (GPT) architecture adopt to better capture the semantic meaning of text?

<p>Self-attention (A)</p> Signup and view all the answers

What is the primary goal of a generative model when using a masked word?

<p>To predict the next word in the sequence (A)</p> Signup and view all the answers

What is a key characteristic of generative language models?

<p>They generate human-like texts (A)</p> Signup and view all the answers

What term is used to describe the phenomenon where LLMs generate unfaithful, fabricated, or nonsensical content?

<p>Hallucination (C)</p> Signup and view all the answers

What is 'in-context hallucination' in the context of LLMs?

<p>Misinterpreting user input leading to distorted responses (A)</p> Signup and view all the answers

Which of the following is a common limitation of LLMs regarding their knowledge?

<p>Outdated information (C)</p> Signup and view all the answers

What is a common challenge for LLMs when dealing with numbers?

<p>Accurate numerical comparisons (A)</p> Signup and view all the answers

What is the term for the maximum length of text a model can generate in one run?

<p>Max Tokens (A)</p> Signup and view all the answers

What might occur if the 'Max Tokens' parameter is set too low?

<p>The output may be incomplete (C)</p> Signup and view all the answers

Which parameter in LLMs controls the number of previous conversation messages the model remembers?

<p>Previous Messages Included (C)</p> Signup and view all the answers

In LLMs, what is the effect of setting a lower temperature?

<p>More predictable and reliable outputs (D)</p> Signup and view all the answers

What is the main goal of prompt engineering?

<p>Improving the output with actions (D)</p> Signup and view all the answers

What is the approach where a model is given a few input-output examples to perform a new task?

<p>In-Context Learning (ICL) (B)</p> Signup and view all the answers

What is a key characteristic of 'Zero-shot prompting'?

<p>Giving no examples (B)</p> Signup and view all the answers

How does Chain-of-Thought (CoT) prompting typically influence the final answer?

<p>It leads to the final answer (A)</p> Signup and view all the answers

What technique involves instructing an AI to act as a specific character?

<p>Persona prompting (B)</p> Signup and view all the answers

What is the primary purpose of Retrieval-Augmented Generation (RAG)?

<p>Ensuring generated content is based on fact information (D)</p> Signup and view all the answers

Which of the following is the first step performed by the RAG system when a user asks a question?

<p>Retrieving relevant documents for the question (D)</p> Signup and view all the answers

What is a key benefit of providing reference text when prompting a language model?

<p>Fewer fabrications (C)</p> Signup and view all the answers

According to the principles of prompt engineering, what should you do with complex tasks?

<p>Split them into simpler steps (A)</p> Signup and view all the answers

What does principle 4 suggest doing?

<p>Use external tools (D)</p> Signup and view all the answers

What is word embedding particularly good at capturing?

<p>Semantic and syntactic similarities (C)</p> Signup and view all the answers

What is a potential consequence of LLMs having no active filtering on training data?

<p>Exposure to biased information (C)</p> Signup and view all the answers

Unlike supervised learning, what does reinforcement learning depend on?

<p>Learning through experience (B)</p> Signup and view all the answers

What kind of knowledge can LLMs potentially provide that may be considered a concern?

<p>Harmful knowledge (A)</p> Signup and view all the answers

What aspect of language does the 'self-attention' mechanism in the transformer models help capture?

<p>Semantic meaning (A)</p> Signup and view all the answers

What may occur if they exist in the training data?

<p>Sensitive information (B)</p> Signup and view all the answers

What is inaccurate about hallucination?

<p>Fabricated content (B)</p> Signup and view all the answers

What is tokenization?

<p>It tokenizes the basics of a sentence (A)</p> Signup and view all the answers

What might the model be able to predict when using masked words?

<p>The next word (D)</p> Signup and view all the answers

Why is factual information important?

<p>To be stable and accurate (C)</p> Signup and view all the answers

Flashcards

Word Embedding

Representing words as numerical vectors to capture semantic and syntactic relationships between words.

Tokens

Words, character sets, or combinations thereof, serving as basic units in a sentence.

LLM Safety Concerns

Concerns regarding possible risks, biases, or misuse arising from LLMs. Often due to un-filtered training data.

RLHF

Reinforcement learning method aligning LLMs with human preferences using feedback to optimize responses.

Signup and view all the flashcards

GPT Architecture

Framework of GPT models utilizing the self-attention to relate different positions of a single sequence.

Signup and view all the flashcards

Self-Attention Mechanism

Mechanism in GPT that focuses on understanding relationships between words in a sentence.

Signup and view all the flashcards

Hallucination in LLMs

Errors in LLMs that results in generating incorrect or fabricated information.

Signup and view all the flashcards

In-context hallucination

When an LLM misunderstands the user input, leading to distorted responses.

Signup and view all the flashcards

Extrinsic hallucination

When an LLM creates fabricated, false information due to insufficient knowledge.

Signup and view all the flashcards

Knowledge timeliness

LLMs' information becoming outdated due to inability to incorporate real-time data after training.

Signup and view all the flashcards

Numbers insensitive

LLMs having difficulties with numerical comparisons caused by tokenization of numbers.

Signup and view all the flashcards

Lack of Common Knowledge

Lack of real-world awareness of concepts or facts commonly known and understood.

Signup and view all the flashcards

Hyperparameter

Parameters set before training that control learning process or model behavior in LLMs.

Signup and view all the flashcards

Max Tokens

Maximum limit on text length generated by the model in a single run, measured in tokens.

Signup and view all the flashcards

Previous Messages Included

Amount of prior conversation that the LLM uses to generate the result.

Signup and view all the flashcards

Temperature

Controls LLM's creativity, with lower values resulting in predictable/reliable outputs and higher in risky/creative.

Signup and view all the flashcards

Prompt Engineering

Technique to improve output by modifying wording, style, assigning context, etc.

Signup and view all the flashcards

Query Crafting

Creating a text that is well-written for an LLM to give the best response.

Signup and view all the flashcards

In-Context Learning

Providing input-output examples to guide the model performance during unseen situations.

Signup and view all the flashcards

Zero-shot learning

Prompting which provides no previous examples.

Signup and view all the flashcards

One-shot learning

Giving the model one example.

Signup and view all the flashcards

Few-shot learning

An initial prompt consisting of several input-output examples of the task.

Signup and view all the flashcards

Chain-of-thought Prompting

Generate reasoning describing each logic step by step, helping the final answer.

Signup and view all the flashcards

Role play and persona

Specifying pre-defined characteristics to get a predicted response.

Signup and view all the flashcards

Retrieval Augmented Generation

Adding retrieval of information combined with language generation.

Signup and view all the flashcards

Clear instructions

Use well defined separation for the data to receive the best response.

Signup and view all the flashcards

Reference text

Provide a defined text that the model relies on to generate the final output.

Signup and view all the flashcards

Split the tasks

Good paradigm for taking large tasks and decomposing them to smaller ones.

Signup and view all the flashcards

Use external websites

Using external websites and datasets for a better context to the response.

Signup and view all the flashcards

Study Notes

Word Embedding Recap

  • Word embedding is a popular way to represent document vocabulary
  • Captures semantic and syntactic similarity, as well as the relationship between words
  • Numerical representation of words, where similar words have mathematically similar embeddings and dissimilar words have mathematically dissimilar embeddings
  • Tokens are the basic units of a sentence; words, character sets, etc

LLM Safety Concerns

  • LLMs possess extensive knowledge, both good and bad
  • Pretraining lacks human oversight
  • Training data not actively filtered
  • Lack of censorship can lead to hazardous and harmful knowledge
  • Sensitive data may leak if it’s present in the training data

RLHF - Aligning LLMs

  • Reinforcement Learning from Human Feedback is a reinforcement learning approach
  • Utilizes human input to fine-tune LLMs
  • RL is a machine learning area focused on maximizing cumulative rewards in situations through decision-making
  • Learning occurs through experience, unlike supervised methods that rely on predefined datasets
  • Agents in RL learn in complex environments by performing actions and adjusting based on rewards or penalties
  • Can reduce biased and harmful responses from LLMs, though not perfectly
  • Safety mechanisms could be bypassed
  • LLM developers must update safety policies

GPT Architecture & Self-Attention

  • GPT adopts a "self-attention" mechanism
  • Helps in capturing the semantic meaning

Generative Language Models

  • Generative model guesses the next word in a series
  • Model generates the next word as if it didn't exist
  • The process is "auto-regressive generation" as it generates the next word based on all the previous ones
  • This model can go beyond the knowledge of people
  • It can make decisions from a vocabulary of human languages
  • It acquires knowledge at an unprecedented rate, learning patterns without labelled data
  • The process is not controlled by humans

LLM Limitations - Hallucinations

  • Hallucinations in LLMs: generates inaccurate, fabricated, inconsistent, or nonsensical information
  • In-context hallucination: LLM misinterprets input, leading to distorted responses
  • Extrinsic hallucination: LLM creates false information due to lack of knowledge

LLM Limitations - Knowledge Timeliness

  • LLMs' information can be outdated
  • LLMs cannot access information or incorporate data after training

LLM Limitations - Numbers

  • LLMs have trouble with numerical comparisons
  • Numbers inside LLMs are tokenized

Hyperparameters in LLMs

  • Max Tokens: Text length the model generates in one run
  • Setting max tokens too low may result in incomplete output
  • Setting max tokens too high may include unnecessary information
  • Previous Messages Included: Number of previous conversation messages the model remembers
  • High value may lead to redundant output and faster burning of your tokens
  • Low value may cause forgetting important information from past conversations
  • Lower temperatures leverage learned patterns
  • Produces predictable and reliable outputs
  • Higher temperatures encourage exploration, increasing the diversity of outputs

Prompt Engineering: Query Crafting

  • Improves output quality
  • Phrasing queries and including context

Prompt Engineering: In-Context Learning

  • In-Context Learning (ICL) uses input-output examples in the model's context as a preamble for performing a task on an unseen example
  • Zero-shot prompting: No example given
  • One-shot prompting: One example provided
  • Few-shot prompting: Typically 3~6 examples
  • Techniques limited by length limits

Prompt Engineering: Chain-of-Thought

  • A sequence of short sentences describes the reasoning, eventually leading to the final answer
  • CoT prompting is beneficial for complicated reasoning tasks, particularly with large models

Prompt Engineering: Role Play

  • "Role play": uses personas and scenarios
  • AI is your actor
  • Specific scenarios are constructed through pretend roles
  • Improves GPT into a high-moral role

Prompt Engineering: RAG

  • Retrieval-Augmented Generation (RAG) combines LLMs with external databases
  • Ensure generated content is based on factual data when generating text

Prompt Engineering; Retrievel Augmented Generation example

  • Question: Who was awarded the 2024 Nobel Prize in Physics and describe their contributions?
  • The model must rely on its trained knowledge
  • Models trained on data until September 2024 may not know about the October 2024 Nobel Prize in Physics
  • Without RAG: The answer is incorrect
  • Without RAG: Admission of Ignorance, or knowledge is outdated
  • Model RAG: System retrieves relevant documents, searching keywords like "2024 Nobel Prize in Physics winner"
  • With RAG: Retrieved information becomes context, replacing pre-trained knowledge to generate response
  • With RAG: Output produces researchers and their artificial information

Prompt Engineering Principles

  • Principle 1: Clear instructions
  • Request brief or expert replies as needed
  • Show the required format if the format is important
  • **Principle 2: Reference Text"
  • Language models can make up responses especially if asked about niche subjects.
  • Reference texts can help prevent the models from fabricating information
  • Principle 3: Split complex tasks
  • Split complex tasks into simpler sub-tasks
  • **Principle 4: External Tools"
  • Compensate for the weaknesses of the model by feeding it the outputs of other tools.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Use Quizgecko on...
Browser
Browser