Model runtime

How pipeline, operator, synthesis, representation, memory, and hosted API files fit together.

On this page

Runtime shape

A model call in this repository usually follows one chain: the pipeline is the public entrypoint, the operator prepares inputs, synthesis owns checkpoint or API execution, and representation or memory join only when the task needs geometry or multi-turn state. Every path converges on the same GenerationResult so Studio, the CLI, and benchmarks share one artifact contract.

Call graph
Runtime assembly
Control plane
Control planeCatalog binding<category>/<model-id>.yaml
resolve_pipeline_route()
Runtime
RuntimePipelineABCpipelines/pipeline_utils.py
operator.process_*()
InputBaseOperatoroperators/base_operator.py
synthesis.predict()
InferenceBaseSynthesissynthesis/base_synthesis.py
Geometry3D model runtime
StateBaseMemory

Optional — only when the task needs geometric outputs or multi-turn state

converge on one artifact contract
ArtifactGenerationResult
Representation and memory join only when the task needs geometry or multi-turn state. Every path still ends as GenerationResult.

Model-specific public wrappers should be thin, but inference implementations must not be repeated across model directories. Local diffusion families compose canonical components from worldfoundry/base_models/diffusion_model; only genuinely model-specific network blocks and adapters belong in a family package. See Native diffusion for ownership and dependency rules.

All model runtime integrations must be in-tree implementations. They must not depend on machine-local external checkouts. DiffSynth, Diffusers, LightX2V, and official model repositories are implementation references, not runtime backends. External repos and checkpoints are provenance or acquisition metadata; the inference code itself lives in canonical WorldFoundry components.

Use integration.status for the public support claim and the runtime profile's backend_stage for implementation depth, such as native_diffusion or in_tree_runtime. Runnability is decided by the catalog: an entry with a runner_target and integration.status: integrated is a runnable_runner, a runner target with any other status is a runner_candidate, and an entry without one is listed_only. Planning stages such as profile_only (the default) or metadata_only never make an entry runnable.

Runtime contract

Every runnable method requires both a pipeline and an operator. The pipeline is the concrete class reachable from catalog pipeline_target or the canonical binding resolver. It owns model loading, normalized execution, and GenerationResult artifact semantics. The operator is the pipeline's input-side partner for validation, image/video loading, camera/action parsing, interaction shaping, and perception preprocessing. Operators may be thin, but they must exist.

Binding resolution should go through worldfoundry/zoo/bindings.py. Catalog loading, pipeline loading, runner resolution, and validation should call its helpers instead of re-parsing route strings independently. Runtime profiles may carry execution metadata, environment expectations, checkpoint paths, and command hints, but they do not replace a pipeline/operator pair. metadata_only or profile_only entries must not be advertised as runnable support.

worldfoundry/base_models/diffusion_model is the canonical local diffusion runtime and the only diffusion package boundary. Its root contracts plus role-based models/, recipes/, loaders/, runners/, schedulers/, optimizations/, and extensions/ form the architecture. Do not add diffsynth/, image/, video/, or catch-all common/ children; they are not supported ownership layers. Compatibility imports may point from a product module to a canonical component, but canonical components must never import back. Generic checkpoint materialization, state-dict loading, placement/offload, distributed execution, kernels, configuration, and IO come from worldfoundry/core; family packages cannot recreate them. worldfoundry/base_models/perception_core and worldfoundry/base_models/three_dimensions remain inference/runtime packages. Keep transforms and geometry helpers required for inference, but do not keep training datasets, dataloaders, callbacks, losses, augmentation-only modules, or experiment scripts there.

The built-in wan2.1-t2v-1.3b recipe is the first complete example of that boundary; other diffusion families (Matrix Game 3.5, Echo Memory, LTX, Cosmos Predict/Transfer, HunyuanVideo, Sana, FLUX.2) follow the same role assembly without owning their own pipeline, loader, scheduler, or runner. Which roles each family reuses and the structural/tensor validation behind each recipe are listed in Native diffusion consolidation. Structural checkpoint verification is distinct from CUDA artifact parity, which remains a separate release gate per family.

Base abstractions

