arXivisual: Running It on Azure, Auditing It, and Sending the Fixes Back
I read a lot of papers, and I like to see an idea before I read the math. So when I found arXivisual, I had to try it. You give it an arXiv paper, and it gives you a scrolling page with narrated Manim animations, one for each key concept. Manim is the Python animation engine behind the 3Blue1Brown videos. The project is by rajshah6 and contributors, and it runs live at arxivisual.org.
I wanted to run it on my Mac, against my own Azure OpenAI deployment. Then, because I like to know what I am running, I audited the code and fixed what I found. In this post, I show how I got it to run, what the audit found, and how I sent the fixes back to the author.
My fork is on GitHub: mraad/arXivisual. The fixes are in pull request #126 on the original repo.
How it works
The backend is FastAPI with a chain of LLM agents. One agent analyzes the paper sections, one plans the visualizations, and one writes the Manim code. Then four validation gates check the code, with a retry when a gate fails. The last step renders each scene with Manim, adds text-to-speech narration, and stores the video. The frontend is Next.js, and it polls the backend until the videos are ready.
Production runs on Azure Container Apps with Temporal workflows, Postgres and Cloudflare R2 for the videos. Locally, it falls back to SQLite, a background task and a local folder. That is the setup I used.
Running it on Azure behind a gateway
At work, I reach Azure OpenAI through an API gateway. My first smoke test failed with a 401 and the message "missing subscription key". I probed the gateway with each header. Only the api-key header worked. The OpenAI Python client sends the key as a Bearer token, and real Azure accepts either one. The fix was to send both, in one place that the async and the sync clients share:
def _azure_client_kwargs() -> dict:
key = os.environ["AZURE_OPENAI_API_KEY"]
return {
"base_url": _azure_base_url(),
"api_key": key,
"default_headers": {"api-key": key},
"timeout": 300.0, # 5 min: large paper summaries
}
Two more items were necessary before a full paper went through:
- Narration. The default narration uses an Azure text-to-speech deployment, which I did not have. I set
VOICEOVER_TTS_SERVICE=gttsto use the free Google TTS fallback. - LaTeX. Manim calls LaTeX to draw equations. The Homebrew BasicTeX package needs
sudo, so I installed TinyTeX in my home folder and added it to myPATH.
Then I started the backend and submitted a paper:
cd backend
uv sync --extra dev
uv run uvicorn main:app --reload
I ran two papers. The first was the classic Attention Is All You Need. The second was Learning and Reasoning with Geometry: How Generation Helps Spatial Understanding. The GIS person in me could not resist that one :-)
| Paper | Runs | Videos per run | Time per run |
|---|---|---|---|
| 1706.03762, Attention Is All You Need | 3 | 5 | 1 min 37 s to 3 min 3 s |
| 2610.36022, Learning and Reasoning with Geometry | 1 | 5 | 2 min 41 s |
All five videos rendered in each run. The time is from job start to job end, on my Mac.
The audit
The project is live, and it runs LLM-generated code. That combination made me look closer. I did the audit with Claude Code and asked it to read the repo as a senior developer who inherits it and gets paged when it breaks. It gave me 12 findings, and each one had to show a concrete case where the code gives a wrong result. Three of them were the most interesting to me.
The render code can read the server's secrets. The Manim code comes from an LLM, so the project runs it in a subprocess with a scrubbed environment. That is good, but the subprocess runs as the same user as the server. On Linux, the same user can read the parent's environment from /proc/<ppid>/environ, which holds every API key. The fix is a new opt-in setting, RENDER_SUBPROCESS_USER. When the server runs as root (in the container), the subprocess runs as that user:
name = os.getenv("RENDER_SUBPROCESS_USER")
if not name or os.geteuid() != 0:
return {}
account = pwd.getpwnam(name) # unknown user: raise, never fail silently
...
return {"user": account.pw_uid, "group": account.pw_gid, "extra_groups": []}
The result goes straight into subprocess.run(**kwargs). It is off by default, and nothing changes on a laptop.
A repair render can keep the old video. When a video fails a check, the pipeline renders it again. The new video went to the same R2 key as the old one, and R2 serves videos with a one-year cache header. So the CDN can keep serving the broken video for a year. A repair render now saves as {viz_id}_r1.
A failed re-run destroys good videos. On the local path (without Temporal), a new run of a paper replaced the old rows before the new videos existed. If the run failed, the paper lost its working videos. The local path now does what the Temporal path already did. It creates new IDs for each run and hides the old rows only after the run succeeds.
Here is the full list:
| # | Fix | Proof |
|---|---|---|
| 1 | Opt-in RENDER_SUBPROCESS_USER runs generated code as another user | unit tests |
| 2 | Repair render saves under a new name | new test |
| 3 | A paper with no stored text is ingested again | new tests |
| 4 | Local API binds to 127.0.0.1 | config |
| 5 | Video lookup runs off the event loop | test suite |
| 6 | Paper page refetches only while a video renders | tsc, lint, build |
| 7 | Duplicate check uses the same job age as the cleaner | new test |
| 8 | Failed local re-run keeps the old videos | new tests |
| 9 | Removed dead files, queries and duplicate videos | test suite |
| 10 | Docs match the code | docs |
| 11 | Temporal progress counts successful renders only | test suite |
| 12 | / redirects to /api/health | test suite |
After the fixes, the backend suite had 480 tests pass and 7 skip, and ruff was clean. On the frontend, tsc, eslint and next build passed. The change touched 38 files, with 327 lines added and 664 removed. I like a fix that removes more code than it adds.
Fork, then pull request
I had no push access to the original repo, so a pull request had to come from a fork. I made each fix its own commit. The author can review, cherry-pick or drop each one alone. The branch fix/audit-1-12 holds only the 13 commits (the 12 fixes plus the gateway header). The fork's main adds a FORK.md that points back to the original and lists each change with its commit.
One thing surprised me. The original repo has no license. That means "all rights reserved", so I cannot put the fork under MIT. Only the author can choose a license. I asked for one in the pull request.
What this does not show
- Fix 1 has unit tests only. Docker was not running on my Mac, so I did not run a render as
nobodyin the production image. Do that before you enable it. - With fix 1 on, the subprocess still gets the TTS key, because the narration needs it. A separate low-value key for narration is the next step.
- I did not test fixes 2, 5 and 11 against real R2, a CDN or a Temporal server.
- Four runs on two papers is a smoke test, not a measure of video quality.
Next, I want to run more geometry and spatial papers through it and see how well the planner picks concepts that a map person would want to see. More to come.
Comments