config.yaml that specifies the model, the hardware, and the engine, then uvx truss push builds a TensorRT-optimized container and deploys it. No Python code, no Dockerfile, no container management.
This guide walks through deploying Qwen 2.5 3B Instruct, a small but capable LLM, from a config file to a production API. You’ll set up Truss, write a config, deploy to Baseten, and call the model’s OpenAI-compatible endpoint.
Install and sign in
Before you begin, sign up or sign in to Baseten, then install uv, a fast Python package manager. Install the Truss CLI and connect it to your Baseten account. Browser login opens a tab to approve this device, so there’s no API key to copy and paste.Install Truss
Sign in
Create a Truss project
Create a directory for your project:config.yaml. No custom Python code is required, and the model/ directory (used for custom preprocessing or postprocessing) isn’t needed here.
Write the config
Create aconfig.yaml with:
config.yaml
model_nameidentifies the model in your Baseten dashboard.resourcesselects an L4 GPU (24 GB VRAM), which is plenty for a 3B parameter model.trt_llmtells Baseten to use Engine-Builder-LLM, which compiles the model with TensorRT-LLM for optimized inference.checkpoint_repositorypoints to the model weights on Hugging Face. Qwen 2.5 3B Instruct is ungated, so no access token is needed.quantization_type: fp8compresses weights to 8-bit floating point, cutting memory usage roughly in half with negligible quality loss.max_seq_len: 8192sets the maximum context length for requests.num_builder_gpus: 2uses two GPUs during the build phase. FP8 quantization requires more GPU memory at build time than at inference time, so a single L4 runs out of memory during compilation without this setting.
Deploy
Push the model to Baseten:Engine-based deployments (TRT-LLM) use published deployments by default. The
--watch flag, which creates a development deployment with live reload, is not supported for TRT-LLM models. For custom Python models, see Customize a model where --watch enables a faster development loop.Call the model
Engine-based deployments serve an OpenAI-compatible API. Once the deployment shows “Active” in the dashboard, call it using the OpenAI SDK or cURL. Replace{model_id} with your model ID from the deployment output.
The endpoint follows this shape:
- Python
- cURL
Install the OpenAI SDK if you don’t have it:Create a chat completion:
base_url at your model’s endpoint.
Next steps
Engine configuration
Tune max sequence length, batch size, quantization, and runtime settings.
Customize a model
Add custom Python code when you need preprocessing, postprocessing, or unsupported model architectures.
Autoscaling
Configure replicas, concurrency targets, and scale-to-zero for production traffic.