Skip to main content
Use the weights parameter on TrainingJob to mount model weights and training data into your container through the Baseten Delivery Network (BDN). BDN mirrors your data once and serves it from multi-tier caches, so subsequent jobs start faster. Each weight source specifies a remote URI and a local mount path. When your container starts, the data is already available at the mount_location.
BDN mirrors your weights to Baseten storage during the CREATED state, before any compute is provisioned. Once your job is scheduled on a node, BDN places the weights on local disk before your start_commands run. Weight delivery never overlaps with workload execution, so BDN has no effect on training throughput. The only difference between a cache hit and a cache miss is how long the deploy phase takes.

Mount weights and a dataset

Add WeightsSource entries to the weights list of an existing TrainingJob in your job’s config.py. To create the file from scratch, see the quickstart. This example mounts model weights from Hugging Face and training data from S3 into the container before your code runs:
config.py
In your training script, read the mount paths directly:
train.py
Push the job once the script is in place:
The job’s logs show the files BDN mounted from the S3 prefix under data files:.

Supported sources

BDN supports these URI schemes: For Hugging Face sources, pin to a specific revision with the @revision suffix (branch, tag, or commit SHA). For R2, add the jurisdiction between the account ID and the bucket when your bucket isn’t in the default one: r2://<account_id>.<jurisdiction>.<bucket>/path/to/data.

Authentication

Private or gated sources require authentication. Add an auth block to your WeightsSource. For AWS, use OIDC (recommended) or AWS AssumeRole to avoid storing long-lived credentials in Baseten. The role ARN, region, service account, and workload identity provider values aren’t credentials, so you can commit them to your repository.
To read a private or gated repository:
  1. Store a Hugging Face access token as a Baseten secret named hf_access_token.
  2. Add this source to the job’s weights list:
For the full list of authentication options and source-specific configuration, see the BDN configuration reference.

Filter files

allow_patterns and ignore_patterns take glob patterns. A pattern such as *.safetensors matches only files at the top level of the source, so use **/*.safetensors to match files in subdirectories. Add both lists to a source in the job’s weights:

How BDN serves training jobs

When you submit a training job, BDN compares your weights config to what’s already in Baseten storage and pulls anything missing from the upstream source. It then stages the full set on the node before your start_commands run. Data delivery happens entirely during the CREATED and DEPLOYING phases. Two cache tiers sit in front of Baseten’s mirror:
  • Cluster-local cache: shared across nodes in a GPU cluster. Populated the first time a job in that cluster pulls a given set of files.
  • Node-local cache: lives on the node itself. Populated when a job lands on that node.
Both caches evict with LRU. On a node-local hit, the node mounts the data directly and your job starts almost immediately. On a cluster-local hit, BDN transfers the data from the cluster cache to the node, which adds a small amount of deploy time. On a full miss, BDN pulls from its mirror, which adds more deploy time.

Weight access across jobs

A training job reads only the weight sources it declares in its config. Private sources like S3, GCS, R2, and CoreWeave stay within your organization. Within your organization, jobs that reference the same unchanged source pull from the upstream once instead of once per job. For example, running many jobs against the same S3 dataset egresses from your bucket a single time, regardless of which user launched them.

Next steps