Stage 2 is where the council holds each other accountable. Every council model reads all of the Stage 1 responses — but without knowing who wrote them — and produces a written evaluation followed by a strict ranked list. The anonymization is what makes the peer review meaningful: a model cannot give a favorable review to a peer it recognizes or a poor review to a competitor it dislikes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/karpathy/llm-council/llms.txt
Use this file to discover all available pages before exploring further.
Anonymization: Assigning Letter Labels
At the start ofstage2_collect_rankings, the backend assigns a sequential letter label to each Stage 1 response:
chr(65) is 'A', so four council models produce labels A, B, C, D. The resulting label_to_model dictionary might look like:
metadata and returned by the API, but it is never sent to the ranking models. Each evaluating model only ever sees the letter labels.
The Ranking Prompt
All anonymized responses are concatenated into a single block and embedded in a prompt that instructs the evaluating model to:- Evaluate each response individually — noting strengths and weaknesses.
- Conclude with a
FINAL RANKING:section that follows a precise numbered-list format.
query_models_parallel, exactly as in Stage 1.
The strict format requirement —
FINAL RANKING: in all caps, one label per numbered line, no trailing commentary — is not stylistic preference. It is a contract that the parser depends on. If a model deviates from the format, the fallback regex does its best, but reliable extraction requires adherence to the template.Parsing Rankings from Free Text
parse_ranking_from_text in council.py extracts the structured ranking from each model’s free-form evaluation:
Locate the FINAL RANKING section
Split on
"FINAL RANKING:" and work only with the text that follows. This discards the evaluation prose, which may contain incidental mentions of letter labels.Primary regex — numbered list
\d+\.\s*Response [A-Z] matches lines like 1. Response C. If any matches are found, the Response [A-Z] portion is extracted from each match and returned in order.Fallback regex — bare labels
If no numbered lines are found,
Response [A-Z] is extracted from anywhere in the ranking section, in the order they appear.stage2_results contains both the raw full text and the parsed list:
Calculating Aggregate Rankings
Once every model has submitted a ranking,calculate_aggregate_rankings converts individual votes into a single leaderboard:
average_rank so index 0 is the overall winner.
Frontend Display
TheStage2 React component renders two sections:
Raw evaluations tab view. One tab per council model shows that model’s full written evaluation. De-anonymization happens client-side via the deAnonymizeText helper, which replaces every "Response X" occurrence with the real model’s short name in bold:
parsed_ranking list as an ordered HTML list. This lets users immediately see what the parser extracted and compare it against the raw text.
Aggregate Rankings leaderboard. Below the tab view, all models are listed in order of their average_rank score along with the number of votes counted. The frontend labels this section “Aggregate Rankings (Street Cred).”