Skip to main content
Before loading weights, trace one example from input to output on paper. At each boundary, write down the tensor names, shapes, and which node consumes them. Those names become the graph’s edges.

Build the walks

get_graph_walk_graphs() returns a mapping from walk names to graph sections. Use GraphNode for one submodule, Sequential or Parallel to compose nodes, and Loop for repeated work. If the same node name appears in several walks, those walks use the same submodule and its state. In Orpheus, the LLM’s decode node has two outputs on each iteration. One edge routes the sampled token to the LLM as the next input. A streaming edge sends the token to the SNAC audio decoder. The decoder’s output targets EMIT_TO_CLIENT with output_modality="audio". An ordinary GraphEdge describes a possible output. A forward may produce a subset, as BAGEL does when a prefill updates its cache without sampling text. Graph primitives walk_plan() chooses the sequence for a particular request. Use a WalkStep with a binding when successive walks need different input spans. At ingest, a known output budget or denoising step count can set a named loop’s cap in get_loop_caps(). For a data-dependent end, such as a sampled EOS, the submodule reports completion in check_stop. Model interface · WalkStep

Prepare a request

A model instance in the API process loads configuration and tokenizers. process_prompt validates the request, prepares tensors, and supplies the metadata used when scheduling. The weights for a node belong in get_submodule, called for the workers hosting it. Load just that node and reuse a constructed submodule if another walk needs it. Keep small host values that are already known at ingest in metadata. Put audio, image tensors, embeddings, and other bulk data on named tensor edges. Declare accepted model-specific request settings in request_kwargs(). For sampling and output budgets, use the shared request settings and validate the model’s actual capabilities. Unknown keys are logged and ignored. Raise ValueError in process_prompt or walk_plan to refuse an invalid request with a 400. For a new multimodal decoder, let the shared scaffold handle prompt intake. DeclaredDecoderModel chooses the walk for the available media encoders. The scaffold builds the media_layout metadata entry from PreparedMedia. It records the relationship between encoder rows and media pads in the prompt. Test two attachments separated by text so reversing the embeddings cannot pass unnoticed. Scaffold · Prompt-order tests

Run a node

The worker can plan a later step while the current one is in flight. Calling .item() on a GPU tensor in preparation, or copying it to the CPU in a forward, introduces a synchronization there. A known loop count can avoid computing an extra speculative iteration. If a node cannot tolerate speculation, set enable_async_scheduling=False on its graph node. Submodule signatures · Async execution stages

Stream between partitions

Use a second partition when a consumer has its own walk schedule. Connect the producer’s streaming edge to a Connection with a chunk policy. The consumer’s buffer assembles each chunk. An audio codec that needs neighboring frames may read overlapping windows while emitting each frame once. Test a boundary in the middle of the stream and the final flush. Orpheus example · Stream buffer A connection from the CLIENT sentinel declares input from the caller. Implement process_stream_chunk to turn an append into tensor lists by edge name, or declare ClientAudio on every client stream to use the built-in decoder. A consumer that has already processed its last data can receive an empty final chunk. Its completion path must still finish the partition. Client streaming interface · Topology

Check a port

Exercise an intake error, one row, a mixed-length batch, and each output modality the model claims. Test graph declarations in dummy mode before loading a checkpoint. Test eager and captured forwards against the reference on real weights. A model serving an OpenAI route needs matching adapters for the Rust frontend and Python frontend. Use the adapter parity suite for the routes you added.