Imp.Optimizer.InstructionSearch (Imp v0.5.0)

Copy Markdown View Source

Search over candidate signature instructions and keep the best program.

InstructionSearch is the small, explicit optimizer underneath instruction-only workflows such as Imp.Optimizer.SignatureOptimizer and coordinate prompt optimization. It evaluates each proposed instruction on the dev set, evaluates the original program as a baseline, and attaches an optimizer report to the selected program. The original program wins equal-score ties so a rewrite must demonstrate an actual validation gain.

Failed candidates are recorded in the report instead of aborting the whole compile. If every evaluation fails, compile/6 returns the original program with a diagnostic report.

Summary

Functions

candidate_instructions(program, trainset, opts \\ [])

compile(program, metric, trainset, devset, candidates, opts \\ [])

current_instruction(program)

current_instruction(program, predictor_name)

Returns the instruction of one explicitly named optimizer predictor.

put_instruction(program, instruction)

put_instruction(program, predictor_name, instruction)

Replaces the instruction of one explicitly named optimizer predictor.