Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Lm sys FastChat Monitor Markdown

From Leeroopedia


Knowledge Sources
Domains Data_Processing, Model_Evaluation
Last Updated 2026-02-07 06:00 GMT

Overview

Generates Markdown content for the FastChat Chatbot Arena leaderboard UI, including default descriptions, category explanations, and formatted leaderboard tables.

Description

Monitor Markdown is the content generation layer for the FastChat Arena leaderboard Gradio interface. It produces the Markdown strings that are displayed across various tabs and sections of the monitoring dashboard. The module contains functions for generating default introductory text, arena leaderboard tables, category-specific leaderboard views, full model comparison tables, and Arena Hard benchmark title blocks.

The module maintains several important data structures. The deprecated_model_name list tracks models that have been retired from the arena and should be noted in the UI. The key_to_category_name dictionary maps internal category keys to human-readable display names used in tab headers and descriptions. The cat_name_to_explanation dictionary provides detailed explanations of what each category measures, displayed as help text in the UI.

Functions like make_default_md_1 and make_default_md_2 generate the static introductory content shown at the top of the leaderboard page, with a mirror parameter to adjust links and content for mirror deployments. The make_arena_leaderboard_md function generates the main leaderboard table from arena DataFrame data, incorporating last-updated timestamps and optional vision model filtering. Category-specific views are handled by make_category_arena_leaderboard_md, which adds category explanations and subset statistics alongside the leaderboard table.

Usage

Use this module when building or modifying the FastChat Arena leaderboard Gradio application. Its functions are called during UI construction and data refresh cycles to produce the Markdown content displayed in various Gradio Markdown components.

Code Reference

Source Location

Signature

def make_default_md_1(mirror: bool = False) -> str:
    """Generate the first block of default introductory Markdown for the leaderboard page."""

def make_default_md_2(mirror: bool = False) -> str:
    """Generate the second block of default introductory Markdown for the leaderboard page."""

def make_arena_leaderboard_md(
    arena_df: pd.DataFrame,
    last_updated_time: str,
    vision: bool = False
) -> str:
    """Generate a Markdown leaderboard table from arena results with optional vision model filtering."""

def make_category_arena_leaderboard_md(
    arena_df: pd.DataFrame,
    arena_subset_df: pd.DataFrame,
    name: str
) -> str:
    """Generate a category-specific leaderboard with category explanations and subset statistics."""

def make_full_leaderboard_md() -> str:
    """Generate a full Markdown table comparing all models across all metrics."""

def arena_hard_title(date: str) -> str:
    """Generate a title block for the Arena Hard benchmark section."""

Import

from fastchat.serve.monitor.monitor_md import make_arena_leaderboard_md

I/O Contract

Inputs

Name Type Required Description
mirror bool No Whether to generate content for a mirror deployment (adjusts links and descriptions; default: False)
arena_df pd.DataFrame Yes DataFrame containing arena Elo ratings, confidence intervals, and vote counts per model
last_updated_time str Yes Human-readable timestamp of the last data refresh
vision bool No Whether to filter for vision-capable models only (default: False)
arena_subset_df pd.DataFrame Yes Subset DataFrame for the specific category (used by make_category_arena_leaderboard_md)
name str Yes Category name key (used by make_category_arena_leaderboard_md)
date str Yes Date string for the Arena Hard benchmark title (used by arena_hard_title)

Outputs

Name Type Description
markdown str All functions return Markdown-formatted strings ready for display in Gradio Markdown components

Key Data Structures

deprecated_model_name

A list of model name strings that have been retired from the arena. These are annotated in the leaderboard display.

key_to_category_name

A dictionary mapping internal category keys to display-friendly names:

# Example entries:
key_to_category_name = {
    "overall": "Overall",
    "coding": "Coding",
    "math": "Math",
    "hard_prompts": "Hard Prompts",
    ...
}

cat_name_to_explanation

A dictionary providing detailed explanations for each category, displayed as helper text in the UI.

Usage Examples

import gradio as gr
import pandas as pd
from fastchat.serve.monitor.monitor_md import (
    make_default_md_1,
    make_default_md_2,
    make_arena_leaderboard_md,
    make_category_arena_leaderboard_md,
)

# Build the leaderboard Gradio interface
with gr.Blocks() as demo:
    # Introductory content
    gr.Markdown(make_default_md_1(mirror=False))
    gr.Markdown(make_default_md_2(mirror=False))

    # Main leaderboard table
    arena_df = pd.read_csv("arena_elo_results.csv")
    leaderboard_md = make_arena_leaderboard_md(
        arena_df=arena_df,
        last_updated_time="2024-01-15 12:00 UTC",
        vision=False,
    )
    gr.Markdown(leaderboard_md)

    # Category-specific leaderboard
    coding_df = arena_df[arena_df["category"] == "coding"]
    category_md = make_category_arena_leaderboard_md(
        arena_df=arena_df,
        arena_subset_df=coding_df,
        name="coding",
    )
    gr.Markdown(category_md)

demo.launch()

Related Pages

Page Connections

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