AI Ultimate AI Engineer 2 ā Questions and Answers
Question 1: Which technique reduces LLM hallucinations by grounding responses in retrieved documents?
- Fine-tuning on curated datasets
- Retrieval-Augmented Generation (RAG) (Correct answer)
- Increasing model temperature
- Chain-of-thought prompting
Correct answer: Retrieval-Augmented Generation (RAG)
RAG retrieves relevant documents at inference time and conditions the model's output on that grounded context, reducing hallucinations.
Question 2: In transformer attention, what does the 'key' vector represent?
- The output projection
- What information the token is querying for
- What information the token offers for matching (Correct answer)
- The positional encoding offset
Correct answer: What information the token offers for matching
Keys represent what each token offers; queries ask what is needed, and the dot product between them scores relevance.
Question 3: Which Python library is the industry standard for distributed training of large neural networks across multiple GPUs?
- Scikit-learn
- PyTorch + DeepSpeed/FSDP (Correct answer)
- TensorFlow Lite
- Keras Sequential API
Correct answer: PyTorch + DeepSpeed/FSDP
PyTorch with DeepSpeed or FSDP (Fully Sharded Data Parallel) is the standard for large-scale distributed training.
Question 4: What is the primary purpose of a vector database like Pinecone or Weaviate in an AI system?
- Storing raw training datasets in columnar format
- Caching API responses for cost reduction
- Enabling fast approximate nearest-neighbor search over embeddings (Correct answer)
- Serving as a message queue between microservices
Correct answer: Enabling fast approximate nearest-neighbor search over embeddings
Vector databases index high-dimensional embeddings and support ANN search, enabling semantic retrieval at scale.
Question 5: An AI model deployed to production shows increasing latency over time without code changes. What is the most likely cause?
- Model weights gradually change during inference
- Data drift causing more complex inputs
- Memory leak in the inference server (Correct answer)
- Transformer attention is O(n³) in time
Correct answer: Memory leak in the inference server
A gradual latency increase without code changes typically points to a memory leak accumulating in the serving process over time.
Question 6: Which metric best evaluates the quality of generated text when a reference answer exists?
- Perplexity on training set
- BLEU or ROUGE score (Correct answer)
- Inference throughput (tokens/sec)
- GPU utilization percentage
Correct answer: BLEU or ROUGE score
BLEU and ROUGE measure n-gram overlap between generated and reference text, making them standard for generation quality evaluation.
Question 7: What is 'temperature' controlling in LLM sampling?
- The learning rate during fine-tuning
- The randomness of token selection by scaling logits (Correct answer)
- The maximum context window length
- The number of attention heads used at inference
Correct answer: The randomness of token selection by scaling logits
Temperature divides the logits before softmax: lower values make the distribution sharper (more deterministic), higher values flatten it (more random).
Which technique reduces LLM hallucinations by grounding responses in retrieved documents?