AWSAWS Certified Generative AI Developer - Professional2026-101.2 Select and configure FMs
Match LoRA serving to adapter demand
Completed by the knowledge check
Learning objective
Deploy domain-adapted FMs on SageMaker AI with LoRA adapters; compare merged and dynamically loaded weights. Choose a serving topology that matches how many adapted behaviors you need and how frequently requests switch between them.
Core idea
Low-Rank Adaptation (LoRA) trains a relatively small adapter while keeping the base model frozen. Serving can combine those changes into the base weights or apply a selected adapter during inference. The adapter is a learned change tied to a compatible base model, not a portable prompt or an independent foundation model.
The main deployment decision is whether to optimize for one stable adapted model or share one base model across many adapted behaviors. Merged weights simplify a fixed serving path. Dynamic adapters reduce repeated base-model copies but add selection, compatibility, memory, and load-state concerns.
How it works
Preserve the compatibility tuple
Record the exact base-model revision, tokenizer, adapter artifact, inference container, and serving configuration. The adapter’s small size does not remove those dependencies. A differently named model with a similar parameter count is not proof of compatibility.
Evaluate the adapted behavior on held-out examples and compare it with the base model under the same task contract. Include cases outside the adaptation’s strongest slice. A domain adapter can improve specialized terminology while harming other required behaviors. Use the benchmark discipline from 1.2.2 rather than treating a completed training job as deployment acceptance.
Keep request-time evidence separate from adaptation. LoRA changes learned behavior; it does not establish that an answer reflects a current authoritative document. A policy assistant can still require retrieval and citations after adaptation, as discussed in 1.1.2.
Serve a merged artifact
In merged serving, the adapter’s weight changes are applied to the base model and exported as a combined deployment artifact. The runtime serves that model without choosing among separate adapters for each request. Preserve both the merged artifact and its original base-plus-adapter identity so the release can be reproduced.
AWS’s LoRA serving guidance distinguishes the lack of additional adapter computation in a merged inference path from the cost of applying or reversing a merge. That is not a promise of zero end-to-end latency: prompt processing, generation, queueing, and network time still exist.
Merged serving is attractive when one adapted behavior dominates the endpoint. Each independently merged variant carries its own combined weights, so deploying many variants can duplicate the large base. Switching behavior becomes a model-release operation rather than selecting a small adapter within a shared base deployment.
Confirm the engine and model format support your chosen export. Merging, quantization, and runtime optimization are separate transformations. Do not assume that an adapter trained with one precision or format can be merged into every optimized base artifact without validation.
Serve adapters through inference components
SageMaker AI efficient multi-adapter inference integrates LoRA adapters with inference components. Deploy a compatible base-model inference component on an endpoint, then create adapter inference components associated with it. This gives the serving platform concrete resources for adapter lifecycle management.
CreateInferenceComponent supplies the mechanism. For an adapter, Specification.BaseInferenceComponentName identifies the base inference component and Specification.Container.ArtifactUrl identifies the adapter archive in Amazon S3. Give the adapter its own InferenceComponentName. The base component has the model container and compute allocation; the adapter resource expresses the relationship to that base.
At invocation, InvokeEndpoint can select the adapter using InferenceComponentName. The application must choose that name from an authorized mapping. Never accept an arbitrary adapter identity from untrusted prompt text. A tenant-specific adapter is a routing decision, while the tenant’s data access remains a separate authorization decision. Several adapter inference components share one base inference component, and the application picks one by name from an authorized mapping.
AWS describes dynamic loading from GPU memory, CPU memory, or local disk according to demand. In the documented LMI container configuration, OPTION_MAX_LORAS limits GPU-resident adapters, while OPTION_MAX_CPU_LORAS limits CPU-staged adapters before excess adapters move to local disk. The LMI setting option.max_lora_rank caps supported adapter rank and affects memory allocation. Benchmark these controls against adapter demand rather than assuming every adapter remains GPU-resident.
The service supports adding, updating, and deleting individual adapters without redeploying the entire endpoint. This reduces the release scope for an adapter change, but a base-model change still affects every adapter that depends on it.
Benchmark the demand pattern
Test the workload’s adapter popularity distribution rather than repeatedly invoking one already warm adapter. Include frequent adapter switches, less popular adapters, simultaneous requests, and the longest supported task inputs. A benchmark against one warm adapter can conceal the cost of moving weights between memory tiers.
Measure time to first useful output, complete response latency, and accepted task throughput for each adapter. Record whether the test starts with resident or newly loaded adapter weights. In AWS’s documented LMI comparison, merged LoRA adds no adapter computation latency during inference but does not support multi-adapter batches. Unmerged LoRA adds inference latency for adapter operations but supports multi-adapter batches. Dynamic loading from CPU memory or disk can also add load delay; measure it separately from the adapter computation.
Choose capacity from the combined workload. The base model, adapter memory, and generation state all consume resources. A small adapter artifact does not imply unlimited concurrent adapters or requests. Use the selected inference component’s compute requirements and your measured demand to size the deployment rather than deriving capacity from adapter file size alone.
Version adapters independently, but approve them with their base compatibility. Model Registry can hold the release evidence; see 1.2.7. A dynamic update still deserves staged validation and a known previous adapter, even though the entire endpoint need not be replaced.
Key distinctions and trade-offs
Adapter versus merged model: An adapter requires its compatible base. A merged artifact contains the combined deployable weights for a particular adaptation.
Dynamic loading versus retraining: Loading selects existing adapter weights at inference time. It does not train a model from the current user’s prompt.
Shared compute versus shared authority: Several adapters can share a base deployment. That does not grant one tenant access to another tenant’s adapter or evidence.
Merged weights favor a stable specialized route and avoid separate adapter operations during generation. Dynamic serving favors many related adaptations and reduces repeated base copies. Choose from measured workload behavior, not a universal claim that one topology is faster or cheaper.
Architecture / decision scenario
A software vendor maintains many customer-specific writing styles, all adapted from the same base-model revision. Separate merged deployments leave most base-model copies idle.
You evaluate a SageMaker AI base inference component with adapter components for the approved customer variants. The application maps the authenticated customer’s task to an allowed InferenceComponentName, and tests include popular and rarely used adapters. The release record binds each adapter to the base revision and container.
A separate high-volume classification task uses one stable adaptation. Its measured profile favors a merged artifact on a dedicated serving path. Sharing a technique does not require sharing the topology: each task selects the deployment that meets its operating envelope.
Common exam traps
- Treating a LoRA adapter as a complete independent model.
- Changing the base revision without reevaluating its adapters.
- Interpreting no added merged-adapter computation as zero request latency.
- Benchmarking only a warm adapter under uniform demand.
- Letting prompt text select any tenant adapter.
- Assuming dynamic loading refreshes factual knowledge automatically.
What to remember
- Bind each adapter to its compatible base, tokenizer, and runtime.
- Use merged weights for a measured stable deployment need.
- Use inference component adapters for supported dynamic multi-adapter serving.
- Select adapters explicitly through
InvokeEndpointand authorized routing. - Evaluate memory movement, demand skew, and per-adapter task quality.
Knowledge check
A high-volume classification endpoint serves one stable LoRA adaptation and never switches behavior between requests. The team wants no separate adapter computation during generation. Which topology should it evaluate first?
A vendor serves dozens of customer-specific writing styles, all adapted from the same base-model revision. Separate merged deployments leave most base-model copies idle. Which alternative removes that duplication?
A dynamic-adapter benchmark repeatedly invokes one GPU-resident adapter, but production traffic often selects rarely used adapters. What should the benchmark add?
OPTION_MAX_LORAS with the same warm adapterEach tenant has its own adapter component on a shared endpoint. The application currently reads the adapter name from a field in the user’s prompt. How should it choose InferenceComponentName instead?
The platform team upgrades the base model revision behind a shared base inference component. The tenant adapters themselves are unchanged. What must happen before the upgrade reaches production?