Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Heuristic:ANative Lab EvoAgentX Debate Pruning Strategy

From Leeroopedia
Knowledge Sources
Domains Multi_Agent_Debate, Optimization, NLP
Last Updated 2026-10-21 00:00 GMT

Overview

Three-stage pruning pipeline for multi-agent debate candidates: TF-IDF quality pruning, cosine-similarity diversity pruning, and LLM-based misunderstanding rebuttal.

Description

The PruningPipeline reduces the number of debate answer candidates before the final judge or voting step. It runs three sequential stages:

  1. Quality Pruning (QP): Scores each candidate by TF-IDF cosine similarity to the problem statement. Candidates below `qp_threshold` (default 0.15) are removed. Optionally keeps only the top-k by `qp_top_k`.
  2. Diversity Pruning (DP): Removes near-duplicate candidates using TF-IDF cosine similarity. Candidates with similarity above `dp_similarity_threshold` (default 0.92) are pruned, keeping only the first encountered in each cluster.
  3. Misunderstanding Rebuttal (MR): Optional LLM-based stage that identifies common mistakes across candidates and proposes a corrected consolidated answer.

A `min_keep_count` ensures the pipeline never prunes below a minimum number of candidates.

Usage

Use this heuristic when running MultiAgentDebateActionGraph with `enable_pruning=True`. Tune the thresholds based on the number of agents and the expected answer diversity. Enable MR when the problem is complex and common misunderstandings are likely.

The Insight (Rule of Thumb)

  • Action: Enable pruning with `enable_pruning=True` and configure thresholds.
  • Value: `qp_threshold=0.15` (minimum relevance), `dp_similarity_threshold=0.92` (dedup cutoff), `enable_mr=False` (LLM rebuttal off by default).
  • Trade-off: Aggressive pruning (low `qp_threshold`, low `dp_similarity_threshold`) reduces noise but may discard valid minority opinions. Conservative pruning retains more candidates but increases judge/voting cost.
  • Compatibility: MR stage requires an `LLMConfig` for the critic agent.

Reasoning

In multi-agent debates with many agents (5+), the candidate pool often contains low-quality, off-topic, or near-identical answers. Quality pruning removes answers that have little lexical overlap with the problem, using a bag-of-words TF-IDF approach which is fast and requires no external model. Diversity pruning ensures the remaining candidates represent distinct perspectives, preventing the judge from being biased by repeated similar answers.

The default `qp_threshold=0.15` is intentionally low — it removes only clearly irrelevant answers. The `dp_similarity_threshold=0.92` is high — only near-exact duplicates are removed. This conservative default preserves debate diversity while eliminating the most obvious noise.

The MR stage is optional and off by default because it adds an LLM call cost and is only valuable when candidates share systematic misconceptions.

Code Evidence

Pipeline structure from `evoagentx/frameworks/multi_agent_debate/pruning.py:207-212`:

def apply(self, problem: str, candidates: List[Dict[str, Any]]) -> Dict[str, Any]:
    step1 = self._quality_prune(problem, candidates)
    step2 = self._diversity_prune(step1)
    step3, suggested = self._misunderstanding_rebuttal(problem, step2)
    return {"candidates": step3, "mr_suggested": suggested}

Quality pruning with TF-IDF from `evoagentx/frameworks/multi_agent_debate/pruning.py:77-81`:

def _qp_score(self, problem: str, text: str) -> float:
    qv = _tf_vector(_tokenize(problem))
    tv = _tf_vector(_tokenize(text))
    return _cosine_sim(qv, tv)

Diversity pruning with similarity threshold from `evoagentx/frameworks/multi_agent_debate/pruning.py:110-126`:

def _diversity_prune(self, candidates: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
    if not self.enable_dp or len(candidates) <= 1:
        return candidates
    vecs = [_tf_vector(_tokenize(c.get("text", ""))) for c in candidates]
    kept: List[int] = []
    for i, v in enumerate(vecs):
        diverse = True
        for j in kept:
            sim = _cosine_sim(v, vecs[j])
            if sim >= self.dp_similarity_threshold:
                diverse = False
                break
        if diverse:
            kept.append(i)
    pruned = [candidates[i] for i in kept]
    return pruned

Default thresholds from `evoagentx/frameworks/multi_agent_debate/pruning.py:53-63`:

def __init__(
    self,
    enable_qp: bool = True,
    enable_dp: bool = True,
    enable_mr: bool = False,
    qp_threshold: float = 0.15,
    dp_similarity_threshold: float = 0.92,
    ...
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment