Amazon AWS Certified Generative AI Developer - Professional AIP-C01 Practice Test 16
Question 150
A custom model server truncates some prompts much earlier than expected. The client estimates token counts with a tokenizer from a different model family. Which implementation fix should be made?
- Use the served model’s compatible tokenizer and account for input, reserved output and special tokens under its context contract.
- Count only ASCII characters because character length equals tokens for all languages.
- Increase the maximum response tokens without checking the input context boundary.
- Send multiple copies of the prompt in parallel, assuming concurrency increases each request’s context size.
Explanation
Correct Answer
A:Token counts depend on the exact tokenizer and message framing. Align the client and model server on tokenizer version, role delimiters, multimodal overhead and the permitted context window. Reject or chunk oversized prompts explicitly, and test multilingual and long-document examples. Record token accounting with the model artifact so a deployment update cannot silently change truncation behavior. Validate total input token accounting and provide a controlled truncation error rather than silent data loss.
Incorrect Answers
B:Characters and tokens differ widely across words, languages and special sequences. ASCII-only length also ignores non-ASCII content that may still be supported. Use the correct tokenizer rather than an approximate character proxy.
C:Output allocation may consume available context and can worsen an already oversized request. A larger response budget does not restore missing prompt sections. Measure the true combined token requirement. Input token and image payload limits belong to the model contract, not client-side character assumptions.
D:Concurrency lets a service process multiple requests but does not change the maximum context of one inference call. Duplicating oversized prompts repeats the same error while consuming additional capacity. Input token and image payload limits belong to the model contract, not client-side character assumptions.
Question 151
A chat-client adapter concatenates system instructions, tool responses and customer messages into a single user-role string. Security tests show that tool content can override the intended application policy. Which correction is required?
- Preserve documented system, user, assistant and tool role distinctions and message order in the model request.
- Append another warning to the same merged user string and trust it to outrank tool text.
- Allow retrieved pages to prepend new system messages whenever they contain a policy heading.
- Increase context size to include more untrusted content in the merged string.
Explanation
Correct Answer
A:Serving APIs commonly attach distinct semantics to messages and content blocks. Keep application-controlled instructions separate from user input and tool data, preserving correct order and trust boundaries. Validate the adapter against conflicting prompts and retrieved malicious strings. Model role priority is not a substitute for backend authorization, but incorrectly merged roles remove an important defensive layer. Test whether a hostile tool response can override an application-level system requirement.
Incorrect Answers
B:An extra warning inside the same user-role payload has no guaranteed priority over other merged text, particularly adversarial tool output. Restore role structure and independently restrict tools rather than rely on repeated prose.
C:Retrieved content is evidence, not an authority allowed to define application instructions. Turning a policy-looking paragraph into a privileged role creates a direct injection path. Keep source content within its documented data role.
D:A larger context permits more content but does not restore instruction hierarchy. It can even expose the model to more malicious text. Correct serialization and enforce permissions separately. Structured message roles matter because trusted instructions must not be flattened into tool output.
Question 152
A GPU endpoint performs well with one request but fails with out-of-memory errors at high concurrent sequence counts. The base weights fit comfortably when idle. Which capacity factor should be tested?
- The growth of attention KV cache and runtime batching memory with active sequences and context length.
- Only the count of unused CPU threads on the caller device.
- Whether the service’s domain name includes the word model.
- Only the number of output characters visible in the web page after generation.
Explanation
Correct Answer
A:Model weights are only one part of inference memory. Concurrent sequences allocate attention key/value cache and intermediate buffers; long contexts and large batches can exhaust accelerator memory. Load-test request mixes, batch policies, max concurrent tokens and cache allocation. Adjust capacity, batching or context limits and measure latency to find a safe operating envelope. Repeat the test at peak load with measured token lengths and batch sizes.
Incorrect Answers
B:Caller CPU thread counts do not explain GPU memory exhaustion on the model server. Investigate server-side cache and batching telemetry, then optimize the actual memory bottleneck. Peak concurrency changes the memory consumed by per-request KV caches and batching queues.
C:Domain naming is an administrative label without an effect on tensor allocations or active sequence state. OOM needs runtime diagnostics and capacity engineering, not label changes. Peak concurrency changes the memory consumed by per-request KV caches and batching queues.
D:Visible character count is at most a rough output proxy and omits input context, model tokens and cached attention state. Measure actual token allocations and concurrent sequence memory rather than browser rendering length.
Question 153
A regulated application invokes a supported Bedrock model from private subnets. Network policy forbids sending invocation traffic through a public internet route. Which AWS configuration should be evaluated?
- Use supported interface VPC endpoints for the required Bedrock APIs with appropriate endpoint and IAM policies.
- Attach an internet gateway to the private subnets and claim TLS makes the path private.
- Copy production credentials into the request payload to avoid network authorization.
- Rename the model deployment to include private so the API automatically changes routes.
Explanation
Correct Answer
A:PrivateLink-backed interface endpoints can provide private network connectivity to supported Bedrock control and runtime APIs, subject to region and service availability. Configure private DNS, security groups, route and endpoint policies, and least-privilege IAM; then verify DNS resolution and network path from the actual subnet. An endpoint alone does not authorize arbitrary model use. Try the same call using an intentionally unapproved model to confirm IAM denies it.
Incorrect Answers
B:TLS encrypts traffic in transit but does not by itself satisfy a policy requiring private connectivity. An internet gateway enables public routing, contrary to the intended boundary. Use supported private endpoints and test network controls.
C:Credentials in payloads create data-exposure risk and do not alter whether requests traverse public or private networks. Authentication and network reachability are distinct controls; use managed credentials and private service access.
D:A display name does not provision network interfaces or change DNS resolution. Establish the actual VPC endpoint and verify the traffic path rather than relying on naming conventions. IAM resource authorization must constrain model invocations even when the network route is private.
Question 154
A public-facing GenAI API receives bursts that exceed its model invocation quota. Retries from many clients amplify throttling and some sessions consume far more tokens than expected. What should the gateway enforce?
- Bound concurrent model calls and token budgets by caller or workload class, with controlled backoff on throttling.
- Allow unlimited parallel retries so one eventually succeeds.
- Disable accounting because measuring tokens makes requests slower.
- Increase prompt length for rejected requests to help the model recognize their priority.
Explanation
Correct Answer
A:Admission control should limit concurrent calls, requests and token budgets before reaching the constrained model endpoint. Distinguish interactive and background workloads, apply jittered bounded retries for 429/throttled responses, and monitor p95 latency and queueing. This prevents retry storms and protects fair access; quota increases may still be needed for sustained legitimate demand. Load-test transient 429 responses to establish a finite retry budget with jitter.
Incorrect Answers
B:Unbounded retries multiply load when a service is already at capacity, increasing failures and cost. Use backoff, retry limits and clear caller feedback rather than flood the endpoint. Respect throttling headers and track attempts so retries do not overload the inference quota.
C:Token usage is central to capacity and cost control for foundation models. Suppressing metrics hides which clients exhaust quotas. Monitor consumption with appropriate privacy controls and implement per-class budgets. Respect throttling headers and track attempts so retries do not overload the inference quota.
D:Adding prompt text increases the very resource pressure causing throttling and cannot guarantee preferential scheduling. Priority must be handled in the gateway or queue using explicit workload classes, not inferred from long prose.
Question 155
A custom SageMaker model endpoint expects a binary tensor payload. An integration sends a plain English string as text/plain and receives a deserialization error. Which client correction is required?
- Serialize inputs in the model’s documented tensor format with the expected content type and serving handler contract.
- Grant the caller full administrator permissions because all deserialization errors are IAM failures.
- Raise the model temperature to convert prose into binary tensors automatically.
- Retry the same text/plain request without changes until a warm container accepts it.
Explanation
Correct Answer
A:The client must match the inference container’s input schema, serialization, shape and Content-Type expectations. Use the trained model’s serializer or an application adapter to create compatible tensors; confirm dimensions and response Accept types. Test a known-good sample before changing traffic. Authentication may be successful even when the payload format is invalid. Validate one correct and one malformed tensor against the endpoint before general rollout.
Incorrect Answers
B:Administrator permissions do not change the bytes a model handler expects. Broader access would be a security regression and leave the serialization error. Diagnose the response category before altering IAM.
C:Sampling parameters operate after a valid model invocation, and some tensor models do not expose a text temperature setting. The request must first be correctly encoded under the endpoint contract.
D:A deterministic input format mismatch will not be fixed by repeated retries or container warming. Correct serialization and validate with a single controlled request, then address any separate capacity issues.
Question 156
A customer-service application runs a powerful expensive model for every request, although most inquiries only need a simple approved category label. How should the team optimize cost safely?
- Route validated straightforward cases to a tested smaller model and escalate uncertain or complex cases according to measured rules.
- Randomly send half of all requests to an untested free model without evaluating errors.
- Discard category validation so every response is accepted regardless of format.
- Use the most expensive model for all traffic and increase its generated-token budget.
Explanation
Correct Answer
A:A model cascade can use a smaller appropriately evaluated classifier for simple categories while preserving escalation to stronger reasoning for ambiguous or high-impact cases. Define confidence/risk thresholds on held-out data, compare cost per accepted resolution and monitor drift. Normalize output labels and ensure the smaller tier cannot bypass safety or authorization requirements. Compare the routed cohorts by acceptance rate and full per-resolution cost.
Incorrect Answers
B:Random routing may reduce price but can lower quality unpredictably, especially for difficult or sensitive questions. Evaluate model capability and route based on known requirements rather than chance alone. Route requests by complexity while measuring real accuracy and escalation overhead.
C:Format validation is needed to make category results usable by downstream systems. Accepting arbitrary labels can misroute cases or trigger wrong actions. Keep a constrained schema and a fallback for uncertain outputs.
D:Uniform large-model use fails to exploit known differences in task complexity, and extra output tokens can worsen cost. Compare operational quality and escalation rates, not simply choose the highest-capacity model by default.
Question 157
A search benchmark reveals that only three of ten required policy documents appear in the top twenty results, although the first few hits are mostly relevant. Which metric best captures the missed required documents?
- Recall at k using an independently labeled relevant-document set.
- Only response generation temperature.
- The average number of characters in the retrieved titles.
- Precision at k alone, without measuring how many relevant documents were not retrieved.
Explanation
Correct Answer
A:Recall at k measures how many known relevant documents the system retrieved among all relevant documents for a query. With a judged relevance set, it exposes missing policies even when the returned subset looks accurate. Evaluate the retrieval scope, metadata filters and vector/keyword balance, and compare results before and after index changes. Freeze the reference question set so future index changes have a reliable baseline.
Incorrect Answers
B:Temperature changes generated output variability, not the number of relevant documents a retriever returns. Diagnose the retrieval stage independently of text synthesis. Recall at k needs annotated relevant policies, not merely a fluent answer or top result.
C:Title length is unrelated to whether mandatory documents appear among search results. A brief title can identify a crucial policy, while a long irrelevant title can dominate a proxy measure.
D:Precision at k reports the fraction of returned results that are relevant; it can be high while many required documents are absent. The stated concern is coverage of all relevant material, so recall is essential.
Question 158
A developer sends a public photo URL as an ordinary text string to a text-only completion endpoint and expects the model to identify objects in the photo. What correction is necessary?
- Use a vision-capable model and its documented image content block or supported image reference input.
- Increase text-model output-token length so the endpoint can infer the photo pixels from the URL characters.
- Convert the URL to uppercase and assume that enables remote image fetching.
- Use a larger text embedding without transmitting image content or derived visual features.
Explanation
Correct Answer
A:A URL string tells a model where an image might be stored but does not give a text-only endpoint the visual pixels. Select a deployment with supported image understanding and serialize image bytes or a documented image reference appropriately. Verify access to the image, content type, size and consent before claiming the result reflects the photo.
Incorrect Answers
B:Output capacity does not grant image-reading capability. The model can produce a fluent invented description without receiving the file. Supply the supported modality rather than increase generation length. An image-capable model needs a correctly typed image block rather than a string containing a link.
C:Letter casing is a text transformation; it cannot turn a string into a multimedia input. It may even break a case-sensitive path. The API contract determines accepted image representations. An image-capable model needs a correctly typed image block rather than a string containing a link.
D:Text embeddings represent text for similarity or retrieval, and do not inherently inspect photo pixels. A suitable vision encoder or multimodal model must process the actual image evidence. An image-capable model needs a correctly typed image block rather than a string containing a link.
Question 159
A multitenant document assistant stores all customer embeddings in one vector service. A team proposes relying on a prompt telling the model not to reveal other tenants’ documents. What must be enforced instead?
- Apply identity-bound tenant filtering and access controls in retrieval and storage, with encryption and isolation appropriate to the workload.
- Use a strong warning in the system prompt as the only access boundary.
- Increase top-k so the model sees documents from more tenants and can decide what is private.
- Give all tenant users read permission on the entire embedding store and mask final text.
Explanation
Correct Answer
A:Vector records and source documents require actual authorization, not voluntary model compliance. Bind every query to a verified tenant identity, enforce filters or physical partitions before returning candidates, and test cross-tenant denials. Encrypt stored data and network paths appropriately, protect index administration and audit retrieval. A correct prompt is useful for behavior but not security. Use negative cross-tenant queries and inspect both context and audit traces for leakage.
Incorrect Answers
B:An instruction can be ignored or manipulated by retrieved content. Once unauthorized passages enter context, downstream leakage can occur even without direct quotation. Enforce resource permissions in the vector and source services.
C:Expanding candidates makes cross-tenant exposure more likely and adds latency and token cost. Identity isolation should determine eligible documents before semantic ranking, not after the model has seen them. Cross-tenant retrieval requires authorization filters before the model receives retrieved passages.
D:Giving global read access violates least privilege and enables direct exfiltration outside the chat interface. Output redaction cannot protect a database already exposed to callers. Restrict retrieval and administrative roles at source.
Question 160
A model-routing system uses a cheap general model for customer questions. It fails on complex contract interpretation, but the team wants to avoid invoking a costly reasoning model for every simple request. What control should trigger escalation?
- Validated confidence or risk thresholds and measured task complexity, with a stronger fallback when the lower tier is unsuitable.
- Always choose the cheapest model, even when it repeatedly gives wrong contract answers.
- Always choose the largest model for every request without measuring its effect on cost or quality.
- Route questions by input character count alone and assume length uniquely predicts legal complexity.
Explanation
Correct Answer
A:Evaluate routing signals on a labeled set of easy, difficult and high-impact requests. Define escalation for low confidence, source ambiguity or consequential legal interpretation; validate the stronger model separately and require source-grounded outputs. Monitor error and escalation rates over time. This preserves inexpensive handling of appropriate simple cases without sacrificing risky decisions to an unsuitable tier. Compare error rates on demanding cases against cost savings from simpler requests.
Incorrect Answers
B:Low unit price is not useful when correction work and incorrect legal guidance create larger total costs. The first tier must meet explicit accuracy and risk thresholds, with fallback on known weaknesses.
C:Uniform powerful-model use may improve some hard cases but wastes capacity on routine classifications. Compare full cost per accepted result and select task-appropriate tiers under measured criteria. Measure difficult-query accuracy before sacrificing a needed reasoning capability for unit-cost savings.
D:Long questions can be simple and short questions can require difficult legal reasoning. Length may be one feature but is not an adequate proxy for ambiguity or impact. Validate routing against task outcomes and error patterns.