Recursive Brainstorm
Generate and expand hundreds of creative ideas recursively using LLMs. Perfect for product ideation, domain names, content planning, and comprehensive brainstorming sessions.
What is Recursive Brainstorm?
Recursive Brainstorm takes AI idea generation to the next level by recursively expanding promising ideas into hundreds of refined variations. Instead of a flat list, you get a hierarchical tree of ideas where each good idea spawns more creative variations.
- Three Generation Modes: Tree (exponential expansion), Linear (focused refinement), or Hybrid (balanced)
- Automatic Evaluation: Every idea gets scored against custom criteria
- Structured Output: Ideas organized with quality scores, parent-child relationships, and metadata
- CSV Export: Export all ideas to CSV for analysis in Excel or pandas
- MiniAgent Integration: Use brainstorming as a step in complex workflows
- Async Support: Better performance for large brainstorming sessions
Three Generation Modes
Choose the mode that fits your brainstorming needs:
🌳 Tree Mode
Expands all qualifying ideas recursively for comprehensive exploration.
Best for: Initial ideation, research
Generates: 5 + 25 + 125 = 155 ideas
🎯 Linear Mode
Picks the best idea at each level and refines it further.
Best for: Deep refinement, optimization
Generates: 5 + 5 + 5 = 15 ideas
⚖️ Hybrid Mode
Expands only the top-N highest-scoring ideas (recommended).
Best for: Most use cases
Generates: 5 + 15 + 45 = 65 ideas
Quick Start
from SimplerLLM.language import LLM, LLMProvider
from SimplerLLM.language.llm_brainstorm import RecursiveBrainstorm
# Create LLM instance
llm = LLM.create(
provider=LLMProvider.OPENAI,
model_name="gpt-4o-mini"
)
# Create brainstorm instance
brainstorm = RecursiveBrainstorm(
llm=llm,
max_depth=2, # How many levels deep
ideas_per_level=5, # Ideas per expansion
mode="hybrid" # Balanced exploration
)
# Run brainstorming
result = brainstorm.brainstorm(
prompt="Innovative ways to reduce plastic waste"
)
# Access results
print(f"Generated {result.total_ideas} ideas!")
print(f"Best idea: {result.overall_best_idea.text}")
print(f"Score: {result.overall_best_idea.quality_score}/10")
Configuration Options
RecursiveBrainstorm(
llm=llm, # LLM instance (required)
max_depth=3, # Maximum recursion depth
ideas_per_level=5, # Ideas per expansion
mode="hybrid", # "tree", "linear", or "hybrid"
top_n=3, # For hybrid: top N to expand
evaluation_criteria=[ # Custom scoring criteria
"feasibility",
"innovation",
"impact",
"scalability"
],
min_quality_threshold=6.0, # Min score (1-10) to expand
verbose=True # Print progress
)
| Parameter | Default | Description |
|---|---|---|
max_depth |
3 | Maximum recursion levels (0-indexed) |
ideas_per_level |
5 | Ideas to generate per expansion |
mode |
"tree" | Generation strategy |
top_n |
3 | For hybrid: number of top ideas to expand |
min_quality_threshold |
5.0 | Minimum score to continue expanding (1-10) |
Working with Results
result = brainstorm.brainstorm("Generate marketing strategies")
# Get all ideas
all_ideas = result.all_ideas # List of BrainstormIdea objects
print(f"Total ideas: {result.total_ideas}")
# Get best idea
best = result.overall_best_idea
print(f"Best: {best.text}")
print(f"Score: {best.quality_score}/10")
print(f"Reasoning: {best.reasoning}")
# Get ideas at specific depth
root_ideas = result.get_ideas_at_depth(0) # Initial ideas
level_1_ideas = result.get_ideas_at_depth(1) # First expansion
# Get children of an idea
children = result.get_children(idea.id)
# Get path to best idea (from root to best)
path = result.get_path_to_best()
for i, idea in enumerate(path):
print(f"Level {i}: {idea.text} (score: {idea.quality_score})")
Idea Object Properties
idea.id- Unique identifieridea.text- The idea contentidea.quality_score- Overall score (1-10)idea.depth- Level in treeidea.parent_id- Parent idea ID (None for root)idea.criteria_scores- Dict of individual criterion scores
CSV Export
Export all ideas to CSV for analysis in Excel, pandas, or any data tool:
Auto-save During Brainstorming
result = brainstorm.brainstorm(
"Generate domain names",
save_csv=True,
csv_path="domains.csv",
csv_expand_criteria=True
)
Manual Export
# Expanded format
result.to_csv(
"ideas.csv",
expand_criteria=True
)
# Compact format
result.to_csv(
"ideas_compact.csv",
expand_criteria=False
)
Real-World Example: Domain Name Generator
from SimplerLLM.language import LLM, LLMProvider
from SimplerLLM.language.llm_brainstorm import RecursiveBrainstorm
llm = LLM.create(LLMProvider.OPENAI, model_name="gpt-4o-mini")
brainstorm = RecursiveBrainstorm(
llm=llm,
max_depth=2,
ideas_per_level=4, # 4 + 16 + 64 = 84 domains
mode="tree",
evaluation_criteria=[
"memorability",
"brandability",
"simplicity",
"availability_likelihood"
],
min_quality_threshold=5.0,
verbose=True
)
result = brainstorm.brainstorm(
prompt="""Generate creative domain names for an AI-powered
productivity app for remote teams. Include extensions like
.com, .io, .app""",
save_csv=True,
csv_path="domain_names.csv"
)
# Show top 10 domains
top_domains = sorted(
result.all_ideas,
key=lambda x: x.quality_score,
reverse=True
)[:10]
print("\nTop 10 Domain Names:")
for i, domain in enumerate(top_domains, 1):
print(f"{i}. {domain.text} - Score: {domain.quality_score}/10")
MiniAgent Integration
Use brainstorming as a tool in multi-step workflows:
from SimplerLLM.language.flow import MiniAgent
llm = LLM.create(LLMProvider.OPENAI, model_name="gpt-4o-mini")
agent = MiniAgent("Product Development Agent", llm, max_steps=3)
# Step 1: Brainstorm ideas
agent.add_step(
step_type="tool",
tool_name="recursive_brainstorm",
params={
"llm_instance": llm,
"max_depth": 2,
"mode": "hybrid",
"top_n": 3
}
)
# Step 2: Analyze best idea
agent.add_step(
step_type="llm",
prompt="""Analyze the best brainstormed idea and create
an action plan with 5 concrete steps.
Brainstorm results: {previous_output}"""
)
# Step 3: Create product brief
agent.add_step(
step_type="llm",
prompt="""Based on the analysis, create a one-page product brief.
Analysis: {previous_output}"""
)
# Run the workflow
result = agent.run("Productivity tools for developers")
print(result.final_output)
Custom Evaluation Criteria
brainstorm = RecursiveBrainstorm(
llm=llm,
evaluation_criteria=[
"technical_feasibility",
"market_potential",
"time_to_market",
"competitive_advantage",
"user_value"
]
)
result = brainstorm.brainstorm("SaaS product ideas")
# Access detailed scores
for idea in result.all_ideas[:5]:
print(f"\n{idea.text}")
print(f"Overall: {idea.quality_score}/10")
for criterion, score in idea.criteria_scores.items():
print(f" {criterion}: {score}/10")
Best Practices
💡 Mode Selection
- Tree mode: Initial ideation, comprehensive coverage
- Linear mode: Refining specific concepts
- Hybrid mode: Most use cases (recommended)
⚙️ Configuration
- Start with
max_depth=2-3to control costs - Use
ideas_per_level=3-5for balance - Set
top_nto 50-60% ofideas_per_level
🎯 Quality Filtering
6.0-7.0:Focus on high-quality ideas4.0-5.0:Exploratory brainstorming8.0+:Selective refinement only
📊 Cost Estimation
- Tree: 1 + 5 + 25 = 31 LLM calls
- Linear: 1 + 1 + 1 = 3 LLM calls
- Hybrid: 1 + 3 + 9 = 13 LLM calls
Common Use Cases
- 🌐 Domain Name Generation: Generate hundreds of brandable domain names
- 💡 Product Ideation: Brainstorm product features and improvements
- 📝 Content Ideas: Generate blog posts, video topics, campaign themes
- 🔧 Problem Solving: Explore solutions to complex challenges
- 📢 Marketing Strategies: Develop campaign ideas and messaging
- 🎨 Creative Concepts: Generate names, slogans, or creative directions
Async Support
For better performance with large brainstorming sessions:
import asyncio
async def brainstorm_async():
llm = LLM.create(LLMProvider.OPENAI, model_name="gpt-4o-mini")
brainstorm = RecursiveBrainstorm(llm, max_depth=2, mode="hybrid")
result = await brainstorm.brainstorm_async(
"Innovative blockchain use cases"
)
return result
# Run async
result = asyncio.run(brainstorm_async())