Skip to contents

bake_examples() turns rows with known answers into the conversations a generative student learns (contract/baked.md, "The examples table"): one row per conversation, function, messages (the prompt, then the reply: the loss belongs on the reply only), tag, weight, row_id, split ("train" or "validation") and source. They are the messages the student is called with, in every language. export_examples() writes them as JSON lines, with <path>.meta.json beside it saying what made them, for any trainer (TRL's SFTTrainer, Axolotl, Unsloth, a service's upload). Python's functai.bake trains on them itself.

Usage

bake_examples(
  fn,
  rows,
  fixed = list(),
  derived = list(),
  reasoning = FALSE,
  layout = NULL,
  validation = 0.1,
  seed = 0L,
  weight = NULL,
  tag = NULL
)

export_examples(path, fn, rows, ...)

Arguments

fn

An AI function.

rows

Rows with known answers: a data frame with its input and output columns (from rated(), say).

fixed

Inputs with one value in every row, left out of what the student reads: list(guidance = "Keep every number.").

derived

Inputs decided by another input the student still reads: list(guidance = "section").

reasoning

Whether the student learns the reasoning too (a function with .module = "cot").

layout

The layout it is trained with (default: the function's).

validation

The share of rows held out for validation.

seed

The seed choosing them.

weight, tag

Columns of rows giving each row's weight and tag.

path

The JSON lines file to write.

...

Options of bake_examples().

Value

A tibble (bake_examples()), or the path (export_examples()).