AI • Science • Technology • Future

AI Tools

SOCI-Indexed Images for Faster SageMaker AI Jobs

Image from the original article
Featured image: original publisher image. Via original publisher.

Amazon has introduced SOCI-indexed container images for Amazon SageMaker AI jobs to reduce startup delays. This update cuts image download time from minutes to seconds, without changing job definitions or requiring new code. Source: aws.amazon.com.

What Happened

Amazon launched SOCI-indexed images for SageMaker AI training and processing jobs. These images use Seekable OCI (SOCI) indexing to lazy-load container content during startup.

The feature allows jobs to begin running in seconds, not minutes. It does not alter how jobs are defined or how data is processed.

How It Works

SOCI indexing uses metadata to map every file in a container image. Instead of downloading the entire image before launching, SageMaker AI retrieves only the files needed to start the container immediately.

The rest of the image streams in the background as your code runs. This avoids full decompression and disk writing, saving time and resources.

The SOCI index is stored separately in Amazon ECR. It links to the original image via an OCI-compliant manifest. This keeps the original image’s digest and signatures valid and unchanged.

When a job starts, SageMaker AI checks for a SOCI index. If found, the container begins running before the full image is downloaded. If no index exists or it can’t be read, the job falls back to standard download. No workflow is disrupted—jobs always start successfully.

Performance Results

Amazon tested eight container images from 1.8 GB to 35.4 GB in compressed size. Tests ran across instance types like ml.g4dn, ml.g5, ml.g6, ml.g6e, ml.g7, ml.g7e, ml.p4d, ml.p5, and ml.m7i in the US West (Oregon) and US East (N. Virginia) regions.

  • For a 1.8 GB image, download time dropped from 48 seconds to 3–11 seconds — an 8x improvement.
  • For a 13.2 GB image, time dropped from 3 minutes 42 seconds to about 6 seconds — a 34x improvement.
  • For a 35.4 GB image, time dropped from 7 minutes 17 seconds to 3–11 seconds — a 38x improvement.

Results hold across all instance types. A 13.2 GB image showed standard download times from 3 minutes 16 seconds to 4 minutes 20 seconds. Lazy loading stayed at 6 to 8 seconds—34x faster on every setup.

The benefit grows with image size. Larger images save more time because image download becomes a bigger part of total job runtime.

Impact on Training Performance

Amazon tested two workloads: image classification with ResNet-50 on Imagenette and LLM fine-tuning with Qwen2.5-0.5B on alpaca-cleaned data.

From the second epoch onward, training performance was identical between standard and SOCI-indexed images. This means the lazy-loading process does not slow down training or affect model accuracy.

The first epoch takes 3 to 16 seconds longer on the SOCI-indexed image. This is due to files accessed at startup. But the net result is each job finishes 1 to 6 minutes earlier.

Even when a 6 GB model is baked into the image, the first epoch adds 2 to 3.5 minutes. The job still ends 2 to 2.5 minutes earlier. The download savings outweigh the initial cost.

Image from the original article
original publisher image. Via original publisher. · Source

Real-World Impact

For ML teams, faster startups mean better iteration cycles. Hundreds of hyperparameter sweeps or short experiments daily can lose minutes of idle time.

Each sweep with a 13.2 GB image takes 50 jobs. With SOCI indexing, each job starts in 6 seconds. Total idle time drops to under one minute per day. That adds up to hundreds of hours saved yearly.

Teams doing rapid prototyping or frequent experiments benefit most. Launching jobs in seconds instead of minutes enables faster feedback, quicker validation, and better use of compute resources.

The benefit is strongest when the entry point loads only a small part of the image. If code scans or preloads large data before training, the first epoch may wait for a large chunk—reducing net gains. But in typical PyTorch or TensorFlow setups, the benefit remains strong.

How to Adopt the Feature

There are two ways to use SOCI-indexed images in SageMaker AI jobs.

Option 1: Use Pre-Indexed AWS Deep Learning Containers

Amazon offers pre-built SOCI-indexed versions of popular Deep Learning Containers. These are labeled with a -soci suffix in the image tag.

  • Example: 763104351884.dkr.ecr.us-east-1.amazonaws.com/pytorch-training:2.9-gpu-py312-cu130-ubuntu22.04-sagemaker-v1-soci
  • Available for PyTorch, TensorFlow, vLLM, and SGLang frameworks.
  • Arm64 variants support newer hardware.

