Look

Auto follows your local time: Aurora by day, Neural in the evening, Terminal after midnight.

Selected work 3 of 5

Lecture Copilot

Real-time bilingual subtitles and grounded Q&A for English-taught lectures

Personal project Personal project2026built with Claude Code

Results

A local-first study copilot: GPU speech recognition, live Chinese subtitles in two passes, and answers grounded in the lecture and its materials—with citations that can be re-checked.

  • ≈2.9 s

    from the end of a spoken sentence to Chinese subtitles (median; p90 3.4 s)

    Measured in a real-time rehearsal that replays a recorded lecture through the live pipeline.

    Source: Project log: real-time rehearsal — a recorded lecture replayed at 1× through the live pipeline (17 sentences)

  • 3.4 s to 0.78 s

    first token per sentence after moving to warm streaming sessions

    Source: Project log: measured on Windows, Sept 2026 (Haiku 4.5, thinking off)

  • 98.7%

    slide-tracking accuracy from screen captures (373 of 378)

    Source: Project log: 60 slides × 3 page-turn paths × 2 projection geometries

  • 24

    crash scenarios tested by killing real processes

    Source: Project test suite: 3 ways to pause × 4 interruptions × 2 ways to resume

01

Problem

Following a fast English lecture in real time is hard when English isn’t your first language—and generic chatbots answer without knowing what was actually said in class. I wanted subtitles within a few seconds, answers grounded in the real lecture and slides, and recordings that survive pauses, crashes and unplugged devices.

02

How it works

  1. Capture

    A supervisor runs ffmpeg and restarts it within 500 ms. Audio lands on disk as 1-second WAV shards, so the file system is both the queue and the watermark.

  2. Recognize

    Silero VAD cuts sentences and faster-whisper large-v3 transcribes them on a local GPU—about 0.3 s per sentence on an RTX 3080—with course vocabulary as hot-words and filters for known hallucinations.

  3. Subtitle in two passes

    A warm Haiku session drafts each sentence in about half a second. Every 12 sentences, an Opus session rewrites the batch with the slides in its cached context. A final translation can replace a draft—never the reverse.

  4. Answer with receipts

    Hybrid retrieval—SQLite FTS5, CJK bigrams and a Chinese-to-English concept bridge—feeds the model. Every passage it sees is stored with a sha256, so each citation can be re-verified.

  5. Keep working after class

    A background worker translates every material page by page, writes summaries through the same validation gate, rebuilds the index and keeps a short memory for each lesson—pausing whenever a class is live.

Live path in the top row; everything below runs in the background. Supervised ffmpeg capture to 1-s WAV shards on disk; 1-s WAV shards on disk to Silero VAD → faster-whisper (GPU); Silero VAD → faster-whisper (GPU) to Haiku draft → Opus final; Haiku draft → Opus final to Browser · SSE subtitles; Haiku draft → Opus final to LLM gateway · headless Claude Code; Browser · SSE subtitles to Hybrid retrieval + cited answers; Hybrid retrieval + cited answers to LLM gateway · headless Claude Code; Worker · translate, summarize, index to LLM gateway · headless Claude Code. Live path in the top row; everything below runs in the background. Supervised ffmpeg capture to 1-s WAV shards on disk; 1-s WAV shards on disk to Silero VAD → faster-whisper (GPU); Silero VAD → faster-whisper (GPU) to Haiku draft → Opus final; Haiku draft → Opus final to Browser · SSE subtitles; Haiku draft → Opus final to LLM gateway · headless Claude Code; Browser · SSE subtitles to Hybrid retrieval + cited answers; Hybrid retrieval + cited answers to LLM gateway · headless Claude Code; Worker · translate, summarize, index to LLM gateway · headless Claude Code.
Schematic Live path in the top row; everything below runs in the background.
  1. Gradient descent takes a small step against the gradient.

    Draft 梯度下降沿着梯度相反方向走一小步。

    Final 梯度下降每次朝梯度的反方向迈出一小步。

  2. If the learning rate is too large, the loss can start to diverge.

    Draft 如果学习率太大,损失可能开始发散。

    Final 学习率太大的话,loss 可能会开始发散。

  3. So in practice we decay the learning rate over time.

    Draft 所以实践中我们随时间衰减学习率。

    Final 所以实际训练时,我们会让学习率随时间逐渐衰减。

Illustration Illustration of the two-pass subtitles (not real lecture content).

03

Decisions worth explaining

An LLM gateway on headless Claude Code

Every model call goes through one gateway that turns the Claude Code CLI into persistent, multi-turn streaming sessions behind the same complete() interface, cutting first-token latency per sentence from 3.4 s to 0.78 s. A ledger records every call and raises an alarm when a prompt prefix stops hitting the cache.

Durability is a tested invariant

Crash injection kills real processes at named checkpoints. A 24-cell matrix (3 ways to pause × 4 interruptions × 2 ways to resume) checks 7 invariants per cell. That is how silent data-loss bugs—like an audio archive that was flushed only every ~87 seconds—were found and fixed.

Contract-first, AI-directed

I rebuilt it in phases, each with a written contract and a full test suite that had to pass before the next began—about 570 tests, 122 logged design decisions, and frozen modules pinned by sha256. Claude Code wrote most of the code inside those gates.

04

Stack

  • Python
  • FastAPI
  • SQLite (WAL, FTS5)
  • ffmpeg
  • Silero VAD
  • faster-whisper (CUDA)
  • Claude Code CLI
  • Server-Sent Events
  • Vanilla JS
  • Swift (macOS capture)

Personal project

A personal tool with one user (me). The repo is private because it contains personal course data—happy to walk through it.