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

Returns a `Tune.KNN` program whose pool is the training set.

Compilation makes no model calls. Each later run retrieves the `k` nearest
training rows for its input and bootstraps demonstrations from them with
the teacher role, so running the result needs a teacher configuration and
an explicit `:max_model_calls`, and every teacher call is counted.

Options: `:k` (default 3), `:max_bootstrapped_demos` (default `k`),
`:max_labeled_demos` (default 0), `:vectorizer` (function, default bag of
words).

Differences from DSPy: no embedding service is called; retrieval uses the
supplied pure vectorizer. Bootstrapping accepts every successful neighbor
trajectory, as DSPy does when no metric is given.

---

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