SaveMyCert
Log in
5 of 5 free questions left today·for 10 a day
Foundation Model Integration, Data Management, and Compliance

AIP-C01 Data Validation and Processing Pipelines for Foundation Models

25 min readAIP-C01 · Foundation Model Integration, Data Management, and ComplianceUpdated

A data validation and processing pipeline for foundation models is the chain of AWS steps that checks data quality, converts audio, documents, images and tables into model-readable input, formats each request the way its API or container expects, and normalizes or enriches input before a model sees it. This lesson covers AIP-C01 Task 1.3: AWS Glue Data Quality rules, actions and drift detection, Lambda and CloudWatch validation, SageMaker Data Wrangler, Amazon Transcribe, Bedrock Data Automation, SageMaker Processing, tabular preparation, Bedrock InvokeModel, Converse and batch inference formats, SageMaker AI endpoint payloads, conversation formatting, and input enhancement with Lambda, Bedrock and Amazon Comprehend.

What you’ll learn
  • Write AWS Glue Data Quality (DQDL) rules whose strictness matches each requirement, and act on results with row-level quarantine, job failure, CloudWatch metrics or EventBridge score alerts.
  • Detect drift against a dataset's own history with dynamic rules or DetectAnomalies, and know which Glue Data Quality features run only in ETL jobs.
  • Choose between Glue Data Quality, Lambda with CloudWatch custom metrics and SageMaker Data Wrangler for dataset, per-request and exploratory validation.
  • Process audio, documents, images and large corpora with Amazon Transcribe, Bedrock Data Automation and SageMaker Processing, using events instead of polling.
  • Format valid requests for Bedrock InvokeModel, the Converse API (including images, documents and conversations), batch inference JSONL and SageMaker AI endpoint containers.
  • Improve input quality with deterministic Lambda normalization, Bedrock reformatting with structured output, labelled tabular data and Amazon Comprehend entity enrichment.

What is a data validation and processing pipeline for FM consumption?

A data validation and processing pipeline for foundation model (FM) consumption is the set of steps that checks, converts, formats and enriches data before a model reads it, so that every request is valid and every answer is built from clean, unambiguous input. A model cannot tell a truncated article, a mislabelled number or a misheard drug name from the truth; it simply uses what it is given. Fixing data upstream is cheaper and more reliable than asking the model to compensate.

Task 1.3 covers four jobs, and each has its own AWS tools:

JobWhat it meansTypical AWS tools
ValidateProve that data meets quality rules, and stop or quarantine what does notAWS Glue Data Quality, Lambda with CloudWatch metrics, SageMaker Data Wrangler (in SageMaker Canvas)
Process complex dataTurn audio, images, documents and tables into something a model can readAmazon Transcribe, Bedrock multimodal models, Bedrock Data Automation, SageMaker Processing
Format for inferenceBuild the exact request shape each API or container expectsBedrock InvokeModel and Converse, batch inference JSONL, SageMaker AI endpoint payloads
Enhance input qualityNormalize, reformat and enrich input so answers are consistentLambda normalization, a small Bedrock model for rewriting, Amazon Comprehend entities

Neighbouring tasks own the next steps: chunking, embeddings and retrieval belong to Tasks 1.4 and 1.5, prompt templates and prompt governance to Task 1.6, and PII detection and redaction to the safety and privacy material in Domain 3. A recurring rule runs through this whole topic: use deterministic code or a purpose-built service for anything that must be exact, and use a model only for language work.

How do you validate FM-bound datasets with AWS Glue Data Quality?

Validate batch datasets with AWS Glue Data Quality: you declare rules in DQDL (Data Quality Definition Language) and Glue evaluates them, with no validation code to write or maintain. Rules run in two places: inside a Glue ETL job through the Evaluate Data Quality transform (the check sits in the same job that writes the data a knowledge base syncs from), or on a schedule directly against Glue Data Catalog tables. Glue can also generate recommended rules from a table's statistics, which is a starting ruleset to review and enforce, not a profiling report.

Pick each rule's form to match the requirement's tolerance:

RequirementDQDL ruleNote
Every row has a valueIsComplete "body"Completeness "body" > 0.95 would let 5% of rows be empty
Values never repeat (for example a document ID)IsUnique "passage_id"Uniqueness "passage_id" > 0.95 tolerates duplicates
Value is one of a setColumnValues "region" in ["eu", "us"]in is exact membership, not a prefix match
Value follows a patternColumnValues "image_uri" matches "s3://.*"matches takes a regular expression
Mostly true, with a tolerance... with threshold > 0.98The rule passes when more than 98% of rows pass
Text long enoughColumnLength "summary" > 40Length cannot check content or scheme
Enough rows loadedRowCount > 5000A fixed number must be re-tuned as volume grows

Two details catch people out. First, with threshold is the share of rows that must pass, so a 2% tolerance is > 0.98, never > 0.02; it applies to ColumnValues, ColumnDataType and CustomSQL. Second, a threshold only decides whether the rule as a whole passes; it never removes or routes individual records. Checking presence (!= NULL) is not the same as checking allowed values.

How do you act on Glue Data Quality results and catch drift?

Act on Glue Data Quality results with one of four levers: row-level outcomes, the fail-job option, CloudWatch rule metrics or EventBridge score events; catch drift with dynamic rules or DetectAnomalies. The right lever depends on whether you need to handle individual records, stop a run, or alert a person:

NeedMechanism
Quarantine bad records, let good ones continue in the same runRow-level outcomes of the Evaluate Data Quality transform add a per-record result column (DataQualityEvaluationResult, Passed or Failed); filter on it and write failures to a quarantine prefix
Stop the whole run when the dataset is unusableThe transform's option to fail the job when data quality fails (this also blocks the valid records)
Alert on any failed ruleCloudWatch metrics glue.data.quality.rules.passed and glue.data.quality.rules.failed, with an alarm
Alert on the overall scoreAn EventBridge rule on source: aws.glue-dataquality, detail-type Data Quality Evaluation Results Available, with a numeric filter on detail.score, targeting SNS

The evaluation event carries run-level facts (score, rules passed and failed), never the failing records, and it fires after the run, so it cannot route records. Glue publishes these EventBridge events only while the Publish metrics to Amazon CloudWatch option is selected on the evaluation (it is selected by default); clearing it to save cost silently stops the events. AWS service events arrive on the default event bus with no bus policy, and a CloudTrail-based rule matches API calls, a different event shape.

Validating against history instead of constants

Data that feeds a model drifts: volume grows, an upstream bug truncates text. Fixed thresholds need constant re-tuning and miss partial damage, so compare each run with its own history:

  • Dynamic rules state a documented, deterministic formula: RowCount > avg(last(5)) * 0.75 or Mean "token_count" > avg(last(14)) * 0.6. last(k) with k greater than 1 returns a list, so it must be reduced with an aggregate such as avg, min or max; comparing with a bare last(5) is invalid. Choose the aggregate that matches the requirement (average is not minimum).
  • DetectAnomalies (DetectAnomalies "RowCount", DetectAnomalies "Completeness" "summary") records each run's value and, once it has enough history, fails when a new value is anomalous by a learned model. Use it when you want no thresholds at all; use a dynamic rule when auditors need an explicit formula.
  • Analyzers gather statistics (and feed anomaly detection) but cannot assert anything or fail a run.

Dynamic rules and analyzers are supported only in AWS Glue ETL, not in Data Catalog evaluations. To use them on a catalog table, evaluate the table inside an ETL job with the Evaluate Data Quality transform.

When should you validate with Lambda, CloudWatch or Data Wrangler instead?

Use Glue Data Quality for datasets, a Lambda function for single requests or single files, and SageMaker Data Wrangler for interactive exploration. Glue evaluates tables and job outputs; it cannot sit in a synchronous API path or check one uploaded file as it arrives.

SituationFit
Reject a bad API request before the model is calledValidate (length, encoding, schema) in the Lambda function that already calls Bedrock
Check each file as it lands in S3S3 event notification invokes Lambda, which validates and moves failures to a quarantine prefix
Declarative checks on a batch dataset in a job or tableAWS Glue Data Quality
Visual, low-code profiling and trial transforms before any pipeline existsData Wrangler data quality and insights report

Making custom validation observable

Publish rejections as CloudWatch custom metrics. The embedded metric format turns a structured log line from Lambda into a metric, and a reason dimension lets one dashboard show rejections by cause. For a rate alarm (for example, more than 5% of an hour's files fail), publish both the valid and the invalid counts and divide them with metric math; an alarm needs a numerator and a denominator. Do not use the Lambda Errors metric for this: a function that detects an invalid file and quarantines it completes successfully, so Errors counts code faults and retries, not invalid data. Counting Bedrock ValidationException errors only measures failures after the fact and rejects nothing in advance. S3 Lifecycle rules (age, prefix, tags) and Glue crawlers (schema inference) do not validate content.

Data Wrangler for exploration

SageMaker Data Wrangler is now part of SageMaker Canvas. Its data quality and insights report flags missing values, duplicate rows, outliers and class imbalance, and its data flows apply cleanup transforms visually on the same data. It is an exploration tool, not a production gate. To run a finished flow on every full-size export as a repeatable, versioned step, export the flow to SageMaker Pipelines rather than re-implementing the steps by hand in Lambda or rewriting them as DQDL (which checks data but cannot transform it).

How do you process audio, documents, images and mixed media for an FM?

Convert each modality into something the model reads well, using the managed service built for it. The three most-tested building blocks are Amazon Transcribe, Amazon Bedrock Data Automation and SageMaker Processing; direct image and document input to Bedrock models is covered with request formatting below.

Audio: Amazon Transcribe

FeatureWhat it doesUse when
Channel identificationTranscribes each audio channel separately and labels itEach speaker is on their own channel (agent and caller on stereo tracks): attribution is deterministic once you map channel to role
Speaker diarizationInfers speakers from voice and labels them spk_0, spk_1... in the order detectedSpeakers share one mixed channel; labels are ordinal, not tied to a role
Custom vocabularyImproves recognition of domain termsDrug names, product codes or jargon must be correct in the transcript itself
Vocabulary filterMasks, removes or tags listed words in the outputHiding words, never improving recognition

Do not mix separate channels down to mono; that discards the signal that made attribution reliable. Fixing misheard terms in a later prompt only corrects the summary, not stored transcripts that other systems (such as a search index) read. To start the next step without polling, react to the Transcribe Job State Change event in EventBridge (status COMPLETED or FAILED) instead of looping on GetTranscriptionJob.

Mixed documents, images and audio: Bedrock Data Automation

Amazon Bedrock Data Automation (BDA) extracts structured output from documents, images, audio and video through one managed API, so you do not build and orchestrate a separate Textract, Rekognition and Transcribe pipeline per file type. It has two output modes:

  • Standard output: generic insights with nothing to define, such as extracted text, layout elements and summaries for documents, or transcripts for audio.
  • Custom output with blueprints: you define the fields to extract (policy number, incident date, damage description), configured in a BDA project. Use blueprints only when you need your own fields; parsing business fields out of generic summaries is the custom code blueprints remove.

The synchronous InvokeDataAutomation operation is meant for single images; process documents, audio and video with InvokeDataAutomationAsync. Instead of polling GetDataAutomationStatus, set the request's notification configuration with EventBridge enabled and start downstream work from the completion event.

Large-scale preprocessing: SageMaker Processing

A SageMaker Processing job runs your own container (for example OCR or native libraries) on managed, temporary instances: it copies input from S3, runs, uploads output to S3 and releases the instances. It suits hours-long preprocessing that Lambda cannot do, since a Lambda invocation stops at 15 minutes, and it is not a hosting option like a real-time endpoint. Glue Python shell jobs run Python scripts, not your container image.

  • To scale out, set the S3 input's distribution type to ShardedByS3Key, which gives each instance a different subset of objects. FullyReplicated copies every object to every instance, so each one redoes the whole corpus.
  • Only files written under the output's local path (for example /opt/ml/processing/output) are uploaded. Files written elsewhere, such as /tmp, are discarded, and the job still reports Completed. EndOfJob versus Continuous upload mode changes when that path is uploaded, not which path.

How should tabular data be prepared for an FM?

Prepare tabular data by doing the arithmetic in the database and sending the model a small, labelled result. Models are poor calculators and every row costs input tokens, so pasting a raw export into a prompt overflows the context window and still produces wrong totals.

  • Aggregate at the source. Run the sum, count or group-by in Amazon Athena, a database or a query and pass only the result. Vector search is no substitute: top-k similarity returns a few matching rows, not all the rows a total needs.
  • Label every value. Serialize rows as JSON objects or Markdown tables with column names and units (unit_cost_eur, reorder_level), never bare positional values such as 8812,7.50,9.25,40. Wrapping header-less values in a CSV document block leaves them just as ambiguous.
  • Filter rows and project columns. Query only the period a question concerns and only the attributes the answer needs. This is the largest input-token saving, because a document block's contents are still input tokens.

Three adjacent settings are often misapplied here. maxTokens caps the response length; it does not enlarge the context window for input. Splitting rows across several messages does not help either, because the whole conversation must still fit in one context window. Prompt caching saves cost only when later requests reuse an identical prompt prefix; with one question per session there is nothing to reuse. Lowering temperature makes output more repeatable, but it cannot tell the model which unlabelled number is the price.

How do you format requests for Amazon Bedrock models?

Bedrock offers two request styles: InvokeModel, whose JSON body is specific to each model provider, and the Converse API, which uses one request and response shape across supported models. Use Converse when code must stay model-agnostic, so that switching models means changing only the model ID; use InvokeModel when you need a model's native body. The contentType header only says the body is JSON; it never translates one provider's format into another's.

AspectInvokeModel (Anthropic Claude body)Converse
System instructionTop-level system field (the messages array takes only user and assistant turns)system field (a list of content blocks)
Output lengthmax_tokens, requiredinferenceConfig.maxTokens
Common parameterstemperature, top_p, stop_sequences at top level, plus anthropic_versioninferenceConfig: maxTokens, temperature, topP, stopSequences
Model-specific parametersNative fields such as top_kadditionalModelRequestFields (for example {"top_k": 50})

Other providers have their own InvokeModel bodies (Amazon Titan Text uses inputText and textGenerationConfig; Meta Llama uses prompt and max_gen_len), which is exactly why Converse exists. inferenceConfig has no topK member; additionalModelResponseFieldPaths selects extra fields to return, and settings written into the system prompt are just text, not parameters.

Images and documents in Converse

  • Image blocks accept png, jpeg, gif and webp, each up to 3.75 MB and 8,000 pixels per side, and up to 20 images per message. Convert unsupported formats (such as TIFF or BMP) and downscale oversized photos and split large sets across requests.
  • Document blocks accept pdf, csv, doc, docx, xls, xlsx, html, txt and md, up to five documents of up to 4.5 MB each. PowerPoint is not a document format, so convert decks to PDF; rendering a long deck as one image per slide breaks the image cap and turns text into pixels. The format must describe the real file.
  • Images and documents are accepted only in user-role messages, not in assistant messages or the system field.
  • A message that carries a document must also carry a text block in the same message.
  • A document name may contain only letters and numbers, single spaces, hyphens, parentheses and square brackets, so a file name such as q3_report.v2.docx is rejected. AWS advises a neutral name ("Document A"), because the name is a prompt-injection surface.
  • Presigned URLs pasted as text are just text; the model does not fetch them.

Batch inference input

Bedrock batch inference (CreateModelInvocationJob) is asynchronous processing of many prompts from S3, not interactive chat. Its input is JSON Lines in files ending in .jsonl, one object per line (a JSON array in a .json file fails validation), and each record has exactly two parts: recordId and modelInput. The model is chosen once on the job, never per record. modelInput follows the job's model invocation type: the model's native InvokeModel body by default, or a Converse request body when the job's invocation type is Converse, which lets you reuse existing Converse bodies unchanged. AWS does not guarantee that output order matches input order, so set recordId to your business key (Bedrock generates one if you omit it) and join results on it, never on line position or on IDs the model writes into its text.

How do you format payloads for SageMaker AI endpoints?

A SageMaker AI endpoint receives the request body exactly as sent, so the serving container defines the payload schema and the ContentType tells it how to parse the bytes. Nothing translates Bedrock formats. For a container that uses the Hugging Face Text Generation Inference (TGI) schema, as many SageMaker JumpStart text models do, the prompt goes in inputs and generation settings in a parameters object:

{"inputs": "<prompt>",
 "parameters": {"max_new_tokens": 512, "top_p": 0.9}}

Titan, Llama or Converse bodies are valid for Bedrock, which makes them tempting distractors, but this container cannot read them. Large or slow requests also change how you invoke the model:

OptionPayload and timeFit
Real-time endpoint (InvokeEndpoint)Payload carried in the synchronous call; small limit; caller waitsInteractive, low-latency requests
Serverless inferenceSmall payload limit, short timeout, no GPU instancesLight, intermittent CPU workloads
Asynchronous inference (InvokeEndpointAsync)Input read from S3 (InputLocation), payloads up to 1 GB, processing up to one hour, results written to S3Large inputs or long processing where callers should not hold a connection open
Batch transformOffline job over a datasetWhole datasets, not a stream of individual requests

Asynchronous endpoints also solve idle cost and completion signalling. Register the variant with Application Auto Scaling with MinCapacity 0 and a target-tracking policy on ApproximateBacklogSizePerInstance (optionally a step policy on HasBacklogWithoutCapacity to scale out from zero quickly); requests that arrive at zero instances queue until capacity returns. Configure success and error SNS topics in the endpoint's async notification settings so downstream services are told when results are ready, instead of a scheduled function listing the output prefix. Deleting and recreating an endpoint between bursts drops requests instead of queueing them.

How do you format conversations for dialog applications?

Format a conversation as an ordered list of role-tagged messages, oldest first, ending with the new user message, and re-send that history on every call. The Converse API is stateless: a model has no memory between calls, so an application that sends only the latest message gets a bot that forgets. Keeping user and assistant turns as separate messages preserves who said what; flattening the transcript into one block of text in the system field loses that structure. Instructions that define the assistant belong in system, not in a fake first message.

Long sessions eventually exceed the context window, and cost and latency grow with every turn, so history must be bounded without losing facts the user stated early:

ApproachFits the contextBounds cost and latencyKeeps early facts
Recent turns verbatim plus a running summary of older turns (maintained by a small, cheap model and carried in the system prompt)YesYesYes
Drop the oldest turns past a token budgetYesYesNo
Route long sessions to a larger-context modelDelays the limitNoYes
Prompt caching on earlier turnsNoPartly (cheaper repeated prefix, input still grows)Yes

Prompt caching reuses the processing of a repeated prefix to save cost and latency; it does not store a conversation or raise the window limit. maxTokens limits only the reply length. Durable storage of session history (for example in DynamoDB) and clarification workflows are covered with interactive systems in Task 1.6.

How do you enhance input quality before the FM call?

Enhance input by normalizing it with deterministic code, rewriting free-form language with a small model, and adding structured facts extracted by a purpose-built service. The dividing line is simple: if the result must be exactly the same every time, use code; if the task is language, use an FM.

Deterministic normalization in Lambda

  • Convert dates, units and number formats with rule-based code. A model is probabilistic, so it cannot guarantee identical conversions that auditors require.
  • Normalize text before hashing, deduplicating or embedding: apply one Unicode normalization form such as NFC (so a base letter plus a combining accent becomes the precomposed character), and collapse each run of whitespace, including non-breaking spaces, to a single blank and trim the ends. Stripping non-ASCII characters destroys accented text, and an embedding-similarity threshold is a different, lossy kind of deduplication.

Reformatting with a Bedrock model

A small, inexpensive Bedrock model is well suited to expanding shorthand ("rplcd fltr, tstd pmp") into clear sentences or turning free text into a record, before the main model runs. When that record must match a schema every time, supply the JSON schema as structured output in the Converse request's outputConfig.textFormat (type json_schema, with the schema under structure.jsonSchema) on a model that supports it. Stronger prompt wording and temperature 0 only make stray prose less likely, retry loops add code without a guarantee, and guardrails enforce content policies, not formats.

Entity enrichment with Amazon Comprehend

Comprehend capabilityReturnsUse for
DetectEntities (built-in model)Common types such as DATE, LOCATION, PERSON, ORGANIZATION, COMMERCIAL_ITEM, with offsets and scoresGeneral entities passed to the FM as structured fields
Custom entity recognizerYour own entity types, trained from an entity list or annotationsInternal product codes and part numbers the built-in model does not know
DetectKeyPhrasesNoun phrasesToo broad to stand in for a specific entity type
PII entity detectionPersonal data typesPrivacy controls (Domain 3), not product or business entities
DetectDominantLanguage, DetectSyntaxLanguage; parts of speechRouting or grammar, not field extraction or conversion

A custom recognizer analyses single documents in real time only through a Comprehend endpoint, billed for its provisioned inference units over time. Asynchronous analysis jobs are batch work with start-up delay, far too slow for a synchronous request path. For a predictable daily pattern, scale the endpoint's inference units with Application Auto Scaling (scheduled scaling) instead of paying for peak capacity around the clock.

Tip. Task 1.3 questions are production scenarios in which a team's data reaches a foundation model through a pipeline and several requirements apply at once, such as quarantine bad records while good ones continue, alert on the overall score rather than any failed rule, names correct in the stored transcript plus no polling, or keep photos as images plus a valid request. Every option is a real AWS feature, and the wrong ones miss one stated constraint: a ratio rule where every row must pass, a Data Catalog evaluation for an ETL-only feature, diarization where channels are separate, a vocabulary filter where recognition must improve, Lambda for multi-hour work, FullyReplicated input, maxTokens mistaken for context size, or prompt caching with no repeated prefix. Expect symptom-led items that show a rejected request body, an empty S3 output prefix, mismatched batch results or missing EventBridge events and ask for the root-cause fix, and items that hinge on exact request shapes (Claude InvokeModel versus Converse fields, Converse image and document rules, batch JSONL records, a container's payload schema). The recurring judgement is deterministic code or a purpose-built service for anything that must be exact, and a model only for language work.

Key takeaways
  • Match each DQDL rule to its tolerance: IsComplete and IsUnique for 'always', ratios or 'with threshold > x' (the share that must pass) for 'mostly'.
  • Row-level outcomes quarantine individual records; failing the job stops the whole run; EventBridge score events and CloudWatch rule metrics only describe the run, and the events need Publish metrics to CloudWatch selected.
  • Compare drifting data with its own history: Metric > avg(last(k)) * factor for an explicit formula, DetectAnomalies for a learned check; both history features and analyzers run only in Glue ETL.
  • Validate single requests or files in Lambda and publish dimensioned CloudWatch metrics; a handled validation failure is not a Lambda error.
  • Transcribe: channel identification for separate channels, diarization for one mixed channel, custom vocabulary to fix recognition, EventBridge job events instead of polling.
  • Bedrock Data Automation: standard output for generic extraction, blueprints for your own fields; SageMaker Processing with ShardedByS3Key for hours-long container preprocessing.
  • Converse is model-agnostic (inferenceConfig plus additionalModelRequestFields); InvokeModel needs each provider's native body; batch inference needs .jsonl records of recordId plus modelInput, joined on recordId.
  • SageMaker endpoints accept the container's own schema; large or slow requests go to asynchronous inference, which can scale to zero and notify through SNS.
  • Re-send ordered, role-tagged history every turn and bound it with recent turns plus a running summary.
  • Use code when the result must be exact, an FM when the task is language, and Comprehend (built-in or custom recognizer behind an endpoint) to add structured entities.

Frequently asked questions

What is the difference between IsComplete and Completeness in AWS Glue Data Quality?

IsComplete "column" passes only when every row has a value in that column, so it suits fields that must always be present, such as an article body or a chunk's text. Completeness "column" > 0.95 is a ratio rule that passes when more than 95% of rows have a value, so it tolerates some missing data. The same split applies to IsUnique (no repeats at all) and Uniqueness (a share of distinct values).

Why are my AWS Glue Data Quality EventBridge events not arriving?

AWS Glue Data Quality publishes its Data Quality Evaluation Results Available events to EventBridge only when the Publish metrics to Amazon CloudWatch option is selected on the evaluation. It is selected by default, so clearing it to reduce monitoring cost silently stops the events. The events arrive on the default event bus and need no bus policy.

Should I use speaker diarization or channel identification in Amazon Transcribe?

Use channel identification when each speaker is recorded on a separate audio channel, such as an agent and a caller on stereo tracks, because it transcribes each channel separately and attribution is deterministic. Use speaker diarization when speakers share one mixed channel; it infers speakers from their voices and labels them spk_0, spk_1 and so on in the order detected, so the labels are not tied to a role.

When should I use Bedrock Data Automation blueprints instead of standard output?

Amazon Bedrock Data Automation standard output returns generic results, such as extracted text, layout and summaries for documents or transcripts for audio, with nothing to configure. Custom output with blueprints is for when you need your own fields, such as a policy number or incident date, returned as structured output across documents, images and audio without writing parsing code.

What are the image and document limits in the Amazon Bedrock Converse API?

A Converse message can include up to 20 images (png, jpeg, gif or webp, each up to 3.75 MB and 8,000 pixels per side) and up to five documents (pdf, csv, doc, docx, xls, xlsx, html, txt or md, each up to 4.5 MB). Images and documents are accepted only in user-role messages, a message with a document must also contain a text block, and a document name may use only letters, numbers, single spaces, hyphens, parentheses and square brackets.

Why don't Amazon Bedrock batch inference results line up with my input file?

Amazon Bedrock batch inference does not guarantee that output records come back in the same order as the input lines. Each input line in the .jsonl file has a recordId and a modelInput, and the output echoes the recordId, so set recordId to your own business key (such as a ticket ID) and join results on it instead of on line position.

When should I use SageMaker asynchronous inference instead of a real-time endpoint?

Use SageMaker asynchronous inference when request payloads are large (up to 1 GB, read from Amazon S3) or processing takes minutes (up to one hour), and callers can collect results later instead of holding a connection open. Asynchronous endpoints can also scale to zero instances when idle and send success and error notifications through Amazon SNS, so nothing has to poll the output location.

Should I normalize FM input with Lambda code or with a Bedrock model?

Use deterministic Lambda code for anything that must come out exactly the same every time, such as date and unit conversions, Unicode normalization and whitespace cleanup. Use a small Amazon Bedrock model for language tasks, such as expanding shorthand into sentences or reformatting free text into a record, and supply a JSON schema as structured output when that record must always match the schema.

Sign up free to mark lessons complete, bookmark topics and track your exam readiness.

Spotted a mistake in this lesson?