Courseiva
Applications of Foundation ModelsmediumMultiple ChoiceObjective-mapped

Controlling Output Length with Prompt Constraints and Max Tokens

A company uses Amazon Bedrock to generate summarizations of lengthy reports. Users report that the summaries are too verbose and include excessive detail. Which prompt engineering technique should the team apply to address this issue?

Quick Answer

Verbosity in a generated summary is usually a prompt-specificity problem rather than a model-capability problem: if the prompt only asks the model to summarize a report without saying how short the summary should be, the model has no signal for how much detail is appropriate and will tend toward including more rather than risking leaving something important out. Adding an explicit constraint, such as specifying a two-sentence limit, removes that ambiguity directly, giving the model a concrete target to satisfy rather than an open-ended request it has to guess the right length for. This is a prompt-engineering fix specifically because it changes nothing about the model itself, its parameters, or the input data being summarized — it works entirely by giving clearer instructions within the same prompt, which is both the fastest fix to try and usually sufficient on its own for output-length problems. It's worth contrasting this with fixes for factual accuracy, like RAG, or for consistent style, like few-shot examples — those solve different problems and would be the wrong lever for a verbosity complaint specifically. Any scenario where output is technically correct but too long or detailed, rather than factually wrong, points to adding explicit output constraints in the prompt.

⚠ Common exam trap

Watch out — candidates often confuse reducing input length (Option A) with controlling output length, or they mistakenly think increasing maxTokens (Option B) can somehow shorten output, when in fact it does the opposite.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Add explicit constraints like 'Provide a concise summary in two sentences.'

Adding explicit constraints like 'Provide a concise summary in two sentences' directly instructs the model to limit verbosity and detail. This prompt engineering technique uses clear, specific instructions to control output length and style, which is the most effective way to address overly verbose summaries without altering model parameters or input data.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Reduce the input context length to limit available information.

    Why it's wrong here

    Truncating input loses information and can degrade summary quality; it does not ensure concise output.

  • Increase the maxTokens parameter in the inference request.

    Why it's wrong here

    Increasing maxTokens allows longer output, which would worsen verbosity, not reduce it.

  • Include few-shot examples of desired outputs.

    Why it's wrong here

    Few-shot examples help with style but may not enforce conciseness; the model might still be verbose if examples are not chosen carefully.

  • Add explicit constraints like 'Provide a concise summary in two sentences.'

    Why this is correct

    Explicit constraints directly guide the model to produce shorter output, addressing verbosity effectively.

About these practice questions

This AIF-C01 question is part of Courseiva's 619-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on AIF-C01

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A data scientist uses Amazon Bedrock. The model responses are too long. Which parameter should they adjust to limit the output length?

medium
  • A.temperature
  • B.max_tokens
  • C.stop sequences
  • D.top_p

Why B: The `max_tokens` parameter directly controls the maximum number of tokens (words or subwords) the model can generate in a single response. By reducing this value, the data scientist caps the output length, preventing overly long responses. Temperature and top_p affect randomness and diversity, not length, while stop sequences define when generation halts but do not enforce a hard token limit.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AIF-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AIF-C01 exam.