TECHNOLOGY

BentoML depends: parallel model calls still need an aggregation contract

In this article
THE QUICK TAKE

Concurrent dependency calls schedule independent work; the parent endpoint must define how the returned model outputs form a valid response.

Concurrent results can disagree semantically

A moderation endpoint asks a classifier and a language detector about the same document. Parallel execution shortens the dependency path when the calls are independent, but does not establish whether classifier labels are valid for the detected language. Returning both dictionaries is an API design choice, not evidence of compatible interpretation.

Define which branch owns each field, what input revision each branch receives and which combinations constitute a successful parent response. This makes composition assessable before any timing optimization is applied.

Depends expresses a service dependency

The composition guide demonstrates bentoml.depends, asynchronous service calls and concurrent aggregation. These mechanisms expose callable dependencies; they do not automatically create an application-specific policy for conflicting or absent model outputs.

Keep genuinely dependent work sequential. If the classifier must consume translated text produced by another branch, launching both on the original document changes the computation graph rather than merely accelerating its execution.

Async invocation preserves the waiting boundary

The service guide describes asynchronous APIs and converting synchronous service methods through to_async. Use the documented invocation path instead of directly blocking the event loop with a synchronous dependency call.

Asynchronous waiting does not remove downstream resource limits. The parent can admit more work while a dependency becomes saturated. Treat parent concurrency and child capacity as separate observations, especially when several branches share an accelerator or remote connection pool.

Give the parent output an explicit schema

The IO type guide provides structured endpoint types. A response schema can identify the branch, model revision and interpretation of each result. Define whether a missing branch means failure or a documented partial response.

Label taxonomy mapping explains why identical label strings need not carry identical meanings. Terminal request records similarly distinguish a branch result from the final outcome promised by the parent API.

Test disagreement as well as success

Exercise an unsupported language, a slow dependency and a branch failure with recognizable input identities. Verify the parent response against its declared policy rather than accepting any well-formed dictionary as success.

Measure branch completion separately from parent completion. A valid composed endpoint has a clear rule for consuming each output and producing its final response; parallel scheduling is useful only after that rule matches the intended model behavior.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles