Skip to main content

Batch inference

Partition a large input, infer concurrently, and merge traceable predictions.

Import this workflow from AkôFlow Hub

Open the public README and measured execution results. The Hub includes the execution capture, activity metrics, logs and version history. Reading public results does not require an account.

In Desktop, choose Create workflow → Import from Hub and paste this version-specific URI:

akoflow://hub/publications/9c21df75-0cfd-4074-bb78-1197857d43a7/versions/1

Download the exact workflow YAML (v1). Configure the runtime prerequisites below before planning and executing it.

Run this example locally

Train/load a small numeric model, split versioned input values into three disjoint shards, execute real inference in parallel, validate that the merged indices have no gaps or duplicates, and publish predictions as JSON Lines.

Install Go and Python 3.12 or newer.

git clone https://github.com/UFFeScience/akoflow-examples.git &&
cd akoflow-examples &&
git checkout --detach d890c3171e3661890305b763b8fc3ede48bb61b4 &&
cd machine-learning/batch-inference &&
./prepare.sh &&
./run.sh

Run the block from the directory where you keep your repositories. If you already cloned the repository, enter this example's directory and run ./prepare.sh && ./run.sh.

Preparation downloads the Go module and any declared Python packages once. The workload then runs locally with offline input data. Every meaningful step is a separate process; independent activities run in parallel after their dependencies complete.

Read outputs/manifest.json for the generated artifacts, outputs/dag-validation.json for dependency waves, and outputs/stage-<activity>.json for each activity's observed result. A failed stage stops the run and prevents a successful final manifest.

Expected outputs: predictions.jsonl, batch-summary.json.

Run the same activities in Desktop

Start your local AkôFlow daemon with Docker available and configure AKOFLOW_API_TOKEN in your shell. From this example's directory, run:

go run ../../tools/daemon-local -root ../.. -example machine-learning/batch-inference

This command validates the daemon connection, builds the declared image, registers the local environment and workflow, and submits a real run. The daemon owns execution and file transfers. Open the printed run ID in Desktop to inspect each activity.

Batch inference. Nodes in the same column can run in parallel once their dependencies complete.

Activity responsibilities

ActivityResponsibility
load-modelExecute the load-model stage and publish its declared outputs for downstream activities.
partition-inputExecute the partition-input stage and publish its declared outputs for downstream activities.
infer-shard-aExecute the infer-shard-a stage and publish its declared outputs for downstream activities.
infer-shard-bExecute the infer-shard-b stage and publish its declared outputs for downstream activities.
infer-shard-nExecute the infer-shard-n stage and publish its declared outputs for downstream activities.
merge-predictionsExecute the merge-predictions stage and publish its declared outputs for downstream activities.
publishExecute the publish stage and publish its declared outputs for downstream activities.

Inputs

  • Approved model
  • Input dataset
  • Inference configuration

Outputs

  • predictions.jsonl
  • batch-summary.json

Provenance to preserve

  • Shard boundaries
  • Model digest
  • Per-shard logs

Source bundle

The executable workflow and its implementation files are maintained in the separate AkôFlow examples repository. The documentation intentionally keeps code, container recipes, generators, and validation scripts out of the narrative page.

Open the complete source bundle ↗

Execution evidence

Verified on local Docker: 7/7 activities completed. These captures belong to run showcase-batch-inference-local-db2bb7c2e2-run-20261020t190931.412001000.

Read the daemon execution record · Local output manifest

Open full resolution ↗Batch inference: observed activity DAG
The observed activity graph. Click to see the complete capture.

Each stage also ran through the standalone local command. Read the dependency and artifact validation.

load-model

After: workflow start.

Open full resolution ↗Execution record for activity load-model

Read the measured local activity result

partition-input

After: load-model.

Open full resolution ↗Execution record for activity partition-input

Read the measured local activity result

infer-shard-a

After: partition-input.

Open full resolution ↗Execution record for activity infer-shard-a

Read the measured local activity result

infer-shard-b

After: partition-input.

Open full resolution ↗Execution record for activity infer-shard-b

Read the measured local activity result

infer-shard-n

After: partition-input.

Open full resolution ↗Execution record for activity infer-shard-n

Read the measured local activity result

merge-predictions

After: infer-shard-a, infer-shard-b, infer-shard-n.

Open full resolution ↗Execution record for activity merge-predictions

Read the measured local activity result

publish

After: merge-predictions.

Open full resolution ↗Execution record for activity publish

Read the measured local activity result

Execution considerations

Place shards according to memory, accelerator availability, and data locality. The merge stage must detect missing shards.

AkôFlow boundary: the engine schedules, deploys, executes, transfers data, and records evidence. The ML or agent framework remains an implementation choice inside each activity.