# `Tune.Optimizers.Avatar`
[🔗](https://github.com/mikehostetler/tune/blob/v0.5.0/lib/tune/optimizers/avatar.ex#L1)

Contrastive instruction improvement for one named predictor.

The unchanged program is evaluated on validation first. Then, for up to
`max_iters` iterations, the current program runs on the training set.
Trajectories scoring at least `upper_bound` are positive; failed runs and
scores at most `lower_bound` are negative, so a failure is never positive.
The proposal role compares up to `max_positive` positive and
`max_negative` negative trajectories and writes feedback, then rewrites the
named predictor's instruction from that feedback. Each rewrite is validated
before it can be returned; only that predictor's instruction changes. If
either group is empty the search stops cleanly with stop note
`:no_contrast` and returns the best validated program.

Options: `:predictor` (required name), `:upper_bound` and `:lower_bound`
(required scores), `:max_iters` (default 3), `:max_positive` and
`:max_negative` (default 5).

Differences from DSPy: this operates on a declared predictor instruction and
ordinary program traces; it needs no Avatar agent runtime or tools.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
