Course menuAIP-C01

Exams / AIP-C01 / Token efficiency (context pruning, prompt compression, response limits) / Question 1

AIP-C01 practice question: Token efficiency (context pruning, prompt compression, response limits)

Operational Efficiency and Optimization for GenAI Applications A free question from our original AIP-C01 practice exam. Try it, then open the answer to see why each option is right or wrong.

Last verified against current AWS documentation ·How we write our questions

A SaaS company runs a ticket summarizer that writes a short summary of each support conversation for the agent's sidebar. The summary box holds about 150 words, and the summarizer calls a model on Amazon Bedrock through the Converse API.

The model often writes several paragraphs, and most of that text is cut off by the box or ignored by agents. Output tokens are billed, and the company handles about 400,000 conversations each day.

The summarizer must keep each summary within the box, reduce the output token charges, and avoid cutting a summary off in the middle of a sentence where possible.

Which change meets these requirements?

Choose one answer.

  1. A. Lower the temperature to 0.1 so that the model writes more concisely, and keep the existing prompt unchanged, because lower randomness usually makes answers shorter.
  2. B. Set maxTokens in the inference configuration close to the box's length, and add a prompt instruction for a summary of about 150 words, so replies stay short and cost less.
  3. C. Raise maxTokens to 4,000 so the model can finish its thoughts, and let the application cut the summary down to the box size after the reply arrives.
  4. D. Send the full conversation history with every request, plus a list of all earlier summaries, so that the model can keep each new summary consistent with the ones written before it.
Show the answer and explanation

Answer: B

  • A. Wrong: Temperature changes how the model chooses words, not how long its reply is, so the summaries may stay long. The option sets no limit on output, so the billed output tokens do not change. Learn more: Inference request parameters (opens in a new tab)
  • B. Right: The maxTokens limit caps the output tokens billed for each reply, and the prompt instruction keeps most replies close to the box size. A reply that reaches the cap can end mid-sentence, so the limit should leave some margin. Learn more: Inference request parameters (opens in a new tab)
  • C. Wrong: A higher limit allows longer replies, which increases the output tokens billed on every conversation. Cutting text in the application discards the model's work and does not reduce the tokens already billed.
  • D. Wrong: Extra history increases the input tokens on every call and does nothing to limit the length of the new summary. It moves the cost to a different place rather than reducing it.

Explanation

Setting maxTokens caps the output tokens billed for each reply, and a prompt instruction for about 150 words keeps most replies inside the box. Lowering temperature does not shorten replies, a higher limit raises cost, and extra history adds input tokens to every call.

Study

Keep practicing

Answer questions with a score at the end, or practice just this topic with the explanation after each one. No sign-up needed.

Want more on Token efficiency (context pruning, prompt compression, response limits)? The 5 full-length practice sets have 5 more Token efficiency (context pruning, prompt compression, response limits) questions, 375 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets