Why Manual Prompt Iteration Doesn't Scale
~10 min read
The problem Opik Agent Optimizer solves: manually tweaking a prompt, running it, eyeballing the output, and repeating doesn't scale — and results can degrade when you switch models.
Before looking at any tool, it's worth being precise about the actual problem being solved, since it shapes why the rest of this topic's approach makes sense. Developers manually iterate through prompts to find an optimal one. This is not scalable and performance can degrade across models — this is this course's own framing of the pain point, and it's worth unpacking both halves.
The 'not scalable' half is the more obvious one: the standard manual workflow is write a prompt, run it against some examples, eyeball whether the outputs look good, tweak the wording, and repeat. This works fine for a handful of iterations on a single prompt. But it breaks down as the number of prompts in a real system grows (a production agent might have a dozen prompts across different tools and reasoning steps), as the evaluation criteria get more nuanced than 'looks good to me,' and as the team doing this iteration doesn't scale with the number of prompts needing attention.
The 'degrades across models' half is subtler and easy to miss: a prompt hand-tuned against GPT-4o's specific quirks and response style isn't guaranteed to work equally well against a different model (say, a locally-run Llama-3, or a future model version). Manual tuning tends to overfit to the specific model you tested against, without you necessarily realizing it — the prompt 'works' because you unconsciously tuned it to that model's particular behavior, not because it's genuinely a robust, well-specified instruction.
The fix this topic covers is the Opik Agent Optimizer toolkit, which lets you automatically optimize prompts for LLM apps. The core idea: start with an initial prompt and an evaluation dataset, and let an LLM itself iteratively improve the prompt based on evaluations — replacing the human doing the tweak-run-eyeball loop with an automated, dataset-grounded version of the same process. This doesn't remove the need for a human to define what 'good' looks like (that's still your evaluation dataset and metric) — it removes the human from the repetitive, manual iteration loop itself, and grounds every iteration in measurable evaluation scores rather than a subjective 'looks good.'
💻 Code example
# Illustrating the manual loop this topic replaces — and why it
# doesn't scale as the number of prompts and models grows.
def manual_prompt_iteration_loop(prompt: str, test_inputs: list[str], eyeball_check) -> str:
"""The status-quo workflow: tweak, run, eyeball, repeat —
entirely dependent on a human's time and subjective judgment."""
for _ in range(5): # however many rounds a human has patience for
outputs = [f"<simulated LLM output for prompt={prompt!r}, input={i!r}>" for i in test_inputs]
if eyeball_check(outputs): # a human, subjectively, decides "good enough"
return prompt
prompt = input(f"Current prompt: {prompt}\nTweak it: ") # manual edit
return prompt
# The core problem: this doesn't scale past a handful of prompts,
# and a prompt tuned this way against one model may not transfer
# to another model's behavior — the exact gap Opik's automated,
# dataset-grounded optimization loop (next subtopics) is built to close
💬 Deep Dive with AI
Key points
- •The problem: manually tweaking a prompt, running it, eyeballing the output, and repeating doesn't scale as prompt count grows
- •A subtler problem: prompts hand-tuned against one model's quirks can silently overfit and degrade when you switch models
- •Opik Agent Optimizer replaces the manual tweak-run-eyeball loop with an automated, dataset-grounded iteration process
- •The core idea: start with an initial prompt and an evaluation dataset, let an LLM iteratively improve the prompt based on evaluations
- •This doesn't remove the need to define what 'good' looks like — it removes the human from the repetitive iteration loop itself