AI Tools

LLM Council: Andrej Karpathy's Framework for Collaborative Multi-Agent Decision-Making in AI

Explore Andrej Karpathy's LLM Council, a powerful system where multiple LLMs deliberate, debate, and vote on complex tasks like code review to achieve superior results over single-model approaches.

J

Jennifer Yu

Workflow Automation Specialist

December 30, 2025 min read
Share:

The Rise of Collaborative AI: Introducing LLM Council

In the rapidly evolving field of artificial intelligence, individual large language models (LLMs) have demonstrated remarkable capabilities, yet they remain inherently stochastic and prone to inconsistencies. Andrej Karpathy, a renowned AI researcher formerly at OpenAI and Tesla, has pioneered an innovative solution: the LLM Council. This framework orchestrates a group of LLMs to function as a deliberative body, mimicking human committee processes where members propose ideas, critique each other, and converge on a collective decision through structured debate and voting.

This case study dissects the LLM Council architecture, its implementation, real-world application in code review, and broader implications for AI development. By leveraging parallelism and diverse perspectives, the system significantly outperforms solo LLMs, offering a blueprint for reliable, high-stakes AI applications.

Background: Why Multi-Agent Deliberation Matters

LLMs excel in generation tasks but falter in consistency due to their probabilistic nature. A single model might produce brilliant insights one run and hallucinations the next. Karpathy's insight draws from human governance: no critical decision is made in isolation. Councils, juries, and boards aggregate expertise to mitigate biases and errors.

Key motivations include:

  • Reducing Variance: Multiple models average out noise, yielding more stable outputs.
  • Enhancing Reasoning: Debate fosters deeper analysis, exposing weaknesses in initial proposals.
  • Scalability: Parallel API calls make it efficient for production use.

This approach aligns with emerging trends in multi-agent systems, such as AutoGen or LangChain crews, but emphasizes structured discourse over loose chat. For developers, it's a practical upgrade to prompting techniques, transforming solitary inference into orchestrated intelligence.

Core Architecture of the LLM Council

The LLM Council operates in phases, ensuring thorough deliberation:

  1. Proposal Phase: Each council member (an LLM instance) independently generates a proposal on the task. Diversity is encouraged by assigning roles (e.g., "optimist," "critic") or using varied models like GPT-4o-mini for speed and Claude-3.5-sonnet for depth.

  2. Critique Phase: Members review peers' proposals, highlighting strengths, flaws, and alternatives. This adversarial step sharpens ideas.

  3. Response Phase: Authors defend or revise their proposals based on critiques.

  4. Voting Phase: Final scores are assigned (e.g., 1-10 scale), and a weighted aggregate determines the winner.

The full implementation is available in Karpathy's repository: llm-council GitHub Repo. This open-source code provides modular Python scripts, configurable via YAML, supporting any OpenAI-compatible API.

Technical Specifications

  • Configurable Parameters:

    ParameterDescriptionDefault
    n_membersNumber of council members3-7
    modelLLM provider (e.g., 'gpt-4o-mini')Varies
    temperatureControls creativity (0.1-0.7)0.33
    debate_roundsNumber of critique-response cycles1-2
  • Prompt Engineering: System prompts define roles precisely. For example, the "Author" prompt instructs: "You are an expert [DOMAIN] engineer. Propose a complete solution..."

This structure ensures determinism where needed while preserving creativity.

Case Study: Revolutionizing Code Review with LLM Council

Karpathy applies the council to code review, a domain rife with subtle bugs and style issues that solo LLMs often miss.

Real-World Setup

Consider reviewing a Python function for data processing:

def process_data(df):
    return df.groupby('category').sum()

Step-by-Step Execution:

  1. Proposals: Three members generate reviews:

    • Member 1: Flags potential NaN issues, suggests fillna.
    • Member 2: Recommends vectorized operations for efficiency.
    • Member 3: Proposes error handling and type hints.
  2. Critiques:

    • Member 1 critiques Member 2: "Vectorization is good, but ignores memory constraints for large DataFrames."
    • Cross-reviews build a comprehensive critique matrix.
  3. Responses: Authors refine: Member 1 adds dropna thresholds.

  4. Voting: Scores averaged—e.g., Member 3 wins with 8.7/10.

Sample Output

The winning review might read:

## Issues Found
- **Performance**: Use `agg` instead of `sum` for flexibility.
- **Robustness**: Add `df.dropna(subset=['category'])`.
- **Improved Code**:
```python
def process_data(df: pd.DataFrame) -> pd.DataFrame:
    df = df.dropna(subset=['category'])
    return df.groupby('category').agg({'value': 'sum'})

In benchmarks, the council identifies 20-30% more issues than a single GPT-4o, with fewer false positives. This is actionable for dev teams: integrate via CI/CD pipelines for PR automation.

## Performance Analysis and Benchmarks

Karpathy's experiments reveal:
- **Consistency**: Standard deviation of scores drops 50% with 5+ members.
- **Quality**: Human-evaluated wins favor council outputs 70% of the time.
- **Cost-Effectiveness**: Using cheaper models (e.g., 4o-mini at $0.15/M tokens) keeps costs under $0.01 per review.

| Metric | Single LLM | 3-Member Council | 7-Member Council |
|--------|------------|-------------------|-------------------|
| Bug Detection Rate | 65% | 82% | 89% |
| Hallucination Rate | 15% | 7% | 4% |
| Latency (s) | 2 | 12 | 25 |

These gains stem from emergent reasoning: debates uncover edge cases like concurrency or security that isolated models overlook.

## Practical Implementation Guide

To deploy your own council:
1. Clone the repo: `git clone https://github.com/karpathy/llm-council`
2. Install: `pip install -r requirements.txt`
3. Edit `config.yaml`:
```yaml
council:
  n_members: 5
  models: ['gpt-4o-mini', 'claude-3-5-sonnet']
  task: 'Review this code: [paste code]'
  1. Run: python council.py

Pro Tips:

  • Role Assignment: Label members as "Security Expert," "Perf Guru" for specialized tasks.
  • Hybrid Models: Mix fast/cheap with slow/accurate for balance.
  • Extensions: Adapt for writing (e.g., blog editing), planning (project roadmaps), or debugging.

Broader Applications and Future Directions

Beyond code review, LLM Councils shine in:

  • Product Management: Prioritize features via stakeholder simulations.
  • Legal Analysis: Debate contract interpretations.
  • Creative Writing: Ensemble story generation with plot critiques.

Challenges include API costs at scale and prompt sensitivity—mitigate with caching and A/B testing. Future evolutions might incorporate tools (e.g., web search during debate) or fine-tuned council-specific models.

This framework democratizes advanced AI, enabling solo developers to harness swarm intelligence. As Karpathy notes, "LLMs are at their best when they talk to each other."

Key Takeaways for AI Practitioners

  • Implement multi-agent deliberation for any reasoning-heavy task.
  • Start small: 3 members suffice for 80% gains.
  • Measure success via ensemble variance and human validation.

The LLM Council exemplifies how simple orchestration unlocks LLM potential, paving the way for robust, enterprise-grade AI systems.


<div style="text-align: center; margin-top: 2rem;"> <a href="https://www.analyticsvidhya.com/blog/2025/12/llm-council-by-andrej-karpathy/" target="_blank" rel="noopener noreferrer" class="view-full-resource-btn" style="display: inline-block; background-color: #f97316; color: white; padding: 12px 24px; border-radius: 8px; text-decoration: none; font-weight: 600; transition: background-color 0.2s;">View Full Resource</a> </div>
The #1 Newsletter in AI

Stay ahead of the AI curve

The most important updates, news, and content — delivered in one weekly newsletter.

No spam. Unsubscribe anytime. Privacy policy

llm-council
andrej-karpathy
multi-agent-ai
code-review
prompt-engineering
ai-agents
J

About Jennifer Yu

Workflow Automation Specialist

Jennifer covers workflow strategy, no-code platforms, and clear implementation guidance for teams adopting automation.

Comments (0)