Why a Bedrock Model Stops Before Token Limit: Stop Sequences
Exhibit
Refer to the exhibit.
```json
{
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 500,
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}
```A developer sends the above request to Amazon Bedrock with Anthropic Claude. The model returns a response that stops before reaching 500 tokens. What is the most likely reason?
Quick Answer
A response ending well short of the requested max token count, without an error, almost always means the model hit a defined stop sequence rather than running out of budget. A stop sequence is a specific string configured in the request — something like a custom delimiter or a conversational marker such as a new-Human-turn indicator — that tells Bedrock to halt generation the instant that exact string appears in the output, regardless of how many tokens have been used so far. This is a deliberate control mechanism, not a failure: it lets a caller define a clean, predictable endpoint for the model's response rather than relying purely on a token count, which is especially useful in multi-turn or structured-output scenarios where the model might otherwise keep generating past the point where the useful content ends. It's worth distinguishing a stop sequence match from the response simply reaching its max_tokens limit, since the two produce different stop reasons in the API response, and from a content filter intervention, which would also halt generation but for a different, safety-related reason. Any scenario describing an unexpectedly short completion where the max token limit clearly wasn't reached is pointing at a stop sequence as the mechanism.
⚠ Common exam trap
AWS often tests the distinction between a stop sequence and a token limit; the trap here is that candidates confuse a premature stop with exceeding the token limit, but a stop sequence causes an early halt while a token limit would cause truncation at the limit.
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
✓
The model reached a stop sequence
The model stopped before reaching 500 tokens because the request likely included a stop sequence (e.g., `\n\nHuman:` or a custom stop token) that matched the generated output. When a stop sequence is encountered, Bedrock immediately halts generation, even if the token limit has not been reached. This is the most direct explanation for a premature stop.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The temperature is set too high
Why it's wrong here
Temperature influences randomness, not when generation stops.
- ✗
The model is not trained on this topic
Why it's wrong here
The model can still generate an answer even if not fully trained; early stop is not due to lack of training.
- ✓
The model reached a stop sequence
Why this is correct
The model can stop early when it identifies a natural endpoint.
- ✗
The token limit is exceeded
Why it's wrong here
The token limit is 500; the response is shorter, so not exceeded.
Go deeper
Related to this question
About these practice questions
One of 619 original AIF-C01 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
2 more ways 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 developer invokes an Amazon Bedrock model and receives the above response. What does the 'stopReason' field indicate?
easy- A.The model encountered an error.
- ✓ B.The model reached a defined stop sequence.
- C.The model hit the maximum token limit.
- D.The model stopped due to a safety filter.
Why B: The 'stopReason' field in an Amazon Bedrock response indicates why the model stopped generating tokens. When set to 'stop', it means the model encountered a defined stop sequence (such as a special token like <|endoftext|> or a user-specified string) and halted generation normally. This is the expected behavior for a successful, complete response.
Variation 2. A developer receives the above response from invoking a Bedrock model. Which field indicates that the model completed its response normally?
easy- A.output
- ✓ B.stop_reason
- C.text
- D.role
Why B: The `stop_reason` field in the Bedrock response indicates why the model stopped generating text. A value of `"stop"` or `"end_turn"` (depending on the model) signals that the model completed its response normally, as opposed to hitting a token limit, content filter, or other interruption.
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.