Update your job definition by replacing the original tag with the -soci version. No code or pipeline changes are needed.

See the full list in the AWS Deep Learning Containers Gallery.

Option 2: Create a SOCI Index for Custom Images

Build custom images and add SOCI indexing manually. This lets you use private or internal models.

You need a Linux host like Amazon EC2 with Amazon Linux 2023, containerd, and either Finch or nerdctl installed.

  1. Set environment variables for your AWS account, region, repository, original tag, and SOCI tag.
  2. Install containerd and the SOCI snapshotter using dnf or apt.
  3. Start the SOCI snapshotter and restart containerd.
  4. Authenticate to Amazon ECR with AWS CLI credentials.
  5. Pull the original image using nerdctl.
  6. Convert the image to SOCI-indexed using nerdctl image convert --soci.
  7. Push the new image to ECR with the correct platform tag (e.g., linux/amd64).

After processing, two artifacts appear in ECR: the SOCI index and an OCI-compliant manifest linking the original image to the index. The original image and its digest remain unchanged.

Automation in CI/CD

Automate SOCI indexing with the CFN ECR SOCI Index Builder. It detects image pushes and builds indexes automatically.

No changes to your CI/CD pipeline are needed. It works with AWS EventBridge to trigger indexing on every push. This ensures new image versions are instantly ready with lazy loading.

Teams using GitHub Actions, Jenkins, or similar tools benefit from immediate availability of SOCI-indexed images.

Bar chart comparing Docker pull and SOCI lazy-loading download times across eight image sizes, with speedups from about 10x to over 35x
Bar chart comparing Docker pull and SOCI lazy-loading download times across eight image sizes, with speedups from about 10x to over 35x. Via original publisher. · Source

Using the Image in SageMaker Jobs

Use the SOCI-indexed image in your SageMaker jobs without changing job definitions, entry points, or data channels.

Example in SageMaker Python SDK:

from sagemaker.train import ModelTrainer
from sagemaker.train.configs import Compute

trainer = ModelTrainer(
    training_image="111122223333.dkr.ecr.us-east-1.amazonaws.com/my-training-image:v1.0-soci",
    role="arn:aws:iam::111122223333:role/SageMakerExecutionRole",
    compute=Compute(
        instance_type="ml.g5.12xlarge",
        instance_count=2,
    ),
)

Before launching, verify the image tag points to a valid SOCI index using the AWS CLI and jq:

aws ecr batch-get-image \
    --repository-name "my-training-image" \
    --image-ids imageTag="v1.0-soci" \
    --accepted-media-types \
    "application/vnd.oci.image.index.v1+json" \
    --query 'images[0].imageManifest' --output text \
    | jq '.manifests[] | {mediaType, artifactType}'

Look for a child manifest with artifactType beginning with application/vnd.amazon.soci.index. If not present, the tag does not point to a valid indexed image.

Limitations and Considerations

Only images in Amazon ECR private repositories are eligible. Images pulled through private Docker registries or with TrainingRepositoryAccessMode set to Vpc are not supported.

Benefits grow with image size. Images under 4 GB show smaller improvements because download time is a smaller portion of total runtime.

Some code patterns may not work:

  • Code that calls Docker CLI or reads /var/run/docker.sock may fail.
  • Code that uses cgroup paths may not function due to file system differences.
  • SageMaker mounts a /.dockerenv file for backward compatibility. Avoid adding new dependencies on it.

Why This Matters

Every minute spent downloading an image is a minute of idle time and cost. For teams running hundreds of short jobs, this adds up quickly.

With SOCI indexing, startups go from minutes to seconds. This reduces total job cost and speeds up model iteration. Teams spend more time building models, not waiting for infrastructure.

By removing full image download overhead, SOCI indexing shifts focus from waiting to building. Engineers can iterate faster and deliver better results in less time.

What to Watch Next

Amazon has published detailed benchmarks and technical posts on its blog.

  • Figure 1: Download time comparison across image sizes.
  • Figure 2: Performance across instance types for a 13.2 GB image.
  • Original source for full details and benchmarks.

For deeper technical insight, see the AWS Containers Blog post on Under the hood: Lazy loading container images with Seekable OCI and AWS Fargate.

Teams can also test locally with Finch before submitting jobs. This helps validate image configurations in a safe environment.

For more on AI workflows, explore Fine-Tuning GPT-OSS-20B on SageMaker HyperPod.

Sources & further reading

Featured image: original publisher image. Via original publisher. Image source