163 lines
3.6 KiB
YAML
163 lines
3.6 KiB
YAML
name: coding-tasks
|
|
description: Synthetic coding tasks, sandbox-validated and probed by an agent
|
|
nodes:
|
|
synth:
|
|
type: llm.synthesize
|
|
params:
|
|
model: generator
|
|
kind: task
|
|
calls: 1
|
|
batch: 4
|
|
key_field: name
|
|
prompt: 'Invent {{ batch }} small, self-contained Python exercises of mixed difficulty (variation
|
|
{{ i }}). For each give: `name` (snake_case id), `statement` (what to implement), `signature`
|
|
(the single `def ...:` line), `solution` (a complete solution.py module), and `tests` (a Python
|
|
script that does `from solution import *`, checks the behaviour with plain `assert`s, and prints
|
|
ok). Use only the standard library.'
|
|
item_schema:
|
|
type: object
|
|
required:
|
|
- name
|
|
- statement
|
|
- signature
|
|
- solution
|
|
- tests
|
|
properties:
|
|
name:
|
|
type: string
|
|
statement:
|
|
type: string
|
|
signature:
|
|
type: string
|
|
solution:
|
|
type: string
|
|
tests:
|
|
type: string
|
|
prepare:
|
|
type: map.expr
|
|
params:
|
|
fields:
|
|
stub: payload.signature + '\n raise NotImplementedError\n'
|
|
files: '{''test_solution.py'': payload.tests}'
|
|
inputs:
|
|
in: synth.out
|
|
validate:
|
|
type: sandbox.check
|
|
params:
|
|
pool: sandbox
|
|
files_expr: payload.files
|
|
checks:
|
|
- name: gold
|
|
files:
|
|
solution.py: '{{ payload.solution }}'
|
|
command: python3 test_solution.py
|
|
expect: pass
|
|
timeout: 60
|
|
- name: empty
|
|
files:
|
|
solution.py: '{{ payload.stub }}'
|
|
command: python3 test_solution.py
|
|
expect: fail
|
|
timeout: 60
|
|
inputs:
|
|
in: prepare.out
|
|
valid:
|
|
type: filter.expr
|
|
params:
|
|
expr: labels.valid
|
|
inputs:
|
|
in: validate.out
|
|
rollouts:
|
|
type: flatmap.repeat
|
|
params:
|
|
k: 2
|
|
inputs:
|
|
in: valid.out
|
|
probe:
|
|
type: agent.run
|
|
params:
|
|
harness: solver
|
|
pool: sandbox
|
|
max_turns: 12
|
|
prompt: |-
|
|
{{ payload.statement }}
|
|
|
|
Implement it in solution.py with this signature:
|
|
|
|
{{ payload.signature }}
|
|
|
|
solution.py currently contains a stub.
|
|
files:
|
|
solution.py: '{{ payload.stub }}'
|
|
grade:
|
|
command: python3 test_solution.py
|
|
files:
|
|
test_solution.py: '{{ payload.tests }}'
|
|
timeout: 60
|
|
inputs:
|
|
in: rollouts.out
|
|
timeout: 600.0
|
|
retries: {}
|
|
passrate:
|
|
type: join.group
|
|
params:
|
|
by: labels.group
|
|
kind: task_result
|
|
aggregates:
|
|
pass_rate:
|
|
- mean
|
|
- labels.passed
|
|
rollouts:
|
|
- count
|
|
- '1'
|
|
inputs:
|
|
in: probe.out
|
|
bucket:
|
|
type: route.expr
|
|
params:
|
|
default: too_hard
|
|
routes:
|
|
too_easy: labels.pass_rate == 1
|
|
learnable: labels.pass_rate > 0
|
|
inputs:
|
|
in: passrate.out
|
|
export_too_easy:
|
|
type: sink.jsonl
|
|
params:
|
|
path: out/too_easy.jsonl
|
|
fields:
|
|
- key
|
|
- labels.pass_rate
|
|
- labels.rollouts
|
|
inputs:
|
|
in: bucket.too_easy
|
|
export_learnable:
|
|
type: sink.jsonl
|
|
params:
|
|
path: out/learnable.jsonl
|
|
fields:
|
|
- key
|
|
- labels.pass_rate
|
|
- labels.rollouts
|
|
inputs:
|
|
in: bucket.learnable
|
|
export_too_hard:
|
|
type: sink.jsonl
|
|
params:
|
|
path: out/too_hard.jsonl
|
|
fields:
|
|
- key
|
|
- labels.pass_rate
|
|
- labels.rollouts
|
|
inputs:
|
|
in: bucket.too_hard
|
|
export_invalid:
|
|
type: sink.jsonl
|
|
params:
|
|
path: out/invalid.jsonl
|
|
fields:
|
|
- key
|
|
- labels.checks
|
|
inputs:
|
|
in: valid.rejected
|