Tune.Optimizers.InferRules (Tune v0.5.0)

Copy Markdown View Source

Derives natural-language rules from bootstrapped examples.

The program is bootstrapped with the teacher role. The original program and the bootstrapped program are evaluated on the validation set and both stay selectable. Then num_candidates rule candidates are built: for each predictor, the proposal role derives up to num_rules rules from a shuffled view of that predictor's bootstrapped demonstrations, and the rules are appended to its instruction. Each candidate keeps the bootstrapped demonstrations and is evaluated on validation; the best complete eligible candidate is returned, so a worse rule set is never chosen.

Options: :num_candidates (default 2), :num_rules (default 5), and BootstrapFewShot options (:accept_score required).

Summary

Functions

Appends rules to an instruction in the inspectable format used by InferRules.

Functions

with_rules(instruction, rules)

@spec with_rules(String.t(), [String.t()]) :: String.t()

Appends rules to an instruction in the inspectable format used by InferRules.