Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Modal 8 min read Case study mediumAdept

Autoscaling Autoresearch: Give your agents elastic GPUs on Modal

A Claude Code agent equipped with Modal Skills ran OpenAI's Parameter Golf challenge overnight, executing 113 experiments over 238 GPU-hours and dropping bits-per-byte from 1.42 to 1.12. The agent changed its compute footprint as the work required. It used single-GPU Sandboxes for smoke tests, about 40 parallel single-H100 runs for a hyperparameter sweep, and five concurrent 8×H100 jobs for validation. It dropped back to one or two runs while debugging a CPU-bound GPTQ quantization step, which it eventually fixed by moving quantization to GPU. Compared with an 8-GPU workstation and a 40-GPU always-on cluster, elastic provisioning finished the core runs about 5x faster than the workstation and avoided paying for idle capacity during exploration and debugging.

Assumes: GPU training basicshyperparameter sweepsmodel quantization

Related posts

  • Building with Modal and the OpenAI Agents SDK

    Modal mediumAdept

    A custom agent harness built on the OpenAI Agents SDK runs coding agents inside Modal Sandboxes, optionally with GPUs, rather than on the host, where an unsandboxed exec tool can be abused by malicious prompts. The harness grows step by step: SQLite-backed Sessions for memory, an orchestrator that delegates to subagents with fresh context windows to limit context rot, and an asyncio-based subagent pool for parallel, non-blocking work. Hooks and a set_status tool let the orchestrator monitor subagents, and per-GPU-type quotas cap spend. Filesystem snapshots are also used to avoid duplicated work. The worked example targets OpenAI's Parameter Golf challenge, with parallel MNIST training as an intermediate test.

  • Run GPU jobs from Airflow with Modal

    Modal mediumAdept

    Airflow DAGs can offload GPU-heavy tasks to Modal instead of standing up Celery or Kubernetes executors, using a two-step pipeline that scrapes Reddit ELI5 questions and answers them with an LLM as the example. One approach deploys Modal Functions separately and calls them from Airflow tasks via Function.from_name and remote(), passing intermediate data through a Modal Dict (10GB limit versus roughly 1GB for XComs on Postgres) or a Volume. The other defines a custom ModalOperator that serializes a Python function's source and runs it in a Modal Sandbox with a runtime-defined image, secrets, volumes and GPUs. Either way, task environments stay isolated from the Airflow environment without building Docker images for KubernetesPodOperator.

  • How Doppel eliminated ML infrastructure tax with Modal

    Modal mediumAdept

    Doppel, which builds ML models to detect social engineering attacks, moved much of its training and inference from sequential experiments and GCP Cloud Run to Modal. On the training side, independent work such as K-fold cross-validation now runs in parallel via Modal's map(), and coding agents drive the experiment loop through Modal's CLI. For inference, image layer caching and persistent volumes for model weights cut builds from 10–30 minutes by up to 10x, with sub-minute warm builds. Autoscaling absorbs attack-campaign spikes without Cloud Run's one-GPU-per-instance limit, and direct remote calls replace the hand-built Flask HTTP layer around each model.

  • How we achieved truly serverless GPUs

    Modal mediumAdept

    Modal cuts GPU inference replica cold starts from roughly 2,000 seconds to about 50 seconds, a 40x speedup, by attacking each stage of spin-up. A solver-managed buffer of idle, health-checked GPUs, allocated with Google's GLOP linear program, takes instance provisioning out of the hot path. ImageFS, a libfuse filesystem, serves container images lazily from a tiered content-addressed cache, and CPU and CUDA checkpoint/restore skip host- and device-side initialization. The motivation is GPU Allocation Utilization: spiky inference demand leaves fixed allocations at 10-20% use, and fast autoscaling raises utilization and quality of service together.

  • Augment Your LiveKit Agent with Modal GPUs

    Modal mediumAdept

    LiveKit agents can offload custom or open-weights models to Modal serverless GPUs, demonstrated with a BitHuman Expression video avatar voiced by Qwen3-TTS. The BitHuman container's /launch endpoint returns as soon as the avatar joins the room, which conflicts with Modal Servers scaling on in-flight requests. Modal's Sticky Sessions solve this by letting the agent open a session before calling /launch and close it when the call ends, holding the container slot for the session's duration. GPU snapshots hide cold starts that would otherwise require reloading gigabytes of model weights.

The quest for software engineering knowledge.

Look:
Layout: