TTT: Tree-of-Thought with Sperm Competition — A Bio-Inspired Evolutionary Framework for LLM Idea Generation
A core weakness of large language models (LLMs) on open-ended creative tasks is diversity collapse: repeated sampling from the same prompt rapidly converges, trapping search in a local optimum. We abstract the biological process of sperm competition into a set of evolutionary operators and propose TTT (Tree-of-Thought with Sperm Competition): a thought tree first expands the prompt into a structured set of candidates; each candidate is then treated as a “gamete” and undergoes several generations of “elitism – tournament selection – recombination – mutation – real-LLM re-scoring”, until a single candidate is “fertilized” as the winner.
Our contributions are: (1) a formalization of the reproductive-selection analogy — overproduction → multi-stage filtering → recombination and mutation → single winner; (2) an engineering implementation inside Super IDE with real-LLM generation/scoring, batching, rate limiting and graceful degradation; (3) a default configuration, a derivation of the LLM call budget, and an honest account of current limitations, including the absence of semantic crossover, premature convergence, and the lack of controlled evaluation.
Note: This is a systems and methods report. It contains no quantitative results from controlled experiments. Every number is either a parameter of the implementation or an arithmetic quantity derived from it — not a measured performance figure.
When an LLM is used as an “idea generator”, two problems recur. The first is convergence: sampling repeatedly at high temperature yields solutions that are semantically highly overlapping. The second is the absence of selection: the model can produce a large volume of text, yet there is no stable, weightable mechanism for separating good ideas from merely many ideas.
Chain-of-Thought (CoT) asks the model to verbalize its reasoning; Tree-of-Thought (ToT) organizes reasoning into a tree with evaluation and pruning. Both, however, remain searches along a single elite trajectory: once the evaluation function is biased, the error is locked in. We want a mechanism closer to natural selection, spanning exploration and exploitation.
Sexual reproduction offers an extreme paradigm: overproduction + multi-stage filtering + a single winner. A single ejaculate contains hundreds of millions of genetically distinct gametes; the female reproductive tract together with the cumulus–zona pellucida filters them in layers, and typically exactly one sperm fuses with the oocyte. We formalize this process as algorithmic operators and call the result TTT.
Sperm competition was introduced by Parker (1970) to describe the phenomenon in which, when a female mates with several males in a short window, sperm from different males compete inside the female reproductive tract for fertilization. It is a central component of post-copulatory sexual selection, explaining the evolution of sperm number, sperm morphology, and mating strategies.
A human ejaculate is typically about 2–5 mL; the WHO lower reference limit for sperm concentration is about 15 million per mL, so the total is commonly on the order of 10^8 (roughly 200–300 million). Yet:
“Competition” is not simply “the fastest swimmer wins”. Morphology, motility, DNA integrity and acrosomal status affect survival; the cumulus and zona pellucida and the oviductal environment form physical and molecular filters; and in some species oocytes actively participate in selection (the “oocyte choice” hypothesis), with sperm storage occurring in others. The more accurate picture is therefore: many cheap, diverse candidates × layered, heterogeneous filtering × one winner.
| Biological phenomenon | Algorithmic counterpart |
|---|---|
| Overproduction of gametes (hundreds of millions) | Batch-generate many more candidates than needed (budget-bounded) |
| Layered filtering (tract, cumulus, zona) | Multi-generation re-scoring plus elitism, gradually converging |
| Recombination and mutation | Uniform crossover plus feature/text mutation |
| Sperm storage (in some species) | Elite pool (top-10% retained each generation) |
| A single fertilization | Return the argmax candidate |
CoT improves complex-task performance through explicit reasoning chains; ToT organizes reasoning into a tree, expanding and pruning via model self-evaluation; Graph-of-Thoughts further allows the merging and aggregation of thoughts; Self-Consistency improves robustness by voting over multiple reasoning chains. These methods share a “generate–evaluate–select” skeleton, but their selection operators are usually simple (voting or greedy).
FunSearch uses an LLM to generate candidate programs filtered by an automatic evaluator, surpassing previously known results on combinatorial problems; AlphaEvolve generalizes this idea to algorithm discovery; EvoPrompt and OPRO treat the prompt itself as the object of evolution. Together they demonstrate the feasibility of an “LLM generation + automatic evaluation + evolutionary loop”.
Genetic algorithms, genetic programming and NSGA-II provide the classical selection/recombination/mutation operators; novelty search and MAP-Elites emphasize diversity rather than a single fitness in order to resist premature convergence. TTT borrows its selection and recombination operators directly from these mechanisms, with the LLM acting as both generator and fitness function.
LLM-as-a-Judge is now widely used to evaluate open-ended tasks, but suffers from position, length and self-consistency biases. TTT mitigates this with low temperature (0.2), batched scoring and a heuristic fallback, but does not eliminate it (see Section 7).
An idea is represented as a node idea = (id, text, features, score, parent, children), where text is the natural-language idea, features are four fitness components in [0,1], and score is their weighted sum. TTT has two stages: thought-tree expansion and sperm-competition evolution.
A root node is generated from an empty seed, and the tree then splits level by level: level d yields branching^d nodes, for Σd=0..depth branching^d nodes in total. This provides structured initial diversity covering different lines of thought, rather than random repetitions of one prompt.
All tree nodes are collected as initial “gametes”. If fewer than the budget N, they are topped up by batch generation; the pool is then truncated/sampled to N. Every gamete is scored by the LLM.
Each generation repeats: sort by score; retain elites E = max(2, ⌊0.1·N⌋); produce parents by tournament selection (k=3); uniform crossover mixing the two parents’ feature vectors; mutation perturbing features with probability pm and marking the text; then re-score the whole generation with the real LLM. Elitism corresponds to “sperm storage”, and the final argmax to “fertilization”.
Algorithm 1 Sperm-competition evolution Input: prompt, budget N, generations G, pc, pm 1 tree = buildTree(prompt, b=4, depth=2) // expand, Sigma b^d nodes 2 P = treeNodes U topUpTo(N) // gamete pool 3 P = scoreLLM(P) // batched LLM scoring 4 for g = 1..G: 5 E = top max(2, floor(0.1*|P|)) by score // elites = sperm storage 6 for each slot in |P|-|E|: 7 p1, p2 = tournament(P, k=3) 8 c = uniformCrossover(p1, p2, pc) // recombination 9 c = mutate(c, pm) // mutation 10 P = E U offspring 11 P = scoreLLM(P) // real LLM re-scoring each gen 12 return argmax score, top10
Fitness is a weighted sum of four semantic dimensions with fixed weights:
| Dimension | Meaning | Weight |
|---|---|---|
| novelty | Originality | 0.25 |
| feasibility | Practicality | 0.25 |
| relevance | Fit to the task | 0.30 |
| elegance | Elegance | 0.20 |
Scoring is done by the LLM in batches (16 per batch, temperature 0.2, strictly returning JSON). When a call or parse fails, the system falls back to heuristic scoring (based on text length, character overlap with the prompt, keywords, etc.) so that evolution never halts.
TTT is implemented as a pure front-end module inside Super IDE (calling the model through the Electron main-process channel ai-direct:send-message). Its entry point returns {best, top10, stats, trace}. The engineering focus is stability under rate limiting.
2^attempt · 900ms + jitter, up to 3 attempts; only rate-limit hits (429/503 etc.) keep retrying.No stage can abort the pipeline: generation degrades to per-item generation and then to placeholder text; scoring degrades to the heuristic. This guarantees “always return a result”, at the cost of lower quality when degraded (flagged explicitly via the realLLM flag in the logs).
| Parameter | LLM version (default) | Early local version |
|---|---|---|
| branching | 4 | 6 |
| depth | 2 | 3 |
| population | 40 | 200 |
| generations | 5 | 5 |
| mutation rate pm | 0.15 | 0.15 |
| crossover rate pc | 0.4 | 0.4 |
Under the defaults and the “one call covers a whole batch” logic, the per-run call count can be derived:
| Stage | Notes | Calls (approx.) |
|---|---|---|
| Tree generation | root / level 1 / level 2, one call each | 3 |
| Top-up generation | one batch asking for 19 items | 1 |
| Initial scoring | 21 nodes, 16 per batch | 2 |
| Top-up scoring | 19 items, 16 per batch | 2 |
| Per-generation re-scoring × 5 | 40 items/generation, 16 per batch | 15 |
| Total | excluding retries and degradation | ≈ 23 |
Sperm competition is a good fit as a selection operator for LLM search because it addresses three problems at once:
The key difference from ToT is that ToT is a “generate–evaluate–prune” tree search, whereas TTT layers a population-level evolutionary loop on top of it, using the biological metaphor to make the design constraints — overproduction, filtering, a single winner — explicit.
The value of a metaphor is not fidelity to biological detail, but that it highlights three knobs of search: the yield of candidates, the number of filtering stages, and the singularity of the final extraction.
We consider it more important to state the following honestly than to present flattering numbers.
In the current implementation, crossover only mixes the feature vector, and mutation only perturbs features numerically while appending a marker to the text. Offspring text is therefore essentially identical to the parent text, and evolution effectively searches a “score space” rather than an “idea space”. Because LLM scores for identical text are highly correlated, this mechanism struggles to yield genuinely new ideas and can cause premature convergence: elites survive every generation while their features are nudged until saturation.
Fitness depends entirely on an LLM judge, which carries position, length and self-consistency biases; batched scoring may let candidates in the same batch influence one another; the heuristic fallback injects non-semantic noise.
branching / depth / population / generations / weights have not been systematically ablated. This report contains no controlled comparisons, confidence intervals or significance tests; any claim of “better” is therefore unsupported.
Biological selection occurs in an open physical–biochemical environment where selection pressure arises naturally, whereas here the pressure is proxied by an LLM — manipulable and drift-prone. Equating “sperm competition” directly with an algorithmic advantage is over-claiming.
We presented TTT, which abstracts sperm competition into the operators overproduction → multi-stage filtering → recombination and mutation → single winner, layered on top of tree-of-thought search to mitigate diversity collapse in LLM idea generation. We gave a formal description, an engineering implementation inside Super IDE (batching, rate limiting, degradation), a default configuration and a derived call-budget analysis. We also stated clearly that the current implementation suffers from a fundamental lack of semantic crossover, and outlined a path forward centered on semantic recombination, quality–diversity archives and controlled evaluation.
ttt-engine-llm.js; default parameters appear in Section 5.3. All values in this report are parameters or derivations from them, with no performance claims. Ablations and benchmark experiments are welcomed on this basis.