Spaces:
Sleeping
Sleeping
File size: 11,735 Bytes
06eded3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | """
Clippy i,Robot Mode - Model Benchmark Leaderboard
A Gradio app for HuggingFace Spaces that:
- Displays benchmark results for models tested for i,Robot mode
- Accepts result submissions from Clippy clients
- Averages multiple submissions per model
- Shows per-category breakdowns
Deploy to: https://huggingface.co/spaces/npc0/clippy-irobot-bench
"""
import json
import os
from datetime import datetime
from pathlib import Path
from threading import Lock
import gradio as gr
import pandas as pd
# ==================== Data Storage ====================
DATA_DIR = Path(os.environ.get("DATA_DIR", "data"))
DATA_DIR.mkdir(exist_ok=True)
RESULTS_FILE = DATA_DIR / "results.json"
LOCK = Lock()
CATEGORIES = [
"memory_maintenance",
"self_consciousness",
"meaningful_response",
"complex_problem",
"memory_building",
"knowledge_production",
"skill_application",
"checkpoint_handling",
]
CATEGORY_LABELS = {
"memory_maintenance": "Memory",
"self_consciousness": "Self-Aware",
"meaningful_response": "Response",
"complex_problem": "Complex",
"memory_building": "Mem Build",
"knowledge_production": "Knowledge",
"skill_application": "Skills",
"checkpoint_handling": "Checkpoint",
}
CATEGORY_DESCRIPTIONS = {
"memory_maintenance": "Can the model maintain context and facts across multiple conversation turns?",
"self_consciousness": "Can the model maintain self-identity, report internal state, and show epistemic humility?",
"meaningful_response": "Does the model produce useful, empathetic, and appropriately structured responses?",
"complex_problem": "Can the model solve multi-step reasoning and system design problems?",
"memory_building": "Can the model categorize and organize new information into hierarchical memory?",
"knowledge_production": "Can the model synthesize new knowledge from combining existing facts?",
"skill_application": "Can the model select and apply the right skill/method for a given problem?",
"checkpoint_handling": "Given prior context (memory checkpoint), can the model build on it for complex issues?",
}
def load_results() -> dict:
"""Load results from disk."""
if RESULTS_FILE.exists():
with open(RESULTS_FILE, "r") as f:
return json.load(f)
return {}
def save_results(results: dict):
"""Save results to disk."""
with open(RESULTS_FILE, "w") as f:
json.dump(results, f, indent=2)
# ==================== API Functions ====================
def check_model(model_name: str) -> str:
"""Check if a model exists on the leaderboard."""
results = load_results()
model_key = model_name.strip().lower()
if model_key in results:
record = results[model_key]
return json.dumps({"found": True, "record": record})
return json.dumps({"found": False})
def submit_result(submission_json: str) -> str:
"""
Submit benchmark results for a model.
Results are averaged with existing records.
"""
try:
submission = json.loads(submission_json)
except json.JSONDecodeError:
return json.dumps({"success": False, "message": "Invalid JSON"})
model_name = submission.get("model", "").strip()
if not model_name:
return json.dumps({"success": False, "message": "Missing model name"})
model_key = model_name.lower()
overall = submission.get("overall", 0)
categories = submission.get("categories", {})
with LOCK:
results = load_results()
if model_key in results:
existing = results[model_key]
n = existing.get("submission_count", 1)
# Running average
existing["overall"] = round(
(existing["overall"] * n + overall) / (n + 1)
)
for cat in CATEGORIES:
old_val = existing["categories"].get(cat, 0)
new_val = categories.get(cat, 0)
existing["categories"][cat] = round(
(old_val * n + new_val) / (n + 1)
)
existing["submission_count"] = n + 1
existing["last_updated"] = datetime.utcnow().isoformat()
else:
results[model_key] = {
"model": model_name,
"overall": round(overall),
"categories": {
cat: round(categories.get(cat, 0)) for cat in CATEGORIES
},
"submission_count": 1,
"first_submitted": datetime.utcnow().isoformat(),
"last_updated": datetime.utcnow().isoformat(),
}
save_results(results)
return json.dumps(
{"success": True, "message": f"Results for '{model_name}' recorded."}
)
def get_leaderboard() -> str:
"""Get the full leaderboard as sorted JSON array."""
results = load_results()
records = sorted(results.values(), key=lambda r: r.get("overall", 0), reverse=True)
return json.dumps(records)
# ==================== UI Functions ====================
def build_leaderboard_df() -> pd.DataFrame:
"""Build a pandas DataFrame for the leaderboard display."""
results = load_results()
if not results:
return pd.DataFrame(
columns=["Rank", "Model", "Overall"]
+ [CATEGORY_LABELS[c] for c in CATEGORIES]
+ ["Runs"]
)
rows = []
records = sorted(results.values(), key=lambda r: r.get("overall", 0), reverse=True)
for i, record in enumerate(records, 1):
row = {
"Rank": i,
"Model": record.get("model", "unknown"),
"Overall": record.get("overall", 0),
}
for cat in CATEGORIES:
row[CATEGORY_LABELS[cat]] = record.get("categories", {}).get(cat, 0)
row["Runs"] = record.get("submission_count", 1)
rows.append(row)
return pd.DataFrame(rows)
def refresh_leaderboard():
"""Refresh the leaderboard table."""
return build_leaderboard_df()
def format_model_detail(model_name: str) -> str:
"""Get detailed view for a specific model."""
results = load_results()
model_key = model_name.strip().lower()
if model_key not in results:
return f"Model '{model_name}' not found on the leaderboard."
record = results[model_key]
lines = [
f"## {record['model']}",
f"**Overall Score:** {record['overall']}/100",
f"**Benchmark Runs:** {record.get('submission_count', 1)}",
f"**Last Updated:** {record.get('last_updated', 'unknown')}",
"",
"### Category Scores",
"| Category | Score | Description |",
"|----------|-------|-------------|",
]
for cat in CATEGORIES:
score = record.get("categories", {}).get(cat, 0)
bar = score_bar(score)
desc = CATEGORY_DESCRIPTIONS.get(cat, "")
lines.append(f"| {CATEGORY_LABELS[cat]} | {bar} {score}/100 | {desc} |")
# Capability assessment
lines.append("")
lines.append("### Assessment")
if record["overall"] >= 80:
lines.append("Excellent - this model is highly capable for i,Robot mode.")
elif record["overall"] >= 60:
lines.append("Good - this model should work well for most i,Robot tasks.")
elif record["overall"] >= 40:
lines.append(
"Fair - this model may struggle with complex tasks. "
"Consider upgrading to a recommended model."
)
else:
lines.append(
"Poor - this model is not recommended for i,Robot mode. "
"It may produce nonsensical or inconsistent responses."
)
return "\n".join(lines)
def score_bar(score: int) -> str:
"""Create a simple text-based score bar."""
filled = score // 10
empty = 10 - filled
return "[" + "█" * filled + "░" * empty + "]"
# ==================== Gradio App ====================
def create_app():
with gr.Blocks(
title="Clippy i,Robot Benchmark Leaderboard",
theme=gr.themes.Soft(),
) as app:
gr.Markdown(
"""
# 🤖 Clippy i,Robot Mode — Model Benchmark Leaderboard
This leaderboard tracks how well different LLMs perform in
[Clippy's](https://github.com/NewJerseyStyle/Clippy-App) autonomous
**i,Robot mode** — a continuously running agent that maintains memory,
self-awareness, and dialectic reasoning.
**Benchmark categories:**
memory maintenance · self-consciousness · meaningful response ·
complex problem solving · memory building · knowledge production ·
skill application · checkpoint handling
Results are submitted automatically by Clippy clients when users run
the benchmark. Multiple runs for the same model are averaged.
"""
)
with gr.Tab("Leaderboard"):
leaderboard_table = gr.Dataframe(
value=build_leaderboard_df,
label="Model Rankings",
interactive=False,
)
refresh_btn = gr.Button("🔄 Refresh", size="sm")
refresh_btn.click(fn=refresh_leaderboard, outputs=leaderboard_table)
with gr.Tab("Model Detail"):
model_input = gr.Textbox(
label="Model Name",
placeholder="e.g. gpt-4o, claude-sonnet-4-5-20250929",
)
lookup_btn = gr.Button("Look Up")
detail_output = gr.Markdown()
lookup_btn.click(
fn=format_model_detail, inputs=model_input, outputs=detail_output
)
with gr.Tab("About"):
gr.Markdown(
"""
## How the Benchmark Works
The benchmark tests 8 categories critical for i,Robot mode:
| Category | What It Tests |
|----------|--------------|
| **Memory Maintenance** | Retaining facts across turns, updating corrected facts |
| **Self-Consciousness** | Identity recall, internal state reporting, epistemic humility |
| **Meaningful Response** | Empathy, actionable advice, audience-appropriate answers |
| **Complex Problem** | Multi-factor diagnosis, system design with trade-offs |
| **Memory Building** | Categorizing info into hierarchical memory structures |
| **Knowledge Production** | Synthesizing new insights from combining existing facts |
| **Skill Application** | Selecting and applying the right method for a problem |
| **Checkpoint Handling** | Building on loaded prior context for complex decisions |
### Scoring
- Each test case scores 0-100 based on content matching and quality heuristics
- Category score = average of test case scores
- Overall score = weighted average of category scores
- Multiple submissions for the same model are averaged (running mean)
### Recommended Models
For i,Robot mode, we recommend models scoring **60+** overall:
- **DeepSeek V3.2** · **GPT-5.2** · **Claude Sonnet 4.5** · **GLM-4.7**
- GPT-4o and Claude Sonnet 4 are also acceptable
### Running the Benchmark
In Clippy Settings, enable i,Robot mode and click "Run Benchmark."
Results are automatically submitted to this leaderboard.
### Source
- [Clippy App](https://github.com/NewJerseyStyle/Clippy-App)
- Space: `npc0/clippy-irobot-bench`
"""
)
return app
# ==================== Entry Point ====================
if __name__ == "__main__":
app = create_app()
app.launch()
|