Skip to content

Draw ideas as animated diagrams, and read whole papers with long-context APIs - #1

Merged
Hussaincodes01 merged 2 commits into
mainfrom
claude/loving-ritchie-qc78k9
Oct 9, 2026
Merged

Hussaincodes01 merged 2 commits into
mainfrom
claude/loving-ritchie-qc78k9

Conversation

@Hussaincodes01

Copy link
Copy Markdown
Owner

Problem

Explained papers came out as their equations re-typeset and animated line by line, instead of diagrams that explain the idea. There were two causes:

  1. Too few shapes. The deployed default is client render mode, which offered only three fixed shapes: a formula chain, a plot, and a row of boxes. For a mechanism like attention, the formula chain was usually the only one that could hold the idea.
  2. Too little of the paper. Groq's free tier allows 8,000 tokens a minute, so ANALYZE saw about 5,000 characters of a ~78,000-character paper. It proposed visuals for whichever equations it happened to be shown. gpt-oss-120b itself has a 131K context window; the per-minute meter was the bottleneck.

Changes

New concept_diagram archetype (client-renderable)

  • The model draws the mechanism on a grid of column/row indices. Element kinds:
    • tokens, stack (vectors), grid (a matrix whose cells light up), bars (a distribution)
    • op (an operator such as ×, softmax, concat), block, container, and a short text annotation
  • Arrows connect the parts. The model scripts 3–7 steps: reveal, flow a pulse along a path, mark cells, relabel ("scores" → "weights"), and focus.
  • The same params render in the browser (reader/components/scenes/ConceptDiagramScene.tsx) and in Manim (arcvisual/templates/concept_diagram.py).
  • Validation:
    • Rejected (structural): references to unknown elements, self-loops, two elements in one grid cell.
    • Fixed in place (cosmetic): unrevealed elements get a reveal step, values are normalised to 0–1, out-of-range marks are dropped, and over-long scripts are trimmed under the runtime ceiling.
    • Normalisation is idempotent, so Gate 1's re-validation of the stored params changes nothing.

Long-context provider (arcvisual/providers/longcontext_provider.py)

  • Presets: openrouter, gemini, mistral, deepseek, cerebras, custom. Each preset has a model fallback chain, and every value can be overridden with LLM_* env vars.
  • The prompt budget is derived from the 100K–260K context window, so ANALYZE reads the whole paper in one pass. Codegen also gets the full section (12,000 chars) instead of a 1,500-char quote.
  • Strict json_schema is used where the host supports it. If a host refuses the schema (a 400) or silently ignores it, that call falls back to prompted JSON instead of failing. OpenRouter requests send require_parameters so they only reach hosts that honour the schema.
  • auto picks the long-context provider after Anthropic and before Groq. settings().offline now agrees with the registry for Groq and every preset.

Steering

  • The analysis prompt adds rule 4: "draw the mechanism, not the notation". concept_diagram is described first, and transform_chain is described as rare.
  • Codegen gets a diagram-drawing guide, and a diagram's beats are its step captions.
  • Triage keeps at most ARCVISUAL_MAX_FORMULA_SCENES (default 2) formula chains per paper. Further formula proposals become diagrams of the same claim instead of being dropped.
  • The landing page hero now shows attention drawn as a mechanism.
  • PIPELINE_VERSION is now 0.3.0-diagrams, so cached articles are rebuilt.

Verification

  • pytest: 364 passed, 1 skipped (the same skip as before). 38 of the tests are new: tests/test_concept_diagram.py and tests/test_longcontext.py.
  • ruff check and ruff format --check are clean.
  • Reader: tsc --noEmit and next build both pass.
  • Slow render tests (tests/test_render.py -m slow) were run against real Manim 0.18.1 in a Python 3.12 venv, with concept_diagram added. Gate 2 and the trace check pass, and estimate_duration is within 0.4% of the measured runtime.
  • Browser and Python timelines match to the millisecond on 4 cases (checked by transpiling plans.ts and running it in Node).
  • Screenshots in a real Chromium at desktop and phone widths: no horizontal overflow and no page errors. They led to three label-overlap fixes.

Not verified: no live model call has been made through the new provider. The provider hosts weren't reachable from the build environment and there were no keys. Model ids and free-tier terms are a snapshot from October 2026 and should be confirmed in each provider's console.

Deploying

The production API is set to ARCVISUAL_PROVIDER=groq in Vercel. To use the new provider, set it to openrouter (or gemini / mistral for a free tier), add the matching key, and redeploy.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BgiEmhLGtyG2FWJkiiwD1M


Generated by Claude Code

…ext APIs

Papers were coming out as their equations re-typeset and animated line by line.
Two causes, fixed together:

1. The deployed default (client render mode) offered only three fixed shapes,
   and the one that could hold an idea was a formula chain. Add `concept_diagram`:
   the model draws the mechanism on a grid (tokens, vector stacks, matrices whose
   cells light up, distributions, operators, blocks, containers), connects the
   parts, and scripts 3-7 steps (reveal, flow a pulse along a path, mark cells,
   relabel, focus). It renders in the browser (ConceptDiagramScene) and in Manim,
   on one timeline: browser and Python durations match exactly, and a real
   Manim 0.18.1 render passes Gates 1-3 with estimate_duration within 0.4%.

2. Groq's free tier meters 8,000 tokens/minute, so ANALYZE saw ~5,000 chars of a
   ~78,000-char paper and proposed visuals for whichever equations it was shown.
   Add a long-context provider with presets (openrouter, gemini, mistral,
   deepseek, cerebras, custom) whose prompt budget comes from the 100K-260K
   context window: one pass over the whole paper, and codegen gets the full
   section. Strict json_schema where supported, falling back to prompted JSON
   when a host refuses or ignores the schema. Auto-selected after Anthropic.

Prompts now tell the analyzer to draw the mechanism, not the notation, with
concept_diagram described first. Triage keeps at most 2 transform_chain scenes
per paper (ARCVISUAL_MAX_FORMULA_SCENES) and re-casts the rest as diagrams of
the same claim. The landing hero shows attention drawn as a mechanism.

PIPELINE_VERSION -> 0.3.0-diagrams so cached articles are rebuilt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BgiEmhLGtyG2FWJkiiwD1M
Copilot AI balanced review requested due to automatic review settings October 9, 2026 16:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T16:46:01.141715Z d6b052e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6b052eadf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread arcvisual/templates/concept_diagram.py Resolved
A grid's `cells` label its rows and columns, and the browser renderer draws
them, but the Manim branch built only the squares, so video renders of an
attention matrix lost their axis labels. Draw each label above its column and
left of its row. Verified with a real render: Gates 1-3 pass and the runtime
estimate is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BgiEmhLGtyG2FWJkiiwD1M
@Hussaincodes01
Hussaincodes01 merged commit 13a9082 into main Oct 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants