Amazon Web Services (AWS) has introduced a new capability on Amazon SageMaker AI that allows developers to deploy decision models using the llama.cpp framework. This enhancement enables applications requiring scores for a fixed set of choices, rather than free-form text generation, to leverage quantized models efficiently on both central processing units (CPUs) and graphics processing units (GPUs).
The Chenab Times has learned that this development integrates the AWS Deep Learning Containers (DLCs) for generative AI inference, building upon previous series focused on tools like WhisperX and vLLM-Omni. The updated offering allows for OpenAI-compatible chat completions via SageMaker AI’s InvokeEndpoint, and crucially, extends this functionality with SemIf, a tool formerly known as OpenJev. SemIf is designed to return probabilities over declared options without needing to decode a full answer token, streamlining the decision-making process.
Dual Deployment Paths for Decision Models
The solution provides two distinct deployment paths from a single packaged model. The first path utilizes the AWS DLC for llama.cpp to serve responses through a standard OpenAI-compatible API. The second, more specialized path, involves building a child image that replaces the default server with a SemIf adapter. This adapter is specifically designed to return probabilities for predefined options, offering a more structured output for decision-making tasks.
For the standard text-generation path, models are packaged as model.tar.gz files and stored in Amazon Simple Storage Service (Amazon S3). The associated DLC image then maps the POST /invocations request to the llama-server’s /v1/chat/completions endpoint, using environment variables to configure llama.cpp arguments.
When direct access to final-position logits and state operations is required, as with SemIf, a child image is built using AWS CodeBuild and stored in Amazon Elastic Container Registry (Amazon ECR). This custom image retains the DLC’s compiled libraries while introducing a SageMaker-compatible adapter for specific functionalities.
Understanding Input and Output Schemas
The AWS DLC for llama.cpp adheres to the OpenAI Chat Completions schema. Input requests typically include a messages array with roles and content, alongside parameters like max_tokens and stream. The output is presented in an OpenAI-compatible format, with generated text found within choices[0].message.content.
In contrast, SemIf employs a constrained decision schema. Input requests contain a caller-defined ID, unstructured state, a question, and an ordered list of declared options, each with an ID and description. The response from SemIf provides option IDs, their corresponding probabilities, and raw option logits in the same order. This structured output allows applications to implement thresholds, fallbacks, and policy checks without the need for parsing generated text.
SemIf is part of a growing class of decision models, including Jev, Kev, and Strands Decider 2B, which are designed to score application-defined outcomes from unstructured data. These models offer alternatives for applications that need to interpret context and select from a predefined set of choices.
Choosing the Right Decision Workflow
The new pattern is particularly suited for applications where choices are defined at request time and a model is needed to interpret unstructured context. Use cases include routing support tickets, extracting specific values from known sets, assigning incident priorities, or determining agent actions. It is recommended to keep authorization logic and deterministic business rules separate from the model and to validate model probabilities before relying on them for operational decisions.
The standard SageMaker AI text-generation path is ideal for applications requiring OpenAI-compatible chat completions. The child image approach with SemIf should be reserved for scenarios demanding direct access to model logits and state operations, functionalities not exposed by the standard interface.
Performance Benchmarks and Optimization
Benchmarking results indicate significant performance gains when utilizing GPUs for the SemIf extension. A comparison using Qwen3.5-4B models showed that a GPU endpoint was substantially faster than a CPU configuration, achieving up to 4.9 times lower latency at the 50th percentile and 32.2 times lower latency at the 95th percentile. The benchmarks included network latency and were conducted on specific instance types, such as ml.c6i.8xlarge for CPU and ml.g6e.xlarge for GPU.
Model size and quantization also impact performance, with smaller models reducing median latency but potentially affecting accuracy. The sample defaults to a 4B Q4_K_M model, balancing quality and speed. Users are advised to benchmark their complete model and infrastructure configuration against their specific decision tasks.
For latency-sensitive workloads, GPUs are recommended, while CPUs are suitable for background, offline, or less time-critical tasks. Optimizations include concise state and option descriptions, grouping related decisions, and scaling endpoint instances for concurrency. The system supports retryable HTTP 503 responses for situations where stateful llama.cpp contexts become overloaded.
Prerequisites for Deployment
To implement these solutions, users require an AWS account, an S3 bucket, Python 3.10+, Git, and the AWS CLI. Additional prerequisites include an AWS Identity and Access Management (IAM) role for SageMaker AI, permissions for various AWS services (SageMaker, ECR, S3, CodeBuild, CloudWatch Logs), and a compatible CPU or GPU SageMaker real-time endpoint quota. A CodeBuild service role is also necessary for the optional SemIf extension.
Deployment and Cleanup Process
The deployment process involves cloning a provided code sample, setting up environment variables, and packaging the model. Users can then deploy a standard text-generation endpoint using the AWS DLC for llama.cpp or build and deploy the SemIf extension for structured decisions. The process includes options for both CPU and GPU deployments, with the latter leveraging instance pools for flexible hardware selection.
Cleanup involves deleting the deployed SageMaker AI endpoints, endpoint configurations, and models. Users are also advised to remove associated resources like CodeBuild projects, ECR repositories, S3 objects, logs, and IAM roles if they are no longer needed.
The Chenab Times News Desk

