Documentation Index
Fetch the complete documentation index at: https://mintlify.com/skydiscover-ai/skydiscover/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Beam Search maintains a fixed-width “beam” of the most promising solution candidates, exploring multiple paths in parallel while pruning less promising directions. It balances breadth (exploring alternatives) with depth (refining solutions).Parallel Paths
Explores multiple solution directions simultaneously
Controlled Breadth
Beam width limits computational cost while maintaining diversity
Flexible Selection
Multiple strategies for choosing which beam member to expand
Depth Tracking
Monitors solution tree depth for analysis
How It Works
Beam Maintenance
Beam Search maintains the topbeam_width programs at all times:
- Initialization: Start with initial program(s) in the beam
- Selection: Pick a program from the beam to expand
- Generation: Create a child program
- Evaluation: Score the child
- Beam Update: Add child to beam, prune to maintain width
- Repeat: Continue expanding beam members
Selection Strategies
Beam Search offers four strategies for selecting which beam member to expand:- Best
- Stochastic
- Round Robin
- Diversity Weighted
Always expand the highest-scoring program in the beam.Use when: You want greedy best-first search with backup options.
Beam Pruning
When the beam exceedsbeam_width, it’s pruned to the top programs:
- Pure fitness: Keep highest-scoring programs
- Diversity-aware: Balance fitness and code diversity (if
beam_diversity_weight > 0)
Configuration
Basic Usage
Configuration File
Configuration Options
Number of candidate programs to keep in the beam. Higher = more exploration but slower.
How to select which beam member to expand next. Options:
"best": Always pick highest scoring"stochastic": Weighted random by score"round_robin": Cycle through beam members"diversity_weighted": Balance score and diversity
Weight for diversity in selection (0-1). Only used with
diversity_weighted strategy.- 0 = pure fitness-based selection
- 1 = pure diversity-based selection
Temperature for stochastic sampling. Only used with
stochastic strategy.- Lower = more greedy (favor best programs)
- Higher = more uniform (explore beam evenly)
Exponential penalty for deep programs:
score * exp(-penalty * depth).
Use to encourage shorter solution paths.When to Use Beam Search
Best For
Best For
- Problems where multiple solution approaches might work
- Medium-length runs (50-200 iterations)
- When you want controlled exploration without full population management
- Problems with discrete decision points (like algorithm design)
Avoid When
Avoid When
- Very short runs (< 20 iterations) - beam won’t fill
- Problems requiring deep refinement of single solution
- Need for maximum diversity (use AdaEvolve islands instead)
Example
Algorithm Optimization
Beam search works well for problems with discrete choices:Monitoring Beam Search
Statistics
Access beam statistics via the database:Beam Contents
Unexpanded Programs
Advanced Usage
Dynamic Beam Width
Adjust beam width during the run:Restart Strategy
Periodically inject new starting points:Comparison with Other Algorithms
| Feature | Beam Search | Top-K | Best-of-N | AdaEvolve |
|---|---|---|---|---|
| Parallel paths | Yes (beam_width) | No | Limited | Yes (islands) |
| Exploration | Configurable | None | None | Adaptive |
| Depth tracking | Yes | No | No | No |
| Complexity | Medium | Low | Low | High |
| Best for | Discrete choices | Refinement | Refinement | Complex landscapes |
Tips for Best Results
Start with diversity_weighted
The default strategy balances exploration and exploitation well for most problems.
Tune beam width to iteration budget
- 20-50 iterations: beam_width = 3-5
- 50-150 iterations: beam_width = 5-10
- 150+ iterations: beam_width = 10-20
Use diversity for discrete problems
Increase
beam_diversity_weight (0.4-0.6) when solutions have distinct approaches.