Visual overview
Applications send structured instructions and inference controls to a selected foundation model through Amazon Bedrock.
Technical reference
These controls are conceptual mechanisms. Supported fields, names, ranges, and defaults vary by model and provider and must be verified for the selected Bedrock model.
Lower values bias toward more probable tokens; higher values allow more lower-probability choices and usually more variability.
Restricts candidates to the probability mass selected by the model's top-p implementation.
Considers only the k most probable next-token candidates when the selected model exposes this parameter.
Converse exposes this base inference control; the supported maximum depends on the model.
Configured text sequences can tell a supported model to stop generation when encountered.
Demonstrations influence task behavior without changing model weights, but consume context tokens.
Service limits and capabilities can change. Values shown here reflect the current AWS documentation; use the linked official sources below as the source of truth.
A good prompt makes the task and evidence explicit
Prompt engineering is the practice of structuring model input so the model has a clear task, relevant context, constraints, and expected output. A useful prompt often separates system-level behavior, instructions, source material, user data, and output requirements. Specificity matters: asking for a classification with an allowed label set, a summary with a length constraint, or an answer grounded only in supplied passages reduces ambiguity compared with an open-ended request.
Zero-shot prompting supplies the task without examples. One-shot or few-shot prompting adds one or more demonstrations that show how inputs should map to outputs. Templates make these patterns reusable by substituting variables into a stable prompt structure. Examples consume context tokens, so they should be representative and concise. Prompt versioning matters because a seemingly small instruction change can alter quality, latency, token use, or safety behavior.
Sampling parameters shape generation, not factual truth
During text generation, a model scores possible next tokens and samples from a probability distribution. Temperature changes the shape of that distribution: lower values favor high-probability tokens more strongly, while higher values permit more variation. Top-k limits consideration to a fixed number of likely token candidates. Top-p (nucleus sampling) keeps candidates within a cumulative probability mass. These mechanisms can influence diversity, but none makes an answer inherently factual.
Length controls solve a separate problem. `maxTokens` in the Bedrock Converse inference configuration caps generated tokens, and stop sequences can terminate output when specified text is produced. Provider-specific APIs may name fields differently or expose additional controls. AWS explicitly documents that inference parameter defaults and valid ranges depend on the model, so an application must not copy one provider's numerical settings blindly to another.
Prompting is an experiment with security boundaries
Evaluate prompt changes against a stable test set rather than relying on a few successful manual examples. Measure task success, groundedness, format adherence, safety, latency, and token cost for the real workload. Prompts should state uncertainty and evidence rules where useful, but when an answer requires current or private knowledge, retrieval is usually more reliable than trying to encode a large knowledge base into static instructions.
Treat untrusted content as data, not instructions. Documents, web pages, tool responses, filenames, or user-controlled fields can contain prompt injection intended to override application rules. Separate system instructions from retrieved/user content, restrict tools with real authorization, validate model-generated parameters before side effects, and use Guardrails where appropriate. Prompt wording is not an access-control system.
Key takeaways
- 01
Clear instructions, relevant context, demonstrations, and explicit output constraints improve prompt reliability.
- 02
Zero-shot uses no demonstrations; few-shot prompting supplies examples within the context.
- 03
Temperature, top-k, and top-p change token sampling behavior rather than factual grounding.
- 04
Maximum tokens and stop sequences control output length or termination, not creativity.
- 05
Prompt injection must be handled with architectural security controls; prompts themselves do not enforce authorization.
Official AWS sources
Use these primary AWS resources for the source material behind this article and for deeper reference.