crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

SelfImprovingFlow: hardcoded and content selected by string length — metrics are meaningless

Open akrhin opened this issue 4 months ago • 1 comments

Description

In SelfImprovingFlow, the self-improvement module has two issues:

  1. Score is hardcoded to 0.5 instead of being extracted from the LLM response. No real evaluation logic exists.
  2. Content selection uses max(..., key=len) — picks the longest string, not the semantically best option.

Code pattern

# Score is always 0.5 regardless of quality
score = 0.5

# Picks the longest mutation, not the best one
best_content = max(mutations, key=len)

This means:

  • Self-improvement metrics are meaningless for any downstream use (comparison, plotting, decision-making)
  • Content "improvement" just returns the longest output, which is often verbose/low-quality

Expected

  • Score should be extracted from the LLM response when the model returns a structured evaluation (or via a separate scoring call)
  • Content selection should use a quality heuristic or the actual evaluation score, not string length
  • If scoring cannot be done, the score field should be omitted rather than hardcoded

Environment

  • CrewAI: 1.15.5
  • Python: 3.11

akrhin avatar Jul 25 '26 00:07 akrhin

Closed — configuration/customization issue, not a core framework bug.

akrhin avatar Jul 25 '26 00:07 akrhin