🚀 AI Interview Questions with Answers (Part 10)
91. What is prompt engineering, and why is it important?
Prompt engineering is the practice of designing clear and effective prompts to guide Large Language Models (LLMs) toward producing accurate and relevant outputs.
Benefits:
- Improves response quality
- Reduces hallucinations
- Increases consistency
- Enhances productivity
- Enables better AI workflows
Example: Instead of asking "Explain SQL," ask "Explain SQL joins with examples suitable for beginners."
---
92. What is zero-shot prompting, and when is it used?
Zero-shot prompting is a technique where an AI model performs a task without being provided with any examples.
The model relies solely on its pre-trained knowledge and the user's instructions.
Example:
Prompt: "Translate the following sentence into French: Good morning."
Use Cases:
- Translation
- Summarization
- Classification
- Question answering
---
93. What is one-shot prompting, and how does it work?
One-shot prompting provides the AI model with a single example before asking it to perform the task.
This example helps the model understand the expected format or style.
Example:
Example:
- Positive → "I love this product."
Now classify:
- "This movie was amazing."
The model learns from one example before responding.
---
94. What is few-shot prompting, and why is it effective?
Few-shot prompting provides several examples to demonstrate the desired task before asking the model to generate an answer.
Providing multiple examples helps improve accuracy and consistency, especially for complex tasks.
Applications:
- Text classification
- Data extraction
- Code generation
- Customer support automation
---
95. What is Chain of Thought (CoT) prompting?
Chain of Thought (CoT) prompting encourages the model to reason through a problem step by step before producing the final answer.
It improves performance on tasks involving logical reasoning, mathematics, coding, and multi-step decision-making.
---
96. What are hallucinations in Large Language Models (LLMs)?
Hallucinations occur when an LLM generates information that sounds convincing but is factually incorrect, misleading, or completely fabricated.
Ways to reduce hallucinations:
- Use Retrieval-Augmented Generation (RAG)
- Provide clear prompts
- Verify outputs using trusted sources
- Ground responses with external data
---
97. What is Retrieval-Augmented Generation (RAG), and how does it work?
Retrieval-Augmented Generation (RAG) combines information retrieval with text generation.
How it works:
1. Receive a user query.
2. Search a knowledge base or vector database.
3. Retrieve relevant documents.
4. Provide the retrieved context to the LLM.
5. Generate a more accurate and grounded response.
Benefits:
- Reduces hallucinations
- Uses up-to-date information
- Improves answer accuracy
---
98. What is a vector database, and why is it used in AI?
A vector database stores embeddings (numerical vector representations) instead of traditional rows and columns.
It enables efficient similarity search across large datasets.
Popular vector databases:
- Pinecone
- Chroma
- Weaviate
- Milvus
- FAISS
Applications:
- Semantic search
- RAG systems
- Recommendation engines
- Image search
---
99. What is semantic search, and how does it differ from keyword search?
Semantic search retrieves information based on the meaning and context of a query rather than exact keyword matches.
Keyword Search
- Matches exact words.
- Limited understanding of context.
Semantic Search
- Understands intent and meaning.
- Uses embeddings and vector similarity.
- Returns more relevant results even when exact keywords differ.
---
100. What are embeddings, and why are they important in NLP?
Embeddings are dense numerical vectors that represent words, sentences, documents, or images in a way that captures their semantic meaning.
Items with similar meanings have similar vector representations.
Applications: