
Answer-first summary for fast verification
Answer: Adjust the prompt.
## Detailed Explanation To ensure the LLM's outputs are both **short** and in a **specific language**, the most effective solution is to **adjust the prompt**. Here's why: ### Why Option A (Adjust the prompt) is correct: 1. **Direct Control**: The prompt serves as the primary instruction to the LLM. By explicitly specifying requirements like "Provide a brief recommendation in Spanish" or "Keep responses under 50 words in French," you directly guide the model's output generation. 2. **Language Specification**: LLMs are trained on multilingual data and can respond in various languages when explicitly instructed to do so in the prompt. 3. **Length Control**: You can include clear instructions about response length (e.g., "short," "concise," "one sentence") to influence token generation. 4. **No Model Changes Required**: This approach works with any pre-trained LLM without retraining, fine-tuning, or parameter adjustments. ### Why other options are less suitable: - **Option B (Choose an LLM of a different size)**: Model size primarily affects capability, complexity, and computational requirements—not output length or language specificity. A larger model might generate more verbose responses unless prompted otherwise. - **Option C (Increase the temperature)**: Temperature controls randomness/creativity in token selection (higher values increase diversity). This doesn't directly control response length or language—it might even make outputs less predictable. - **Option D (Increase the Top K value)**: Top-K sampling limits token selection to the K most probable tokens at each step, affecting output diversity but not length or language. Increasing Top-K could make responses more varied but not necessarily shorter or language-specific. ### Best Practice Approach: For production chatbots, combining prompt engineering with: 1. **Clear, explicit instructions** in the system prompt 2. **Examples** of desired output format (few-shot prompting) 3. **Post-processing** (if needed) to truncate overly long responses This prompt-based approach aligns with AWS AI Practitioner best practices for controlling LLM behavior without modifying the underlying model architecture or parameters.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A company is implementing a chatbot for product recommendations using a pre-trained large language model (LLM). The chatbot's responses must be concise and delivered in a particular language.
What solution will ensure the LLM's output quality meets these requirements?
A
Adjust the prompt.
B
Choose an LLM of a different size.
C
Increase the temperature.
D
Increase the Top K value.