Imp.Optimizer.GRPO.Callback (Imp v0.5.0)

Copy Markdown View Source

Stable, data-only callback identity for resumable GRPO jobs.

A callback binds a trusted, already-loaded module and function to a consumer-owned versioned id and JSON-safe configuration. Imp persists only that identity and the configuration digest; it never serializes executable code or reconstructs atoms from saved data.

Reward callbacks receive (example, prediction, config). Validation callbacks receive (program, dataset, context, config).

Summary

Types

kind()

@type kind() :: :reward | :validation

t()

@type t() :: %Imp.Optimizer.GRPO.Callback{
  config: term(),
  config_sha256: String.t(),
  function: atom(),
  id: String.t(),
  kind: kind(),
  module: module()
}

Functions

identity(callback)

invoke(callback, example, prediction)

invoke(callback, program, dataset, context)

new(kind, module, function, opts)

reward(module, function, opts \\ [])

validate(callback, expected_kind)

validation(module, function, opts \\ [])