AI AI Engineer: NLP and Large Language Models 1 — Questions and Answers
Question 1: What is the 'attention mechanism' in transformer-based models?
- A method to prune unimportant neurons
- A mechanism that computes weighted relationships between all positions in a sequence (Correct answer)
- A technique for data augmentation in NLP
- A regularization method for language models
Correct answer: A mechanism that computes weighted relationships between all positions in a sequence
Attention computes a weighted sum of values based on query-key similarity, allowing the model to focus on relevant parts of the input regardless of distance.
Question 2: What does 'tokenization' mean in the context of NLP preprocessing?
- Converting text to audio
- Splitting raw text into discrete units (tokens) for model input (Correct answer)
- Encrypting text data before storage
- Removing stopwords from a document
Correct answer: Splitting raw text into discrete units (tokens) for model input
Tokenization breaks raw text into tokens (words, subwords, or characters) that are then mapped to numeric IDs for model processing.
Question 3: What is 'fine-tuning' a large language model (LLM)?
- Training an LLM from scratch on domain data
- Continuing training of a pretrained LLM on task-specific data to adapt its behavior (Correct answer)
- Compressing an LLM using quantization
- Prompting an LLM with few-shot examples
Correct answer: Continuing training of a pretrained LLM on task-specific data to adapt its behavior
Fine-tuning updates the pretrained model's weights on a smaller, task-specific dataset, adapting general language understanding to a specific domain or task.
Question 4: What is 'prompt engineering' when working with LLMs?
- Writing code to deploy LLMs
- Designing input text to guide LLM behavior without modifying model weights (Correct answer)
- Training the LLM on a new dataset
- Optimizing LLM inference speed
Correct answer: Designing input text to guide LLM behavior without modifying model weights
Prompt engineering involves crafting input instructions, examples, and context to elicit desired outputs from an LLM without changing its parameters.
Question 5: What is Retrieval-Augmented Generation (RAG)?
- A method for training LLMs on retrieval tasks
- Combining an LLM with a retrieval system to ground responses in external documents (Correct answer)
- A technique for compressing LLM context windows
- Using multiple LLMs in an ensemble
Correct answer: Combining an LLM with a retrieval system to ground responses in external documents
RAG retrieves relevant documents from an external knowledge base and injects them into the LLM's context, enabling up-to-date, grounded responses.
Question 6: Which evaluation metric measures the overlap between generated text and human reference text using n-gram precision?
- ROUGE
- BLEU (Correct answer)
- Perplexity
- F1 Score
Correct answer: BLEU
BLEU (Bilingual Evaluation Understudy) measures n-gram precision between generated and reference text, commonly used for machine translation and text generation evaluation.
What is the 'attention mechanism' in transformer-based models?