Inspiration

Every year hundreds of thousands of students compete in mathematical modeling contests (CUMCM, MCM/ICM, å为æ¯...). The bottleneck is never the math â it's the plumbing: cleaning data, fighting Python environments, tuning matplotlib plots, wrestling LaTeX, and formatting 25+ pages of formulas and tables. Most teams burn 70% of their time on tooling instead of modeling. We built ModelLab AI to hand that entire pipeline to an autonomous agent, so students can focus on modeling â and watch exactly how a complete workflow is executed.

What it does

Upload a competition problem PDF and optional data files, click start, and an autonomous agent (built on the Claude Agent SDK) runs a five-stage pipeline in a sandboxed project directory:

  1. Read â parses the problem and data semantics
  2. Model â selects algorithms and builds mathematical formulations
  3. Solve â writes and runs real Python code (numpy/pandas/scipy), auto-debugs failures, generates figures
  4. Write â produces a competition-standard LaTeX paper section by section
  5. Export â compiles with XeLaTeX and packages PDF + .tex + code + figures + data

A live dashboard streams every step over SSE: five-stage progress, per-round agent logs, tool calls, and token/cost accounting. Sessions are resumable; failed tasks auto-refund their credit.

How we built it

  • Runner (runner/run.js): a thin wrapper over the Claude Agent SDK query() loop (up to 2000 turns), running against DeepSeek's Anthropic-compatible endpoint (deepseek-v4-pro) â model-agnostic by design.
  • User site (web/): Express + SQLite â auth with math-captcha registration, project uploads, a 2-worker task queue with 180-min timeouts, SSE live logs, credit economy with auto-refund, delivery packaging, and an ops/admin console.
  • Production: nginx + systemd + Let's Encrypt on a HK VPS; the live demo generated a real 31-page paper for the 2025-CUMCM-B VLSI problem in ~1 hour.

Challenges we ran into

  • Keeping an agent honest: sandboxed HOME, project-dir confinement rules, blocking solve scripts, reproducible deliverables enforced by prompt contract.
  • Making a multi-hour agent run watchable: keyword-based workflow-stage inference from raw logs into a 5-stage progress bar.
  • Chinese LaTeX environments and fonts on a bare server â solved with TinyTeX + ctex.

Accomplishments that we're proud of

A genuine end-to-end autonomous pipeline that turns a 72-hour manual marathon into a ~1-hour supervised run, with every step visible and reproducible â the generated 29-31 page papers compile with zero errors.

What we learned

How to design reliable agentic systems: deterministic stage contracts, session resumption, cost/usage accounting, and honest failure handling (auto-refund + readable exit reasons).

What's next for ModelLab AI

Multi-model routing, human-in-the-loop checkpoints between stages, team workspaces, and an open evaluation harness against historical contests.


ModelLab AI is a study & practice assistant for mathematical modeling â generated papers are for learning, never for submission to real contests.

Built With

Share this project:

Updates

Submission history