Resolved

Evaluator-optimizer loop ignores feedback causing blind regeneration

Python
AI/ML
Feedback Loop
Optimization
LLM
Generator
Evaluator
Debugging

Generator system stuck at GOOD ratings due to missing feedback loop between evaluator and optimizer | 4 identical iterations with no improvement despite refinement attempts

Working with a Python-based LLM generator system implementing an evaluator-optimizer pattern, the orchestrator component managed script generation, evaluation, and iterative refinement.

Issue

The evaluator-optimizer loop failed to pass evaluation feedback back to the generator, causing blind regeneration with identical inputs. The system produced four identical “GOOD” rated iterations per script with no improvement, wasting refinement attempts despite evaluator feedback like “Explanations adequate but not insightful” and “Missing pattern identification.”

Culprit

Three technical failures in the orchestrator logic:

  1. Misleading comments falsely suggested temperature variation handled feedback, despite deterministic generation.
  2. No actual temperature variation was implemented; the system relied on a fixed temperature value.
  3. Evaluation feedback was discarded—the evaluation data containing errors and feedback was never passed back to the generator for use in subsequent iterations.

Solution

Feedback Parameter Injection

Modified the orchestrator to:

  • Accept and pass evaluation feedback to the generator methods.
  • Extract and format feedback and errors from the evaluation results for inclusion in the prompt.

Generator Tool Updates

Updated all generator tools to:

  • Accept and utilize previous feedback in their prompts.
  • Include explicit instructions to address feedback in the generated output.

Loop Integration

Modified the evaluator-optimizer loop to:

  • Track evaluation feedback between iterations.
  • Pass feedback to the generator for the next iteration.
  • Ensure feedback from each iteration was used to improve the next one.

Key Implementation Detail: Feedback was formatted as structured markdown and injected into LLM prompts, including both general feedback and specific error lists. This provided explicit improvement targets to the generator, such as “Add deeper insights about decorator pattern” instead of vague improvement instructions.

This solution resolved the blind regeneration issue, ensuring feedback was effectively used to improve the generated scripts iteratively.