Four base classes define the assembly surface: PipelineABC (load/process/stream entrypoint), BaseOperator (input and interaction shaping only), BaseSynthesis (local native runtime or hosted API), and BaseMemory (prior state for streaming or multi-turn control). NativeDiffusionPipeline and NativeDiffusionRunner own local diffusion execution below the BaseSynthesis boundary. For the file-level table — which file defines each class and what each owns — see Runtime assembly; for the shared primitives they depend on, see Core infrastructure.

Directory roles

When deciding where a model fix belongs, ask whether the failure happens in input handling, inference, geometry postprocessing, or state management, then map it to the owning package: inputs → operators/, native inference and hosted APIs → synthesis/, 3D/4D inference and artifacts → base_models/three_dimensions/, streaming or multi-turn state → core/memory plus synthesis/*/memory. The directory-level layout of these packages, including the per-family synthesis.py files and where CameraCtrl/MotionCtrl live, is in Runtime assembly. Profile-only shells are not complete integrations.

Static inference presets live under worldfoundry/data/models/: catalog/ for metadata, bindings/ for pipeline entrypoints, runtime/profiles/ for execution requirements, runtime/environments/ for dependency specs, and runtime/configs/<model>/ for YAML/JSON presets and example inputs. Resolve a bundled file without depending on the working directory:

from worldfoundry.core.io.paths import package_data_path

config = package_data_path(
    "models", "runtime", "configs", "wonderjourney", "base-config.yaml"
)

Runtime manifests may use ${WORLDFOUNDRY_DATA_ROOT}/models/runtime/configs/<model>/<file>; WorldFoundry expands the token before launch. Keep relative inheritance inside each model directory. Configuration classes stay in Python modules. Training recipes, checkpoints, datasets, and generated job configs do not belong in packaged data.

Reference Implementation: OpenVLA

openvla is the reference VLA integration and the best example for understanding embodied-action runtime design. Its goal is simple: one checkpoint loader serves both Studio one-shot action traces and benchmark closed-loop rollouts, without requiring users to clone the upstream GitHub repository.

The embodied closed-loop path starts in runtime config. data/models/runtime/configs/vla_va_wam/openvla.yaml declares backend: callable_entrypoint and points policy_target to worldfoundry.synthesis.action_generation.openvla.runtime:predict_action. Embodied eval reads that config in evals/tasks/embodied/policy_adapter.py through build_policy_adapter(), then wraps the callable with CallableRuntimePolicyAdapter in evals/tasks/embodied/adapters/runtime_policy_adapters.py. Simulator rollouts therefore need only a language instruction and RGB observation to obtain one robot action, without going through the full pipeline lifecycle.

Studio and one-shot action traces still use the pipeline path. OpenVLAPipeline (built in pipelines/component_pipelines.py) binds OpenVLASynthesis; OpenVLASynthesis.predict() resolves the runtime profile, selects a checkpoint, writes a plan JSON, and dispatches real inference unless plan_only is set. That path is better suited to single jobs that need artifact files, a run directory, and profile metadata rather than step-by-step simulator interaction.

Both entrypoints converge on synthesis/action_generation/openvla/engine.py. select_openvla_checkpoint() chooses a locally staged base or LIBERO fine-tuned checkpoint from unnorm_key. OpenVLARuntime then loads processor/model, builds the official OpenVLA prompt, runs predict_action, and writes normalized action-trace metadata. Prismatic/OpenVLA HF config, model, and processor code are vendored in the same package as configuration.py, modeling.py, and preprocessing.py, so the runtime does not depend on external repo checkouts or Hugging Face remote-code cache.

If you add a similar VLA policy, you usually need three pieces: a callable config under data/models/runtime/configs/vla_va_wam/, a predict_action() entrypoint in synthesis/action_generation/<model>/runtime.py, and an embodied adapter that can resolve image and instruction fields from simulator observations. Pipeline/synthesis layers can follow later for Studio and model-zoo one-shot runs, but they should not be prerequisites for closed-loop eval.

Pipeline authoring conventions

A typical pipeline file stores synthesis, operator, representation, and runtime config in its constructor; from_pretrained() stages checkpoints or initializes API clients; process() / __call__() converts user input into artifacts; and stream() is implemented only when Studio live controls or incremental output require it. Helpers should remain limited to reproducibility, credential handling, or artifact semantics. Do not carry training-script-style experiment logic into public pipelines.

Pipelines with model-owned interactive state expose stream_state_ready(); optional init_stream(...) initializes that state without generating a chunk. Studio forwards the same model inputs as direct calls and does not seed or overwrite that memory. Input conversion stays in the operator, state transitions in the pipeline/memory, and cache leases and transport cancellation in Studio. The shared driver applies these transitions consistently to ordinary, realtime, and distributed actions. See Studio internals for lifecycle and validation boundaries.

Decoded in-memory video can use core.media.processing.postprocess.VideoChunk with explicit layout and value_range; frame_count follows the declared time axis. The native visual adapter includes it as video_chunk in structured fresh/stream results, with signed pixels by default and family-declared unsigned overrides. Keep latent outputs separate from RGB. Reuse canonical conversion for transport and artifact export rather than inferring pixel semantics from the observed minimum or dimensions.

The model-owned RuntimeVideoSynthesis adapter declares its normalized RGB arrays as THWC byte pixels. It also accepts declared chunks from its runtime, so layout and value range take precedence over heuristics. ABot-World declares unit-range TCHW output in both batch and realtime calls. The resident realtime sessions for Matrix-Game 2/3, LingBot and its V2 variants, DreamX camera/AR, and Helios declare THWC byte chunks after their existing decoder conversion. Existing raw returns and result aliases remain available; adding a declaration does not copy or re-encode the frames. Non-output distributed ranks keep their no-frame result rather than claiming an RGB chunk.

WorldFM declares its existing byte-frame list while retaining scene context, intrinsics and camera poses as separate fields. LingBot's ordinary batch and rolling-frame continuation declare THWC unit-range floats; the artifact exporter uses the same declared pixels as preview and transport. LingBot V2 batch declares the THWC byte frames decoded from its preserved MP4, not the pre-encoding model tensor. LongVie declares its PIL RGB frame list without replacing the frames, history or noise used for queued-segment continuation. Frame-list post-processing reads PIL geometry without materializing pixels. Structured stream returns are explicit options on these adapters; LongVie and LingBot V2 also expose frame-count and frame-rate parameters to shared dispatch.

Matrix-Game 2 batch/rolling-frame continuation declares a unit-range frame list after its existing control-visualization conversion; its resident realtime byte chunks retain their distinct declaration. Matrix-Game 3 batch declares THWC byte pixels read from the retained artifact, and stream preserves that structured result when requested while recording raw frames. Its non-output rank declares no chunk, does not copy a nonexistent rank-local artifact, and does not add empty output to frame memory. Matrix-Game 1 and 3.5 retain their artifact-only result semantics.

GEN3C declares signed BCTHW decoded pixels and uses that declaration for export; latent results declare no RGB chunk and do not replace rolling-frame memory. Lyra-1 retains the GEN3C declaration for its primary video and each runtime trajectory, alongside reconstruction inputs and camera/latent artifacts. Dynamic continuation uses declared RGB pixels for its reference frame. Lyra-2 declares its normalized THWC byte output while retaining the decoded tensor, camera trajectory and zoom fields. Astra declares the cropped PIL RGB frame list without replacing autoregressive latent history. Structured results include FPS, and shared dispatch requests declarations on supported stream routes.

Astra batch requests share loaded synthesis weights while keeping active latent history, camera embeddings, prompt conditioning, seeded RNG and scheduler calendars request-local. AstraPipeline.memory exposes the latest completed rollout; publication follows successful decode and optional export. AstraMemory.total_latent_frames advances independently of the bounded first-plus-recent history, so camera rows remain aligned after eviction while FramePack indices stay chunk-local. Explicit direction inputs leave operator interaction history unchanged. The synthesis owner serializes Wan VAE scratch use and clears its canonical temporal cache on success or unwinding, retaining loaded weights.

LingBot realtime resolves the TAE input convention when loading the decoder. taew2_1 consumes normalized Wan latents; lighttaew2_1 consumes raw latents after per-channel mean/std conversion. Renamed checkpoints require WORLDFOUNDRY_LINGBOT_TAE_LATENT_FORMAT=raw|normalized. The selected convention stays with the loaded decoder, including LingBot V2's inherited TAE route; its full Wan decoder route retains its own conversion.

HY-WorldPlay's native realtime adapter shares the loaded transformer, encoders and canonical Hunyuan 1.5 VAE. Each session owns its runtime state, scheduler, text/vision KV, geometry sampling generator, camera history and latent prefix. A runtime-owner lock serializes realtime access to shared placement/offload operations. Reset and interruption release only that session's state. The existing AR operations advance four latent frames per call; canonical causal-prefix decoding emits 13 RGB frames initially and 16 thereafter as declared THWC bytes. Decode work and retained history grow with the prefix; this route does not promise bounded latency.

The independent Cosmos Predict2/2.5, Transfer2.5, Cosmos3, T2V-Turbo and Vchitect adapters declare signed BCTHW pixels; HunyuanVideo and 1.5 declare their decoder's unit-range BCTHW output. Export uses the same declaration and retains raw tensors, latent fields and metadata. Cosmos3 keeps sound, audio sampling rate and action outputs independent. HunyuanVideo, Turbo and Vchitect expose structured stream returns, FPS and frame count; artifact history does not replace explicit conditioning, and latent calls do not update it.

An explicit video_chunk: None means the result contains no RGB output. Preview and realtime transport do not fall back to raw video aliases in that case. An empty declared chunk remains a buffering result; only producers without a declaration use legacy pixel inference.

VisualFrameMemory honors a structured result's video declaration when selecting the last RGB frame and recording frame history, while retaining the original video and result references. Planned or blocked Lyra results retain their status and camera/action metadata; they do not claim RGB output, trigger video export/reconstruction, or replace generated frame memory.

Artifact-only runtimes retain paths and metadata. OfficialVideoPipeline.stream(return_dict=True) preserves that structured result; its artifact history is not rollout state and cannot replace a later explicit conditioning image. Geometry, action traces, provider jobs and latent outputs retain their own contracts rather than acquiring a video wrapper. Legacy producers without a declaration still use the existing fallback.

Hosted API paths

Hosted provider paths such as Wan hosted family, Kling, Runway, Luma Ray, Hailuo hosted, Sora/Veo API, and World Labs live in separate wrappers under pipelines/, kept apart from local checkpoint runtimes. Hosted wrappers usually stage local images, build provider payloads, or wait for remote jobs to finish; they should not silently reuse local diffusion checkpoint loaders. Provider credentials belong in environment variables only. Do not place API keys in manifests, docs, tests, or generated reports.

Bridge to evaluation

The evaluation runner does not import pipeline files directly unless the catalog model runner resolves to that route.

Call graph
Bridge to evaluation
Catalog<model-id>.yaml<category>/<model-id>.yaml
read binding fields
Bindingrunner_target / pipeline_target / runtime_profile
Resolverresolve_pipeline_route()zoo/bindings.py:327
Resolverresolve_model_zoo_runner()runners/resolver.py:386
generate()
ExecutionPipeline class or subprocess
normalize artifacts
ArtifactGenerationResult
The evaluation runner never imports a pipeline file unless this chain resolves to that route.

resolve_pipeline_route() (zoo/bindings.py) and resolve_model_zoo_runner() (evals/models/runners/resolver.py) turn that chain into a runnable runner. The catalog-parsing, spec-merging, and runner-resolution mechanics behind them are documented in Evaluation Core — Model Resolution. Planned or profile-only entries may keep runtime_profile but should not expose a runner target; thin planning wrappers must not advertise pipeline_target as verified support.

Model family inventory

For directory-level guidance on where each kind of model fix belongs (pipelines/, operators/, synthesis/, base_models/three_dimensions/, core/memory), see Runtime assembly. For models with a claimed runnable runner, document public class behavior and public methods. For unclaimed or archived wrappers, keep only a short index entry instead of expanding implementation detail.