Scoring bundles

A scoring bundle is a ZIP file of Python modules and their data files. The artifact registry holds bundles as named, versioned artifacts. Use a bundle to provide a custom function for a reward term or grader. Optimize runs the function inside a training job or serves it for an evaluation.

Register a bundle

To register a directory or ZIP file under a name in a namespace, use the corresponding command:

akka optimize registry bundles register gsm8k/scoring -f scoring/
akka optimize registry bundles register gsm8k/scoring -f scoring.zip --alias candidate

Registering the same archive under the same name returns the existing version. The command prints the registered version, such as gsm8k/scoring:v1.

A run names a bundle by registry reference. The reference gsm8k/scoring resolves through latest, and gsm8k/scoring:v2, gsm8k/scoring:candidate and gsm8k/scoring@sha256:…​ name a version directly. Optimize resolves the reference when it admits a run and records the exact version, so moving an alias later does not change accepted work. A reference without a namespace names a bundle in the training project’s namespace, so in a run plan for gsm8k, scoring is gsm8k/scoring.

Layout

A bundle directory has the following layout:

scoring/
  reward.py
  helpers.py
  tables/
    schema.json

Modules use relative imports for sibling modules, such as from . import helpers. Locate data files through file.

For the function contract, see The bundle function.

Limits

The registry rejects an archive that contains an unsafe path, a symlink, a reserved top-level module name, or no Python code. It also rejects an archive that exceeds the registry’s limits on archive size, unpacked size or entry count.

Optimize refuses a run if the run cannot read the registered bundle from its storage location.

Your bundle code runs without a sandbox inside the training job.

Use a bundle

To use a bundle as a reward term, name it in the run plan:

kind: rule
weight: 1.0
bundle: gsm8k/scoring
module: reward

To use a bundle as a grader for an evaluation, name it with --grader. A # separates the bundle’s reference from the module, because a reference contains both a slash and a colon:

akka optimize training evaluations start --model gsm8k/qwen3-0.6b:v1 --dataset gsm8k/eval \
  --grader bundle:gsm8k/scoring#reward:compute_score --wait

When Optimize serves the function as a grader, it starts a separate job for the evaluation and stops the job afterward.