How lm-arena/lm-arena.github.io works
LM Arena is a browser-based, self-hosted LLM arena: users choose models and a mode, submit prompts, and receive streamed responses from live ephemeral inference endpoints, with optional browser inference fallback. It also supports compare, analyze, debate, image-field extraction, gesture input, and model fleet administration. Edges reflect README statements and shown imports/calls; unsampled admin and deployment details are not expanded beyond documented behavior.
Main entry points: Playground.tsx Arena workspace · streaming.ts Stream transport · useSessionController.ts Session controller · useModelsManager.ts Model selection
Components 25
Arena frontend
- Arena workspace
app/chat/frontend/src/Playground.tsx - Model selection
app/chat/frontend/src/hooks/useModelsManager.ts - Session controller
app/chat/frontend/src/hooks/useSessionController.ts - Chat interaction
app/chat/frontend/src/components/ChatView.tsx - Arena cards
app/chat/frontend/src/components/arenas/ArenaCanvas.tsx - Stream transport
app/chat/frontend/src/utils/streaming.ts - Thinking parser
app/chat/frontend/src/utils/thinkingParser.ts - Analyze mode
app/chat/frontend/src/engines/analyzeEngine.ts - Debate mode
app/chat/frontend/src/engines/debateEngine.ts - Discussion transcript
app/chat/frontend/src/components/DiscussionTranscript.tsx - Image extraction
app/chat/frontend/src/components/ExtractView.tsx - Vision extraction
app/chat/frontend/src/utils/vlmExtract.ts - Gesture controls
app/chat/frontend/src/components/GestureControl.tsx - Gesture state
app/chat/frontend/src/context/GestureContext.tsx
Model inference
- Browser inference
app/chat/frontend/src/utils/browserInference.ts - Inference launcher
app/shared/inference_server.py - llama.cpp wrapper
app/shared/llama_server_wrapper.py
Tunnel discovery
- Tunnel registry
app/tunnel-registry/worker.js
Model catalog
- Model definitions
config/models.py - Model metadata
app/chat/frontend/src/hooks/useModelsManager.ts
Other components
- User
- Actions runner
- Cloudflare tunnel
- Cloudflare service
- GitHub Pages
Connections 29
- User → Arena workspace: uses
- Arena workspace → Model selection: loads selection
app/chat/frontend/src/Playground.tsx - Arena workspace → Session controller: starts sessions
app/chat/frontend/src/Playground.tsx - Arena workspace → Arena cards: renders arena
app/chat/frontend/src/Playground.tsx - Arena workspace → Chat interaction: renders chat
app/chat/frontend/src/Playground.tsx - Model selection → Model metadata: fetches metadata
app/chat/frontend/src/hooks/useModelsManager.ts - Model selection → Tunnel registry: discovers live models
app/chat/frontend/src/hooks/useModelsManager.ts - Session controller → Stream transport: requests streams
app/chat/frontend/src/hooks/useSessionController.ts - Session controller → Thinking parser: parses chunks
app/chat/frontend/src/hooks/useSessionController.ts - Session controller → Analyze mode: runs analysis
app/chat/frontend/src/hooks/useSessionController.ts - Session controller → Debate mode: runs debate
app/chat/frontend/src/hooks/useSessionController.ts - Chat interaction → Stream transport: requests streams
app/chat/frontend/src/components/ChatView.tsx - Analyze mode → Stream transport: streams completions
app/chat/frontend/src/engines/analyzeEngine.ts - Debate mode → Stream transport: streams turns
app/chat/frontend/src/engines/debateEngine.ts - Arena workspace → Discussion transcript: shows discussion
app/chat/frontend/src/Playground.tsx - Arena workspace → Image extraction: offers extraction
app/chat/frontend/src/Playground.tsx - Image extraction → Vision extraction: extracts fields
app/chat/frontend/src/components/ExtractView.tsx - Gesture controls → Gesture state: updates state
app/chat/frontend/src/components/GestureControl.tsx - Arena workspace → Gesture controls: offers controls
app/chat/frontend/src/Playground.tsx - Stream transport → Browser inference: falls back
app/chat/frontend/src/utils/streaming.ts - Actions runner → Inference launcher: starts inference
- Inference launcher → llama.cpp wrapper: launches wrapper
app/shared/inference_server.py - llama.cpp wrapper → Model definitions: reads model config
app/shared/llama_server_wrapper.py - Actions runner → Cloudflare tunnel: opens tunnel
- Cloudflare tunnel → Tunnel registry: registers endpoint
- Tunnel registry → Cloudflare service: uses service
- Stream transport → Cloudflare tunnel: streams chat directly
- GitHub Pages → User: serves app
- Model definitions → Model metadata: defines catalog