weights key in config.yaml. It supports both Model class deployments and custom Docker servers.
Get started
Add weights to a new model
Custom servers
Use with vLLM, SGLang, and more
Migrate
Move from
model_cacheQuick start
Add aweights section to config.yaml. The example highlights the section within a complete configuration:
config.yaml
source: Where to fetch weights from. Supports Hugging Face, Baseten Training, S3, GCS, R2, CoreWeave, and Azure Blob Storage.mount_location: Absolute path where the weights appear in your container.auth: Credentials for private or gated sources.allow_patterns: Include files that match these patterns.ignore_patterns: Exclude files that match these patterns.
BDN authenticates private or gated repos through this per-source
auth block, which is separate from the top-level secrets config. A secrets entry alone does not authenticate weight mirroring. Create the secret (here, hf_access_token with your Hugging Face token) in your workspace settings, then reference it by name. Public sources need no auth.Access weights in your model
When your model starts, weights are already downloaded and available at yourmount_location.
The directory structure from the source is preserved:
load() method:
model.py
truss push and cached, so cold starts only read from local or nearby caches.
Custom servers
Custom Docker servers, including vLLM and SGLang, can use BDN. BDN mounts files atmount_location before the container starts, so start_command can read the weights from that path.
config.yaml
Configuration reference
weights
A list of weight sources to mount into your model container.
config.yaml
string
required
URI specifying where to fetch weights from. Supported schemes:
hf://: Hugging Face Hub.bt://: Baseten Training.s3://: AWS S3.gs://: Google Cloud Storage.r2://: Cloudflare R2.cw://: CoreWeave AI Object Storage.azure://: Azure Blob Storage.
@revision suffix (branch, tag, or commit SHA).string
required
Absolute path where weights will be mounted in your container. Must start with
/.object
Authentication configuration for accessing private weight sources. See Source types and authentication for the expected format for each source type.
auth_method: The authentication method. UseCUSTOM_SECRETfor secret-based auth,AWS_OIDCfor AWS OIDC, orGCP_OIDCfor GCP OIDC.auth_secret_name: Name of a Baseten secret holding the credentials. Required whenauth_methodisCUSTOM_SECRET.
string[]
File patterns to include. Uses Unix shell-style wildcards. Only matching files will be downloaded.Patterns like
*.safetensors only match files at the top level. Use **/*.safetensors to match files in subdirectories.string[]
File patterns to exclude. Uses Unix shell-style wildcards. Matching files will be skipped.
Source types and authentication
For private weight sources, create a Baseten secret with the appropriate credentials. Manage secrets in your Baseten settings.Hugging Face
Download weights from Hugging Face Hub repositories.config.yaml
hf://owner/repo@revision
owner/repo: The Hugging Face repository.@revision: Branch, tag, or commit SHA.
Revision pinning: When you use a branch name like
@main, Baseten resolves it to the specific commit SHA at deploy time and mirrors those exact files. Your deployment stays pinned to that version. Subsequent scale-ups won’t pick up new commits. To update to newer weights, push a new deployment.
Get your token from Hugging Face settings.
Baseten Training
Load weights from a Baseten Training checkpoint.config.yaml
bt://project[@revision][/checkpoint]
project: The name of your Baseten Training project.@revision: Optional. A training job ID orlatest. Defaults tolatest./checkpoint: Optional. The checkpoint name within the training job. If omitted, uses the latest checkpoint.
Baseten automatically authenticates with your training project.
AWS S3
Download weights from a private S3 bucket.Pick an auth method
AWS S3 supports two authentication paths, both first-class:- IAM credentials: Use this if you have an AWS access key pair and want the simplest setup. Skip ahead to the quick start.
- AWS OIDC: Use this if you want short-lived, narrowly scoped tokens and are comfortable configuring an IAM trust policy in your AWS account. See AWS OIDC.
Quick start with IAM credentials
Use this path when you already have an AWS access key pair for an IAM user or role with read access to your bucket. To authenticate to S3 with IAM credentials:-
Create the secret in Baseten: in your secrets settings, add a secret named
aws_credentialswith this JSON value:Use these exact key names. Common variations likeaccess_key_id(without theaws_prefix) cause authentication failures. -
Reference the secret from your
config.yaml:config.yaml -
Grant the IAM user the minimum required permissions on the bucket:
The mirror lists objects under your prefix and downloads each file once. No write permissions are needed.
- Push the model. The first deploy mirrors weights to Baseten’s blob storage; subsequent deploys reuse the mirror unless the source or filters change.
AWS OIDC (recommended)
OIDC provides short-lived, narrowly scoped tokens for secure authentication without managing long-lived credentials. To authenticate to S3 with AWS OIDC:- Configure AWS to trust the Baseten OIDC provider and create an IAM role with S3 permissions.
-
Add the OIDC configuration to your
config.yaml:config.yaml
No secrets needed. The
aws_oidc_role_arn and aws_oidc_region are not sensitive and can be committed to your repository.IAM credentials
config.yaml
s3://bucket/path
Authentication: JSON with AWS credentials
Example secret value with all fields:
Google Cloud Storage
Download weights from a GCS bucket. GCP supports using either service accounts or OIDC for GCS authentication.GCP OIDC (recommended)
OIDC provides short-lived, narrowly scoped tokens for secure authentication without managing long-lived credentials. To authenticate to GCS with GCP OIDC:- Configure GCP Workload Identity to trust the Baseten OIDC provider and grant GCS permissions.
-
Add the OIDC configuration to your
config.yaml:config.yaml
No secrets needed. The service account and workload identity provider are not sensitive and can be committed to your repository.
Service account
config.yaml
gs://bucket/path
Authentication: GCP service account JSON key
Download from GCP Console under IAM & Admin > Service Accounts.
Cloudflare R2
Download weights from a Cloudflare R2 bucket.config.yaml
r2://account_id[.jurisdiction].bucket[/path]
account_id: Your Cloudflare account ID.jurisdiction: Optional.euorfedramp. Omit for the default jurisdiction.bucket: R2 bucket name, separated from the account ID (and jurisdiction, if present) by periods.path: Optional. Path prefix within the bucket.
Get your R2 API tokens from the Cloudflare dashboard under R2 > Manage R2 API Tokens.
CoreWeave AI Object Storage
Download weights from CoreWeave AI Object Storage (CAIOS), an S3-compatible object store.config.yaml
cw://bucket/path
bucket: Your CoreWeave AI Object Storage bucket name.path: Path prefix within the bucket.
aws_region is required. CoreWeave uses availability-zone-style regions such as US-EAST-04A. OIDC is not supported for CoreWeave sources; use a secret.
Azure Blob Storage
Download weights from Azure Blob Storage.config.yaml
azure://account/container/path
account: Your Azure storage account name.container: Blob container name within the storage account.path: Path prefix within the container. Optional.
The account name comes from the URI, so the secret needs only
account_key. Azure sources don’t support OIDC, and the secret is required even for public containers.
Get your account key from the Azure portal under Security + networking > Access keys.
Best practices
Pin to specific commits
Always pin to a specific commit SHA for reproducible deployments:config.yaml
Terminal
Filter files with patterns
Only download what you need to minimize cold start time:config.yaml
Use absolute mount paths
Themount_location must be an absolute path (starting with /):
config.yaml
Keep mount locations unique
Each weight source must have a uniquemount_location:
config.yaml
When weights are re-mirrored
Baseten caches weights based on a hash of their configuration and reuses cached weights when possible to avoid redundant downloads. Deduplication and mutation detection: Baseten deduplicates files based on their etag (a content hash), not just filename, and only re-mirrors files that have been mutated since the last pull. Unchanged files are reused from blob storage, even across deployments.Weight access
A deployment reads only the weight sources it declares in itsweights config. Caching and deduplication happen behind the scenes and never grant another deployment or organization access to your data. Private sources like S3, GCS, R2, CoreWeave, and Azure stay within your organization. Public sources like Hugging Face are already public, so Baseten can serve them from a shared cache across organizations.
Changes that trigger re-mirroring:
Changes that do NOT trigger re-mirroring:
How it works
You own the source, and Baseten holds a mirror of it. Ontruss push, BDN reads your weights config, mirrors the files into Baseten’s secure blob storage, and writes a manifest of content hashes. Files are keyed by hash, so a file BDN already holds is never transferred again, and each deployment mounts only the files in its own manifest.
Your truss push returns immediately. Mirroring runs in the background, and your model deploys to the workload plane only after mirroring completes, so weights are in place before your replica starts.
What happens on cold start
Baseten runs workload planes across regions and clusters, each with its own cache tiers. When a replica starts, weights flow from blob storage through the in-cluster cache and the node cache, then are mounted read-only. Each tier serves the one below it, so later replicas read from a warm cache instead of downloading again.Key benefits
- Non-blocking push:
truss pushreturns while mirroring continues in the background. - One-time mirroring: BDN mirrors weights to Baseten storage instead of fetching them from the source for each cold start.
- No upstream runtime dependency: After mirroring, scale-ups and inference do not contact the original source.
- Multi-tier caching: An in-cluster cache prevents repeated downloads, and a node cache serves weights to subsequent replicas.
- Deduplication: BDN stores identical weight files once and shares them through hard links.
- Parallel downloads: Concurrent chunk fetching reduces download time for large models.
BDN proxy
BDN proxy is available by request. Contact us to enable it for your organization.
weights config, BDN proxy can accelerate those downloads. When enabled, your container can route downloads through a distributed caching proxy that caches them across cluster nodes, so later replicas and scale-ups read from cache instead of re-downloading from the origin.
Baseten sets these environment variables on your container:
Downloads only go through the proxy when your HTTP client points at it. Baseten doesn’t set
HTTP_PROXY or HTTPS_PROXY, so set them to the proxy address in your model code before downloading:
model.py
HTTP_PROXY and HTTPS_PROXY, including requests, huggingface_hub, and curl, then downloads through the cache. You don’t need to configure TLS trust: the CA bundle variables above already trust the proxy.
Troubleshooting
Migration from model_cache
Automated migration with truss migrate
The truss migrate CLI command automatically converts model_cache configurations:
Terminal
- Show a colorized diff of the proposed changes.
- Prompt for confirmation before applying.
- Create a backup of your original
config.yaml. - Warn about any
model.pypath changes needed.
Manual migration reference
Frommodel_cache to weights:
Example migration:
- After (weights)
- Before (model_cache)
config.yaml
Chains migration
For Truss Chains, updateAssets.cached to Assets.weights in your Python code:
- After (weights)
- Before (cached)
- Replace
ModelRepowithWeightsSource. - Replace
repo_idandrevisionwith asourceURI that has an@revisionsuffix. - Replace
volume_folderwith an absolutemount_locationpath. - Replace
runtime_secret_namewithauth.auth_secret_nameinside anauthblock that setsauth_method: CUSTOM_SECRET. - Remove
use_volumeandkind(inferred from URI scheme).
Custom server migration
When migrating an existing custom server deployment frommodel_cache to weights:
- Remove
truss-transfer-clifrom yourstart_command. Files are pre-mounted before the container starts. - Update file paths from
/app/model_cache/{volume_folder}to your newmount_location.
- After (weights)
- Before (model_cache)
config.yaml
Automatic use with engine builders
Engine-builder deployments use BDN automatically. Noweights block is required, and no configuration changes are needed when migrating an existing engine-builder deployment.
Build artifacts are mirrored once and served from the same multi-tier caches described in How it works.
Next steps
- Secrets: Store credentials for private weight sources.
- Custom Docker images: Deploy vLLM, SGLang, and other inference servers.
- Autoscaling: Configure replica scaling and cold start behavior.
- Configuration reference: Full list of
weightsoptions.