Cold starts
A model that is scaled to zero has to pull its image, load its weights and report ready before it can answer. What a caller sees while that happens is in Deploy & call → Cold starts.
Fine-tunes run on Turion’s vLLM serving image. Their cold start is pulling that image (once per
node), loading the base model’s weights and your adapter (both cached on the node after the first
time) and starting vLLM. There is nothing to tune in the image; if the cold start is too slow for
you, set a cold-start target or keep a replica
warm (--min-replicas 1 on turion deploy or
turion model set).
Watch a cold start
Section titled “Watch a cold start”Every cold start of a model is logged on the node and shown on the model’s page in the workspace, in the Logs card: the steps (pulling the image, starting the container, loading the model, ready) with how long each took, and the container’s own output, which updates every two seconds while the start is under way. Earlier starts are in the card’s picker. From a terminal:
turion model logs acme/support-v3 --follow--follow prints each new line and stops once the replica is ready or the start failed. When
nothing is under way (no start yet, or the last one ended more than two minutes ago), it waits for
the next start, so you can run it and then make the call. A start is logged whether a call or a warm replica
(--min-replicas) began it, and it keeps going after the call that began it gave up, so a call
that ended with 524 or 504 garden_timeout on a cold start can be retried once the log says
ready. A failed start ends with start failed: and the reason, after the container’s last
lines (a 401 on a gated repository, a CUDA out-of-memory error). Keys, tokens and the
container’s secrets read [redacted]. The logs are your own models’ only: a shared model in the
model garden runs on Turion’s replicas. A node on your own fleet sends them once its agent is
current (Upgrade the agent). See
turion model logs and
GET /v1/models/{owner}/{name}/logs.
Cog images you build yourself can be made faster with the next two sections.
Lazy image pull (Cog)
Section titled “Lazy image pull (Cog)”Nodes with lazy pull enabled start your container from a partial image and fetch the remaining layers as the container reads them, so an 18 GB image no longer has to download in full before anything runs.
This needs a SOCI index next to your image, which turion cog push builds for you:
turion cog push whisper:latest --fleet acme/lab# building SOCI index (large images can take several minutes)...# pushed registry.turion.ai/acme/whisper@sha256:4f59dd…# soci SOCI lazy-pull index published# model acme/whisper@v1# run it: turion run acme/whisper:v1 -i ...The soci line says what happened. If the index was not published, most often because the soci
CLI is not installed, install the
soci CLI (v0.10.0, the
release Turion nodes run) and push again, or pass --no-soci to skip the step. The image works
either way: without an index, nodes pull it in full. The image_uri digest is the same with or
without the index.
On your own nodes, lazy pull is enabled at install time with TURION_LAZY_PULL=on; see
Join a node. Lazy-pull and full-pull nodes can run
the same image in one fleet.
Fast weight loading (Cog)
Section titled “Fast weight loading (Cog)”Most of what is left after the pull is setup() loading weights. Three things usually matter:
- safetensors. Load with
use_safetensors=True. The file is memory-mapped instead of unpickled, and the load fails rather than falling back to a.binpickle. low_cpu_mem_usage=True. Parameters are created on the GPU instead of being built on the CPU and copied.- The node’s weight cache. On nodes that have one, the agent mounts a directory on the node’s
local disk into your container and sets
HF_HOME,TORCH_HOMEandTURION_WEIGHTS_CACHEto it. Hugging Face and torch hub downloads land there without any code change, so the next cold container of your model on that node downloads nothing. Write anything else you download under$TURION_WEIGHTS_CACHE.
import osimport torchfrom cog import BasePredictorfrom diffusers import AutoPipelineForText2Image
class Predictor(BasePredictor): def setup(self): self.pipe = AutoPipelineForText2Image.from_pretrained( "stabilityai/sdxl-turbo", torch_dtype=torch.float16, use_safetensors=True, low_cpu_mem_usage=True, ).to("cuda") # downloads into $HF_HOME, the node cache when there is oneDo not prefetch weights into the image at build time: HF_HOME points at the node cache, so a
prefetched copy inside the image is skipped. The cache is shared, read and write, by every
container on the node; on your own fleet, install with TURION_WEIGHTS_CACHE=off if its nodes
serve models that must not share files.
Very large models (tens of GB) can load faster with
Tensorizer, which streams weights straight into GPU
memory. It needs a serialization step and changes to setup(), and you set it up yourself.
Stay warm when a model is too slow to start
Section titled “Stay warm when a model is too slow to start”Declare the cold start you can accept, and Turion keeps a replica warm whenever the measured cold start is slower:
turion model set acme/whisper --cold-start-target 15The same works for a fine-tune (turion model set acme/support-v3 --cold-start-target 60). Over
REST it is PATCH /v1/models/{slug}/versions/{version} with {"cold_start_target_s": 15}.
- Turion measures each cold start (image pull plus weight load) and keeps a smoothed average per version. Only successful runs count, so a model that crashes during a slow load does not keep itself warm.
- Average at or under the target: the version may scale to zero.
- Average over the target: the version is held warm with at least one replica, billed like
any
min_replicas ≥ 1version. - No target, or no measurement yet: nothing changes.
The target is a whole number of seconds from 1 to 3600; an explicit null clears it. The
setting releases as well as holds: when lazy pull and the weight cache bring a model under its
target, it goes back to scaling to zero. Your account’s replica quota still applies, so a target
never raises the ceiling.
GET /v1/models/{slug}/versions/{version} returns both numbers:
{ "cold_start_target_s": 15, "cold_start_observed_s": "8.412" }cold_start_observed_s is read-only and, like every measured quantity Turion reports, a decimal
string rather than a JSON number.
While a version is held warm it does not cold-start, so the observation stays at the value that
caused the hold. To re-measure it, clear cold_start_target_s and let ordinary traffic cold-start
the version again.
Summary
Section titled “Summary”| Layer | Without it | With it |
|---|---|---|
| Lazy pull | the whole image downloads before anything starts | start from a partial pull |
| safetensors | weights are parsed into host RAM, then copied to the GPU | the file is mapped and loaded on the GPU |
| Node weight cache | every cold container re-downloads weights | the first downloads, the rest reuse |
cold_start_target_s | a slow model cold-starts on every idle request | a slow model stays warm until it is fast enough |
Each layer falls back to the left-hand column when it is not available; none of them can stop a model from running.
See also Autoscaling replicas for the replica settings and Deploy a Cog model for the push flow.