Models

What Is Hyperparameter Optimization?

The search for the best combination of training-time configuration values, such as learning rate or batch size, that are set before training rather than learned from data.

What Is Hyperparameter Optimization?

Hyperparameter optimization (HPO) is a model-training practice for finding the best configuration values that are set before training, not learned from data. Those values include learning rate, batch size, dropout, regularization, optimizer choice, and architecture knobs such as layer depth. In production LLM work, HPO also has a runtime analog: searching temperature, top-p, and prompt variants. FutureAGI evaluates candidate outputs from those sweeps so teams can choose the model or prompt configuration that improves task quality without regressions.

Why hyperparameter optimization matters in production LLM and agent systems

The wrong hyperparameters can quietly cap a model’s ceiling. A learning rate one decade too high diverges; one decade too low underfits. A batch size that fits memory but is too small produces noisy gradients; too large wastes compute. For LLM fine-tuning, the wrong rank in LoRA adapters or wrong alpha in DPO can leave a usable model that’s clearly inferior to a better-tuned variant on the same data.

The pain shows up across roles. An ML engineer fine-tunes a 7B model, ships it, and watches downstream eval-fail-rate creep — a missing HPO sweep meant the deployed checkpoint wasn’t the best one. An infra engineer sees training cost balloon because the team retrains from scratch on each hyperparameter change instead of running a structured search. A product lead sees the model “work fine” but never reach the numbers a competitor’s better-tuned version hits.

In 2026 LLM stacks, the surface extends beyond training. Decoding hyperparameters (temperature, top-p) shape every production response. Prompt variants — system prompt, few-shot examples, format instructions — function as runtime hyperparameters with the same combinatorial search problem. Useful symptoms: stuck eval scores that respond to small config tweaks, validation-loss curves with obvious sub-optimality, and decoding-driven output variance that no rubric was designed to catch.

How FutureAGI handles hyperparameter optimization

FutureAGI doesn’t run HPO — we don’t tune optimizers or sweep training configs. What we provide is the evaluation backbone that makes HPO results comparable and the regression eval that catches when a new configuration hurts production quality. Each candidate model from an HPO run is registered against a versioned Dataset, scored by Dataset.add_evaluation with the team’s evaluator suite (TaskCompletion, AnswerRelevancy, Faithfulness, custom rubrics), and ranked on the metrics that actually matter for the deployed task — not just validation loss.

For runtime HPO of decoding parameters and prompts, FutureAGI’s prompt-optimization stack — including ProTeGi, GEPA, and PromptWizard optimizers — does the search directly, scoring candidates against the same evaluator suite. A team that runs PromptWizard over a 50-prompt search space gets back a Pareto front of prompts plus their TaskCompletion and cost-per-trace numbers, ready for a release-gate regression.

Concretely: a fine-tuning team trains 12 LoRA variants with different ranks and alphas, logs each candidate with fi.client.Client.log, registers outputs in fi.datasets.Dataset, and dashboards eval-fail-rate-by-cohort per variant. The best HPO winner on validation data shows a 4% regression on a customer-support cohort that was under-represented in training — the team picks the second-best validation model that holds up across cohorts. Without the cohort-sliced regression eval, they would have shipped the validation winner and quietly degraded support quality.

Unlike Optuna or Ray Tune, which optimize against a single objective, FutureAGI’s approach is to anchor HPO winner-selection in production-grounded evaluators tied to specific user cohorts and tasks.

How to measure or detect hyperparameter optimization

HPO quality should be measured at three levels: the training candidate, the generated outputs, and the release gate. Treat validation loss as a debugging signal, then rank candidates on task-specific evals and cohort behavior.

  • TaskCompletion — returns 0–1 per trajectory; the canonical end-to-end signal for picking an HPO winner.
  • AnswerRelevancy — scores whether the response addresses the user’s question; useful as a complementary signal to validation loss.
  • Faithfulness / Groundedness — pair with retrieval setups so HPO doesn’t trade hallucination for fluency.
  • Dataset.add_evaluation — attaches the same evaluator suite to every candidate output set so comparisons stay versioned.
  • Eval-fail-rate-by-cohort (dashboard signal) — surface cohort-specific regressions a single validation number hides.
  • Cost-per-trace and latency p95 — catch HPO winners that improve quality by spending too many tokens or slowing the workflow.
  • ProTeGi / GEPA / PromptWizard — agent-opt optimizers for prompt-level HPO, scored against the same evaluator suite.
from fi.evals import TaskCompletion, AnswerRelevancy

task, relevancy = TaskCompletion(), AnswerRelevancy()
for candidate_id, outputs in hpo_runs.items():
    task_mean = sum(task.evaluate(input=o.input, trajectory=o.trajectory).score for o in outputs) / len(outputs)
    rel_mean = sum(relevancy.evaluate(input=o.input, output=o.output).score for o in outputs) / len(outputs)
    if task_mean < 0.92 or rel_mean < 0.90:
        print("hold", candidate_id, task_mean, rel_mean)

Common mistakes

The failures are usually selection errors and weak cohort coverage decisions, not optimizer bugs:

  • Picking HPO winners by validation loss alone. Lower loss can hide worse task completion when support, safety, or long-tail cohorts are under-represented.
  • Ignoring decoding hyperparameters. Temperature, top-p, and max tokens often change production behavior more than a small adapter-rank sweep.
  • Running one-shot HPO on stale data. Hyperparameters interact with data distribution; rerun sweeps after major corpus, prompt, or policy changes.
  • Using grid search for continuous parameters. Random search, Bayesian search, or Hyperband usually covers sensitive ranges with fewer failed runs.
  • Skipping the regression eval gate. An HPO winner that fails cohort-sliced evaluation is a benchmark winner, not a deployable production candidate.

Frequently Asked Questions

What is hyperparameter optimization?

Hyperparameter optimization is the search for the best combination of training-time configuration values — learning rate, batch size, dropout — that aren't learned from data but set before training.

How is hyperparameter optimization different from fine-tuning?

Fine-tuning updates model weights using new data. HPO searches over training-time configuration values that govern how fine-tuning or pre-training happens. You typically run HPO around a fine-tuning loop, not as a replacement for it.

How does FutureAGI fit into hyperparameter optimization?

FutureAGI doesn't run HPO; we evaluate the outputs of models trained with it. The TaskCompletion and AnswerRelevancy evaluators plus a versioned Dataset.add_evaluation pipeline catch when a new HPO configuration hurts quality before deploy.