[{"content":" \u0026gt;_ Before reading\nWhat does this post answer? It is written for people who want to start using AI tools (mainly Claude Code here), with a background close to lab research. It does not teach installation or commands; it sets out when I find these tools useful, why, and what to watch for. Research content is kept abstract; the experiment loop is detailed in the earlier workflow log. Where I have used Claude # I mainly use two of them: Claude (web/app) for everyday questions, and Claude Code (terminal) for research work and anything else that can be done on a computer. None of this is specific to Claude, though; most AI agents from other companies can now do these tasks too.\nSo far, the scenarios I have tried fall roughly into these groups:\nGenerating ideas: brainstorming topics and listing possible directions. Research: reading and organizing existing projects and literature, and picking up work from existing documents and scripts. Slides and documents: connecting Claude to Google Drive to edit Google Docs and Slides directly. Linux: installing packages, adjusting configuration, tuning laptop performance, fixing bugs. I think Linux suits this kind of AI agent especially well: whatever the terminal can do, Claude can mostly do for you. This personal website: the one you are reading. Improving my own workflow: for example, having Claude read back through its own session history to find habits worth changing. How well these went varied a lot. Looking back, two things mostly decided it: whether the result can be verified, and how much human judgment it needs.\nEasier to verify → More human judgment → Ideas Research Slides Website Workflow Linux Experiment loop Best handed to Claude Stay closely involved Where the seven scenarios sit (schematic). The further toward the lower right, the more you can hand to Claude. Understand the environment Claude Code works in # A few concepts first; the methods later follow from them.\nA folder is a workspace # Claude Code treats the folder it starts in as the project. It can read the files there and looks there for instruction files such as CLAUDE.md. So \u0026ldquo;one project, one folder\u0026rdquo; is already a way of organizing work. By default it rarely wanders outside this workspace on its own; if you need stricter isolation, Codex, for example, offers a stricter sandbox.\nThe harness decides what it can do # The same model behaves very differently inside different harnesses: Claude on the web, Claude Code, and other vendors\u0026rsquo; coding agents each provide different tools, permissions and memory, with their own strengths and weaknesses. Most of their abilities are similar; compared with Codex, I prefer how Claude Code handles long tasks.\nA harness is roughly made of these parts:\nThe model: thinks and decides the next step, for example Opus or Sonnet. System prompt: tells the model its role, how to work, and the rules. Tools: reading and writing files, running commands, searching the web, or connecting to outside services such as Google Drive through MCP. Permissions and sandbox: which actions need your approval first, and what it is allowed to touch. Context management: which instruction files are loaded at the start, and when to compress a conversation that has grown too long. Instruction files and memory: CLAUDE.md, automatic memory and other information kept across sessions. Inside this shell the model repeats \u0026ldquo;call a tool → look at the result → decide the next step\u0026rdquo; until the task is done. So the same model in a different harness is like the same person moving to a lab with different equipment.\nHarness (e.g. Claude Code) System prompt Model Tools / MCP Permissions / sandbox Context management Instructions, memory Loop: call a tool → look at the result → decide the next step The same model can do different things depending on what the shell provides (schematic). Context is a limited resource # What Claude can see in one session (its context) has a limit. The longer a conversation runs:\nThe more it costs: every turn reprocesses everything before it, so quota drains faster. The more it forgets: near the limit, older content is compressed into a summary and details are lost; rules given earlier may also be ignored. Start Long conversation After compaction Rules and goals intact Costlier, near the limit Summary only, details lost Remedy: one task per session, and keep what matters in files How context fills up within one session (schematic). Caching: why long conversations stay expensive even with cache hits # I said above that every turn reprocesses everything before it. In practice Claude uses prompt caching: recently processed content is kept for a while, and if the next turn starts with the same content, that part is read from the cache at a much lower price. A few related ideas:\nCache hit: the start of what you send matches what is in the cache exactly, so that part is read from the cache. Matching runs from the beginning (prefix match): change anything in the middle and everything after that point has to be processed again. Write and read prices: writing to the cache costs a bit more than normal input (1.25× with a 5-minute TTL, 2× with a 1-hour TTL), while reading is much cheaper (0.1× on most models, 0.05× on Opus 5.5) (Anthropic docs). TTL (Time To Live): how long a cache entry lasts. The default is 5 minutes, and every hit resets the timer, so the cache never expires while you keep working. Step away longer than the TTL and the next turn has to write the whole context again, which costs more the longer the context is. What breaks the cache: after a compaction, the earlier conversation is replaced by a summary, so the start has changed and the next turn is a fresh write. Switching models mid-session (say, Opus to Sonnet) also cannot reuse the existing cache. So why not always use the 1-hour TTL? Because 1-hour writes cost 2× while 5-minute writes cost 1.25×. During continuous work, 5 minutes is enough and the extra write cost is wasted; the 1-hour TTL only pays off if you often pause for 5 to 60 minutes and come back. More importantly, the TTL only decides whether the cache expires; it does nothing about the cost of re-reading the context on every turn. The session in the example in the costs section already used the 1-hour TTL with a hit rate near 100%, and it was still expensive.\nThe key point: a hit is a discount, not free. Every turn reads the whole context, so a 300k-token turn costs three times as much to read as a 100k-token turn, even when everything hits.\nWhat Claude sees at the start of each session # Claude itself does not remember the previous conversation. Each time a new session starts, Claude Code first puts a batch of content into the context; before you type anything, it has already \u0026ldquo;read\u0026rdquo; these. According to the official documentation, this roughly includes:\nContent Where it lives When it is loaded System prompt, tool descriptions, environment info Provided by the harness At the start Skill descriptions, MCP tool names Installed skills and MCP servers Short descriptions at the start; full content only when used Global instructions ~/.claude/CLAUDE.md At the start, shared by all projects Project instructions The project\u0026rsquo;s CLAUDE.md or .claude/CLAUDE.md (including those in parent folders) At the start Subfolder instructions CLAUDE.md inside a subfolder When files in that folder are read or written Automatic memory ~/.claude/projects/\u0026lt;project\u0026gt;/memory/MEMORY.md At the start, first 200 lines or 25 KB only There are three kinds of \u0026ldquo;memory\u0026rdquo; here, differing in scope and in who writes them:\nGlobal instructions: written by you, apply to every project, for example \u0026ldquo;answer in Traditional Chinese\u0026rdquo; or \u0026ldquo;run the tests before committing\u0026rdquo;. Project instructions: written by you (or by Claude at your request), apply only to this project. They live in the folder, so they can be synced to other machines with git and shared with collaborators. Automatic memory: things Claude notes down itself while working, such as your preferences and mistakes it has run into. The official documentation says plainly that it is machine-local and does not sync across machines. One more point: after a conversation is compressed, the CLAUDE.md at the project root, the automatic memory and the system prompt are loaded again. In other words, rules written into instruction files survive compaction; rules given only in the conversation may not. To see what is currently taking up the context, type /context in Claude Code.\nClaude is good at continuing and critiquing, not at choosing a direction from nothing # Good at # Finding flaws: reviewing code, documents and experiment designs like a reviewer and finding the holes. Specific instructions: the more detail you give, the more accurate the result. Tasks that split into verifiable parts: it works best when a large task breaks into small ones whose results can each be checked. Continuing something already started: given a draft or existing files, it follows the thread well; starting from a blank page is harder. Not good at # Choosing a direction: AI produces many ideas, but human ideas are often more accurate and more valuable, and AI\u0026rsquo;s ideas often turn out to exist already. A better split is that people choose the direction and AI expands and critiques it. Guaranteeing there are no bugs: the flip side of being good at finding flaws. A fresh agent almost always finds new problems, so \u0026ldquo;everything is correct\u0026rdquo; takes many iterations, not one pass. Working methods that help # Managing context # One task per session: avoids the cost and forgetting of long context. Start a new session for a new topic. Keep what matters in files: CLAUDE.md (project rules), PLAN.md (plan), EXPERIMENTS.md (experiment log) and so on. Conversations get compressed and sessions end, but files remain, and the next session picks up from them. Of these, CLAUDE.md is loaded automatically at every start and after compaction (see the table above); PLAN.md and EXPERIMENTS.md are not, so you can add a line to CLAUDE.md such as \u0026ldquo;read PLAN.md before starting\u0026rdquo;, or pull it in directly with @PLAN.md. Beyond that, an experiment log tends to grow longer and longer. The best approach is to summarize EXPERIMENTS.md, for example into EXPERIMENTS_digest.md, so that a new session can read only the summary and look things up when needed.\nBelow is an excerpt from the CLAUDE.md of one of my prostate CT classification projects (translated from Chinese; paths, machines and result numbers abstracted):\n# Prostate CT cancer classification (radiomics → DL) \u0026gt; The radiomics stage is finished and frozen (`SUMMARY.md`, `EXPERIMENTS.md`, \u0026gt; `outputs/`: **read-only, never overwrite**). Current work is the DL stage. ... ## Data rules ... - Other files in the parent folder are **not read or referenced**, including their conclusions, code and methods. ## Split rules - `data/split.csv` is the locked train / val / test split. **Never re-split.** - Model selection and tuning use 5-fold CV inside train only. - **val only evaluates a configuration already chosen by CV.** - **test is sealed**: run it once, after the final model is frozen. ... ## Subagent rules ... - Every subagent prompt carries the full rules: data limits, the locked split, test is off-limits, output paths and formats. - Do not take subagent results on trust: the main agent recomputes key numbers before writing them to `EXPERIMENTS.md`. ... The file is less about how to run things than about what must not be done:\nFix the evaluation rules in writing: the split is locked, model selection uses CV only, val only evaluates chosen configurations, and test is sealed and run once. When it runs the loop on its own, the easiest way to go wrong is to overfit val without noticing, or to peek at test. Limit the sources of information: the parent folder holds an earlier project, and the file says plainly not to read or reference it, so old conclusions are not carried over. Subagents follow the rules too: every subagent prompt carries the full rules, and the main agent recomputes reported numbers before they go into the log. Freeze a stage when it is done: once radiomics was finished it became read-only, and the DL stage got its own files and folders. The matching EXPERIMENTS_DL.md always has four parts: current status, a progress checklist, a results table, and a dated log. A new session reads the first three to know where things stand and looks further down only for details:\n# DL experiment log Pass mark: validation AUC \u0026gt; 0.85. Model selection uses train 5-fold CV only; val only evaluates chosen configurations; test is sealed. Plan: `PLAN_DL.md`. ## Current status (YYYY-MM-DD) - Best pure DL: \u0026lt;run\u0026gt;, CV \u0026lt;x\u0026gt; / val \u0026lt;y\u0026gt; (95% CI), below the pass mark. - Bottlenecks: \u0026lt;subgroup A\u0026gt;, \u0026lt;confounder B\u0026gt;. ## Progress - [x] datalist - [x] reference architecture, fixed - [x] \u0026lt;direction 1\u0026gt;, \u0026lt;direction 2\u0026gt;, … - [ ] final test (once) ## Results table | run_id | date | input | model | train-CV AUC | val AUC (95% CI) | notes | |---|---|---|---|---:|---:|---| ## Log ### YYYY-MM-DD Environment and data - **Incident**: `uv sync` removed packages outside the lock file, including the cuDNN library torch needs. Fixed by reinstalling; from now on always `uv run --no-sync`. Some rules grew out of the log. After a uv sync once deleted the cuDNN library torch needs, CLAUDE.md gained the line \u0026ldquo;always uv run --no-sync\u0026rdquo;.\nManaging direction # Plan mode and auto mode: in plan mode Claude first proposes a plan and acts only after you approve it; in auto mode it acts directly, with a model classifier approving each action in your place. Use plan mode when the direction is unclear and auto mode when the task is well defined. The difference is when the person steps in: before the work in plan mode, after it in auto mode. I find the two about equally effective. In my own work I often have extra thoughts or corrections along the way (for example, as above, fixing something that broke mid-task), which fits the auto mode habit better. Plan mode Auto mode Request Plan Approve Execute Request Execute directly Review Shaded boxes are where a person steps in: before the work in plan mode, after it in auto mode. Boris Cherny, who leads Claude Code, has said that he and his team have used only auto mode for months and \u0026ldquo;can\u0026rsquo;t imagine going back\u0026rdquo; to approving permissions one by one (X post). He even calls auto mode his most important tip: because you are not constantly stopping to click approve, you can run several sessions in parallel (X post). According to the official write-up, auto mode hands approval to a model classifier, a middle ground between \u0026ldquo;a person reviews every action\u0026rdquo; and \u0026ldquo;no safeguards at all\u0026rdquo;; Boris also cautions that it is not perfectly safe, and whether to use it depends on how much risk you can accept (Threads).\n/advisor: a Claude Code feature that lets another, usually stronger, model review the current approach at key moments, like having a consultant. Some people also think it saves quota (use a weaker model such as Sonnet by default, and set Opus as the advisor). Human ideas first: think of the direction yourself, then ask Claude to extend and critique it. That works better than asking it for ideas directly. Extending what it can do # Subagents: hand parallel work to several sub-agents to finish faster; they are also good for an independent second opinion. Each subagent has its own context and returns only its conclusion to the main session, so heavy reading and searching do not fill up the main session\u0026rsquo;s context. That is how I split the work in using several agents to brainstorm research topics: the main session only discusses with me and coordinates, while proposing ideas, challenging them and looking things up are each done by a different agent. Main session Subagent: propose ideas Subagent: challenge ideas Subagent: look things up In parallel, each with its own context Only a short conclusion comes back The main session coordinates; the details stay in the subagents and in files (schematic). More subagents are not always better, though. Describing its own multi-agent research system, Anthropic notes that a single agent uses about 4 times the tokens of a chat, and a multi-agent system about 15 times, so it only pays off when the task is valuable enough. They also point out that most coding tasks have less truly parallel work than research, and that tasks which need a shared context or have many interdependencies are not yet a good fit for multiple agents (Anthropic Engineering, 2025). What suits subagents best is heavy reading, searching, or work that needs an independent opinion.\nSkills / plugins: package a repeated workflow so it can be called directly next time. For example, I turned \u0026ldquo;update the progress-report slides from the project results\u0026rdquo; into a skill: it reads the experiment results, turns them into result pages and figures, and writes them into a fixed Google Slides format. Now I only say \u0026ldquo;update this week\u0026rsquo;s slides\u0026rdquo;, and it follows the same process without my explaining the format each time. Claude also offers many useful plugins and connectors to install. The difference is roughly: Connector: lets Claude reach an outside service and read or write your data, for example Google Drive / Docs / Slides (editing documents and slides directly), Gmail, Google Calendar, or GitHub. Plugin / skill: packages a way of working or a tool, for example a code review of the current changes, skills for handling PDF, Word, PowerPoint and Excel files, or front-end design guidance. Remote machines: once your ssh config is set up, Claude can look for idle compute on different remote machines and run experiments there. Tmux: letting Claude operate a tmux pane helps manage long-running programs and watch their output. Where something has to be typed by hand (a password, for example), this is very useful. 0 Claude Code \u0026gt; How far is training? ● tmux capture-pane -t 1 epoch 12/40, loss 0.21 ● tmux send-keys -t 2 \"ssh …\" The remote is waiting for a password in pane 2. 1 python train.py epoch 11/40 loss 0.23 epoch 12/40 loss 0.21 ▌ 2 ssh \u0026lt;remote\u0026gt; password: ▌ ← a person types this [exp] 0:work* Sketch: Claude Code on the left; on the right, a training run and an ssh session waiting for a password. Claude sends commands with send-keys and reads output with capture-pane; typing the password is left to a person. When the goal is clear and verifiable, let it run the loop # When a project has a clear goal and results can be verified, the most effective use is to let Claude run a loop on its own:\nRun Verify Claude adjusts Design next run Stop? Budget and stop still open Run → verify → adjust → next run. The loop is easy to set up; knowing when to stop is the hard part. This loop works very well on projects with a clear, verifiable goal; details are in the earlier post.\nThe open question is budget and stopping: how much quota should it get, and how does it know when to stop? For now I write the stop condition into CLAUDE.md, but that requires knowing in advance where the target is.\nI do not have a perfect answer for setting the budget yet. For now, a reasonable approach is to cap the number of experiments (for example, at most 10), but there is a good chance it will not reach the performance you want. So it is best to judge this for your own task.\nCosts and limits # Errors and hallucinations: today\u0026rsquo;s models are much stronger than before, but they can still hallucinate or give wrong information. Safeguards are sometimes too strict: some reasonable actions are blocked and need extra confirmation or a different route. Security questions, for example, may be refused (even when testing only in your own environment), and in more serious cases the account may be banned. Output is not always easy to read: Claude tends toward a defensive style, with cautious sentences and many qualifiers. This is especially poor for paper writing and needs rewriting. It can ignore rules you wrote down: even rules in CLAUDE.md are sometimes ignored. Keeping instruction files short and putting the most important rules first helps. It is expensive: the 5-hour and weekly quotas need careful management. I give clear-cut tasks to Sonnet and tasks that need judgment or advice to Opus. Avoid long back-and-forth when much of the context is already used; compact or start a new session when appropriate (see caching above for why, and the example below for real numbers). Switch models when starting a new session, too, since switching mid-session cannot reuse the existing cache. A bigger context is not always better either. Thariq from the Claude Code team notes that on a 1M-context model, context rot (the model losing its grip on earlier details) starts around 300–400k tokens, though the threshold depends on the task; he also suggests running /compact yourself with a hint rather than waiting for automatic compaction (X article). So when you get near that range, it is time to compact or start a new session. Memory does not follow you across machines or apps: when you use Claude in different places, memory does not sync on its own. A shared \u0026ldquo;second brain\u0026rdquo; that Claude manages would be useful. A real example: what long context costs # Once I noticed my quota draining unusually fast over two hours, so I asked Claude to analyze the session logs. Almost all of it came from a single session spent revising a paper:\nItem Value Model calls 308 (Opus 5.5) Average context per call about 265k tokens (peak about 366k) Cache reads 80.9M tokens Cache writes (1-hour TTL) 0.81M tokens Output 0.31M tokens Hit rate about 99% The hit rate was nearly perfect, so caching was not the problem. At API prices those two hours came to about US$29: re-reading context was 56%, cache writes 22%, and what Claude actually wrote only 22%. Re-reading the context on every turn cost about 2.6 times the output itself, and many of those calls produced nothing more than a one-line grep command.\nWhy was the context so large? Automatic compaction only triggered at about 370k tokens; afterwards 110–170k still remained, and it soon grew back past 300k. That cycle repeated three times in two hours, so most calls ran with 200–370k tokens of context. The growth came mainly from reading high-resolution images repeatedly, re-reading an entire online document after every small edit, and many small, fragmented commands.\nThe alternative: when context reaches about 150k, or a piece of work ends, write progress to a notes file and start a clean session that picks up from the notes and whatever documents it needs. I estimated this by replaying each step of the same work (figure below): average context falls from 265k to about 86k, and re-reading drops from about US$16 to about US$5. New sessions have to write their context again, so cache writes rise a little, but the total still falls by about a third. Running /compact by hand also helps, but in this log 110–170k remained after each compaction, a far higher starting point than a clean session. What matters is doing it early and keeping each piece of work\u0026rsquo;s starting point small.\nContext size at each call One session to the end (actual log) Notes + new session at ~150k (estimate) 0k 100k 200k 300k 400k auto-compact (3 times) → 1 101 201 301 Call number → Cost of the two hours (API prices, US$) One session $16.2 $6.5 $6.2 ≈ $29 Clean sessions $5.1 $8.2 $6.2 ≈ $20 Re-reading context Cache writes Output Top: the 308 logged calls, and an estimate that replays the same work steps but restarts from 30k whenever context passes 150k. Bottom: re-reading drops from about $16 to about $5; new sessions add some cache writes, so the total falls by about a third. These are API prices. I cannot confirm that subscription quotas count cache reads in exactly this proportion, but the direction is the same: the bigger the context and the more calls, the faster the quota drains.\nClosing: people judge, AI expands # So far, most of the work is still human–AI collaboration, and many points need a person\u0026rsquo;s judgment. The parts that can be split into smaller tasks and verified automatically are where AI is strong, and that is also how it speeds up your own workflow. At the current pace, though, perhaps before long none of this will need to be so elaborate.\n","date":"24 November 2026","externalUrl":null,"permalink":"/posts/claude-code-experience/","section":"Writing","summary":"AI tools help most when a task splits into small steps that can each be checked. This post covers the scenarios, mental model, working methods and problems from my use of Claude Code.","title":"Working with Claude and Claude Code: Scenarios, Methods and Limits","type":"posts"},{"content":"Notes on what I\u0026rsquo;m learning and curious to explore, making knowledge and ideas easier to understand.\n","date":"24 November 2026","externalUrl":null,"permalink":"/posts/","section":"Writing","summary":"","title":"Writing","type":"posts"},{"content":"","date":"24 November 2026","externalUrl":null,"permalink":"/","section":"Yenjia Chen","summary":"","title":"Yenjia Chen","type":"page"},{"content":"This is a workflow log. It does not discuss the task itself or the results.\nThe task is a binary image classification problem. Two studies were run one after the other:\nStudy A: hand-crafted features (radiomics) with tabular models, started in plan mode. Study B: deep learning on the same data and split as Study A, started in auto mode. Both used the same loop: experiment → verify → design or adjust → next round, until a clear target is met.\nTarget and rules go into files first # Before starting, three things were stated. All of them ended up in the project\u0026rsquo;s CLAUDE.md:\nA clear stopping condition: validation AUC \u0026gt; 0.85. Once it is met, keep improving until several rounds bring no gain; if it is not met, keep adjusting or change direction. Evaluation rules: the split is made once and its hash recorded; it is never redone. Model selection and tuning use only 5-fold CV inside the training set. The validation set only evaluates a setting that CV has already chosen. The test set stays sealed and is run once, after the user decides to freeze the final model. Data constraints: which fields may be used, which directories are read-only, and that all output stays inside the experiment directory. Two more files:\nEXPERIMENTS.md: one row per round, with the hypothesis, settings, CV, validation and conclusion. An iteration ladder: a list of directions ordered from simple to complex. Each layer has its signal source confirmed before moving on. With the rules in files, the work can continue after the conversation is compacted (automatically summarized when context runs out) or a new session starts. Each study went through one compaction, and neither lost progress.\nWhat one round looks like # Propose a hypothesis (next feature layer / new architecture) → Run in the background, resumable, with a status file per item → Check: number of successes, no duplicate IDs, AUC recomputable from the prediction file → Decide whether to adopt it from CV alone → Once CV has chosen, evaluate validation once and log it in EXPERIMENTS.md → Ablation and error analysis decide the next round In practice, the next round was usually driven by one of these observations:\nAblation locates the signal: whichever feature group costs the most when removed is the direction where new information gets added. A bug is found: in the first round, a wrong column filter meant a whole feature group was barely produced. The next round fixed it. The model side saturates: the five models\u0026rsquo; predictions correlated at 0.88–0.97 with each other. Switching models made no sense; the remaining lever was new information, not tuning. Shortcut checks: some features separated the two classes only because the two groups happened to be imaged differently (for example, how much area the images covered), not because of any difference in the target itself. A model that scores on such cues fails on a new batch of data. So a sensitivity analysis removed all such features and retrained. The result barely changed, and only then was it accepted. No gain, no adoption: an extra set of hand-designed features and a per-group late fusion both failed to raise CV. They were logged and dropped. Study A\u0026rsquo;s validation AUC by round:\nRound Main change val AUC 1 Baseline features 0.757 1 Four groups of regional features added layer by layer 0.815 2 Bug fix, new regions, derived features, five-model ensemble 0.841 3 New features from a second batch of segmented structures 0.872 (target met) 3 Sensitivity analysis: suspected shortcut features removed 0.872 Study B ended the other way. Pure deep learning reached 0.838, short of the target. Claude Code reported the gap and the bottleneck (which kind of sample the errors concentrated in) instead of tuning against validation to push the number up. The target was met only by late fusion with Study A\u0026rsquo;s frozen model, labelled as a hybrid.\n\u0026ldquo;When the target is not met, report it honestly; do not overfit validation, touch the test set or take shortcuts outside the rules\u0026rdquo; is also a rule written in CLAUDE.md.\nWhat Claude Code handled # The environment (uv), the data list, the split and the code for the whole pipeline. Scheduling and watching long jobs: run in the background with a notification on completion; Monitor follows each epoch\u0026rsquo;s log during training. In Study B, sshing to other lab machines to run experiments, checking first whether anyone was using the GPU. Each round\u0026rsquo;s ablation, error analysis and suggested next step. Checking the numbers: before anything is logged, AUC is recomputed from the prediction file and the counts are verified. What I kept # The rules and the target themselves. When to freeze a model and when to run the test set. Directions from past experience, for example \u0026ldquo;a pretrained model should fine-tune a larger share of its weights\u0026rdquo;. The design of the final ensemble. Before a study ends, asking to \u0026ldquo;settle the results into documents\u0026rdquo; and then commit, so the next session can pick up. Plan mode and auto mode # Study A did not use plan mode throughout. Plan mode covered only the initial planning; once the plan was approved, execution ran in auto mode. Study B was in auto mode from the first message.\nStudy A: started in plan mode Study B: started in auto mode Opening Described the task and target; Claude Code explored the directory and proposed a plan A longer list of constraints How the plan came about Rejected twice, approved the third time Claude Code wrote PLAN_DL.md, edited CLAUDE.md and started directly When corrections happened Before execution, added as rules on rejection During execution, as questions and adjustments in the conversation Duration About 1.6 days About 1 day The value of plan mode was in those two rejections. In the first plan, Claude Code had found earlier conclusions in a parent directory and planned its direction around them. That was not what I wanted: this study was meant to be independent. Everything added on rejection went into CLAUDE.md before any code ran, and for the next day and a half almost no intervention was needed.\nAuto mode skips that gate, so corrections happen during execution. The upside is reacting to intermediate results, for example suggesting full fine-tuning only after seeing that a pretrained model had been fine-tuned on just some layers. The downside is checking in more often.\nOverall the two felt about the same. One caveat: Study B reused Study A\u0026rsquo;s locked split, segmentations and CLAUDE.md, so it started further along. The difference here is mainly when the user\u0026rsquo;s corrections came in; it cannot be said that the mode itself changed the outcome.\nObservations # A clear numeric target plus fixed evaluation rules is what lets Claude Code run many rounds without confirmation each time. \u0026ldquo;The numbers check out\u0026rdquo; matters more than \u0026ldquo;it finished\u0026rdquo;. The rules require verifying success counts and recomputing AUC from prediction files after every run. Before the real experiments, Claude Code also ran the pipeline once with shuffled labels; CV AUC came out around 0.46, confirming there was no leakage. Claude Code ran the shortcut checks and sensitivity analysis on its own initiative, and logged the results as they were. The two modes felt about the same in use; they differ only in when corrections arrive. Plan mode suits the case where I already know there are things I don\u0026rsquo;t want but haven\u0026rsquo;t said them yet; auto mode suits adjusting while watching results. Boris Cherny, who created Claude Code, has said he now uses auto mode instead of plan mode, and that his team has used auto mode exclusively for months (1, 2). One of his examples when introducing auto mode is letting the model iterate \u0026ldquo;until it hits a performance benchmark\u0026rdquo; (3), which is the same use as here. Both studies ended by settling results into documents and committing, so the next session (for example, preparing meeting material) starts from the documents. Try it yourself # The task and data above cannot be shared, so I made a small demo you can run yourself: claude-loop-demo.\nClassify 28×28 breast ultrasound images as benign or malignant, CPU only, with numpy, scikit-learn and matplotlib. The folder holds only data. You give the rules in one pasted prompt, as in Study B above: Claude Code writes CLAUDE.md, the experiment log and the code itself, then starts the loop. The rules in the prompt all come from this post: a fixed split, val evaluated once per round, a shuffled-label leakage check first, a shortcut check before any result counts, and AUC recomputed from prediction files. My run took about 18 minutes. Spoiler · read after your runHow the data was modified, and my resultsShow The data is derived from BreastMNIST (MedMNIST v2, CC BY 4.0), re-split, and seeded with a deliberate shortcut: in some images the top-left pixels [1:3, 1:3] are brightened by 70, like a marker burned in by a machine. In train, 76% of malignant images carry the marker versus 4% of benign; in val, 93% versus 4%. The marker is artificial, so the data is suitable for practice only, not for research.\nMy run:\nRound Setup Marker CV val Counts? R0 shuffled-label check – 0.50–0.54 – no leakage R1 raw pixels + logistic regression unmasked 0.898 0.953 ✗ signal on the top-left marker R2 same as R1 masked 0.783 0.741 ✗ below target R3 HOG + pixels → PCA → SVM, flip augmentation masked 0.802 0.804 ✓ One malignant image\nlesion in the center, marker top-left\nR1: where the signal is\nmasking the corner costs 0.18 AUC\n00.090.18 R3: after masking the marker\nno single patch costs more than 0.006 AUC\n00.0030.006 The dashed box marks the marker. Orange is occlusion sensitivity: each 4×4 patch is masked in turn and the drop in train AUC is recorded; the more orange, the more the model relies on that area. Sensitivity is computed over all images and overlaid on one of them for readability. R1 relies almost entirely on the marker. After the marker is masked, R3's signal is spread over tissue, and the largest drop from any single patch is about 1/30 of R1's (each map is colored relative to its own maximum). The data audit before any modeling already spotted the bright square, noted that \u0026ldquo;the square alone gives val AUC 0.95\u0026rdquo;, and stated that this number was used for nothing. The shuffled-label check passed, and the log says plainly that this check only catches pipeline leakage, not a shortcut in the data itself. That difference is exactly what the demo is meant to show. After R1 first \u0026ldquo;met\u0026rdquo; the target, it did not stop: the shortcut-check figures showed the signal sat almost entirely on the marker, so the result did not count. After R3 met the target, it checked stability on 5 other CV splits (mean 0.814), then stopped without tuning further on val. Recap # Whether in the two original studies or this 18-minute demo, the same pieces are what let Claude Code keep going on its own:\nThe loop: experiment → verify → adjust → next round. Building the loop is easy; knowing when to stop is the hard part. So the stopping condition is a concrete number plus a cap on rounds, and if the target is not met, it reports the gap honestly instead of running forever. Rules go into files first. The target, the split and how val may be used go into CLAUDE.md; each round\u0026rsquo;s results go into EXPERIMENTS.md. Conversations get compacted and sessions end; only rules written into files survive that, and the next session can pick up from them. Verification: \u0026ldquo;the numbers check out\u0026rdquo; beats \u0026ldquo;it finished\u0026rdquo;. Shuffled labels to rule out leakage, AUC recomputed from prediction files, prediction counts checked, val looked at once per round. Only when results can be verified is it safe to let go. Shortcut checks: meeting the target is not success. A shuffled-label check catches pipeline leakage, not a shortcut in the data itself. In the demo, the first \u0026ldquo;success\u0026rdquo; came from the top-left marker; because the rules required checking where the signal lay, it did not stop there. Self-correcting iteration. Each round\u0026rsquo;s direction comes from the previous round\u0026rsquo;s checks: ablations show where the signal is, bugs get fixed, shortcuts are removed and the run repeated, and methods with no gain are logged and dropped. Claude is good at finding faults; this loop keeps it finding faults in its own work. People make the calls. The target and rules, when to freeze, when to run test: those stay with me. Claude expands and critiques within the rules. ","date":"22 November 2026","externalUrl":null,"permalink":"/posts/experiment-loop/","section":"Writing","summary":"Write the target and rules into files first, then let Claude Code run experiments, check its own numbers and choose the next round; one study started in plan mode, the other in auto mode.","title":"Iterating experiments with Claude Code until a target is met: a workflow log","type":"posts"},{"content":"This is a workflow log. It does not discuss what the ideation produced.\nRequirements and problem # Four requirements: open data, objective metrics for verification, clear novelty, and feasibility considered first.\nWhen an AI proposed topics directly, two situations recurred: similar work already existed, or a simpler approach was already sufficient. So instead of asking for topics, the process starts by designing a group of agents in which each of these two objections has a dedicated owner.\nStructure # Main session: talks to the user, calls agents, maintains the files ├─ agent that proposes ideas ├─ agents that challenge ideas (in parallel) ├─ agents that gather information └─ a separate session: small validation experiments The main session only discusses and coordinates; work that needs heavy reading or searching goes to agents.\nRoles # Role Task Model Idea generator From a seed or a gap, proposes up to 5 concrete ideas stronger Baseline skeptic Lists the simplest alternatives and judges whether they suffice stronger Novelty critic Looks for existing similar work, aiming to overturn the idea cheaper Feasibility reviewer Checks data, compute and schedule cheaper Reviewer simulator Used only for a topic about to be finalized cheaper Information gatherer Updates reference lists of trends, math tools and datasets cheaper The baseline skeptic turns the common objection \u0026ldquo;a simpler method would already be enough\u0026rdquo; into a role.\nPath of one idea # seed or gap → up to 5 ideas proposed → the user reads one-line versions and drops unwanted ones → the rest go to both critics (in parallel) → results return in one table → worth testing: design a small experiment that finishes within a day → near the end: feasibility check and reviewer simulation The critics are the most expensive step, so the user screens first and only the remainder is reviewed.\nCommunicating through files # Agents do not talk to each other directly; they read and write a shared set of files:\nCurrent status: progress, live candidates, next step. Overwritten each time, never accumulating history. Hard constraints and user preferences: preferences are distilled from the user\u0026rsquo;s responses, and every agent reads them before starting. A list of discarded ideas: one line of reason each, to avoid proposing them again. One review per idea and per role, with a few lines of summary at the top. Controlling context # Once the files exceeded 1.4 MB, the main session\u0026rsquo;s context became the bottleneck. The rules became:\nAt the start, read only the current status and the preference summary; look up the rest by search. Agents write details to files and reply in at most 8 lines. Reports are read through their opening summary only. This makes it possible to clear the conversation and continue: asking \u0026ldquo;where did we leave off\u0026rdquo; is answered from the status file.\nAdjustments along the way # After stating that critique-style topics are not wanted, a few admired papers were added as examples, so the generator could learn how they frame their contributions. The starting point changed from ideas to tasks: first map where models still fall clearly short of humans, then ideate from those gaps. A list of questions was prepared, such as \u0026ldquo;how does a human reach a judgment differently from a model\u0026rdquo;, to draw out the user\u0026rsquo;s own observations as seeds. Experiments moved to a separate session, each limited to a day, with the kill condition written before running. The critics\u0026rsquo; instructions gained a model tier and a context budget. Observations # The back-and-forth with the agents has value. Even when an idea raised in the moment is unusable, it often leads to other directions. The baseline skeptic has had the clearest effect. Being able to rule out unwanted directions step by step is itself helpful. Most ideas turned out to be unusable. The ideation stage has no clear stopping point, and when to stop remains unclear. Over about a week there were 13 ideation rounds and 10 small experiments.\n","date":"5 November 2026","externalUrl":null,"permalink":"/posts/multi-agent-ideation/","section":"Writing","summary":"One main session handles the conversation, several role agents propose and challenge ideas, and everything is written to files.","title":"Ideating a research topic with multiple agents: a workflow log","type":"posts"},{"content":"Open Steam on Linux, pick a game that only ever shipped for Windows, and press Play. A few seconds later the title screen appears and your controller just works. Nothing to see here.\nHave you ever stopped to think how remarkable that is? The game was never recompiled for Linux, and the computer never secretly booted Windows. So how is it running?\nOn Linux, the solution hides in a handful of names that always seem to show up together: Wine, Vulkan, DXVK and Proton. Let\u0026rsquo;s ride along with the game now, from launch to the first frame, and see where each name makes its entrance.\n\u0026gt;_ READING ROUTE\nFrom an .exe to a frame on the screen This article covers only the case where the CPU instruction set matches: an x86-64 game on an x86-64 computer. Running across instruction sets (on an ARM machine, say) needs yet another layer of instruction translation, and that is a story for another day.\nWe start with why a program depends on its operating system, then see how Wine fills in the Windows environment, take graphics and shaders apart, and finish with Proton and the Steam Deck. The diagram below is the map for the whole trip; come back to it if you get lost.\nThe same game.exe, with different layers underneath\nWindows Linux · Steam + Proton Game game.exe the same file, not recompiled System APIs kernel32.dll user32.dll …shipped with Windows kernel32.dll user32.dll …Wine\u0026#39;s reimplementations, same names Proton Graphics API d3d11.dllDirect3D 11 d3d11.dllDXVK: Direct3D outside, Vulkan inside GPU driver Windows driverAMD · NVIDIA · Intel Vulkan driverMesa RADV · NVIDIA … Kernel Windows NT Linux Hardware x86-64 CPU · GPU the same machine identical on bothstand-ins supplied by Proton\nA Direct3D 11 game. The game and its CPU instructions stay the same; the layers in between change. The game still loads files named kernel32.dll and d3d11.dll, but receives the Wine and DXVK versions. The CPU understands it. Why can\u0026rsquo;t the system run it? # Suppose you copy a Windows game\u0026rsquo;s game.exe straight onto a Linux machine. Both are x86-64, so the CPU understands the machine instructions inside. Does an addition stop being an addition, or a jump stop being a jump, just because the operating system changed?\nNo. And yet the game still won\u0026rsquo;t run directly, because a game is more than arithmetic. It has to be loaded into memory and find its libraries; then it opens files, creates windows, reads the controller and sends drawing work to the GPU. All of that relies on agreements between the program and its environment, and game.exe only ever signed those agreements with Windows.\nInside game.exe: which parts does the CPU understand?\n▤ game.exe PE32+ · x86-64 PE headersMZ … PE\\0\\0 entry point · section table · import directory ✕Needs a loader that reads PEThe Linux kernel loads ELF; it does not understand this format.\n.textmov eax, [rbx+8] add eax, 1 call [CreateFileW] ✓Runs directly on the CPUx86-64 is x86-64: arithmetic and jumps behave the same. But the call target is not in this file.\nImport tableKERNEL32.dll CreateFileW USER32.dll CreateWindowExW d3d11.dll D3D11CreateDevice ✕Needs these DLLs to existand to behave like Windows. The native Linux environment does not supply these Windows DLLs.\nSimplified; most sections are omitted. The call in .text reaches CreateFileW through the import table. The CPU can execute the call, but cannot conjure the code it jumps to. Agreement one: how a file becomes a running program # Windows .exe and .dll files use the PE (Portable Executable) format. A header at the start records the entry point, the sections, and which functions to import from which DLLs; the .text section holds machine code and .data holds initialised data. If you want every field, Microsoft\u0026rsquo;s PE specification has them.\nNative Linux programs use ELF. Run ./game.exe in a terminal and the Linux kernel, not recognising the format, will usually just reply Exec format error (unless your system is set up to open .exe files with Wine). Renaming the file won\u0026rsquo;t help: the contents themselves have a different structure.\nAgreement two: who provides system services # Picture a simple scenario. When a game loads a save, it does not touch the disk itself. It calls CreateFileW in kernel32.dll; to open a window, it calls CreateWindowExW in user32.dll. These Windows APIs spell out the rules in detail: how arguments are laid out, how strings are encoded, what comes back on success and which error code is set on failure.\nThe PE import table says, in effect, \u0026ldquo;I need CreateFileW from KERNEL32.dll.\u0026rdquo; Trouble is, the native Linux environment does not supply Windows’ kernel32.dll. And even if it did, Linux\u0026rsquo;s way of opening files (open, file descriptors, errno) and Windows\u0026rsquo; (drive letters, HANDLEs, GetLastError) are two different worlds.\nWhile we are here, it helps to separate an API call from a system call. Here, a Windows API is a function exported by a DLL; a system call is the step into the operating-system kernel. On Windows, CreateFileW passes through ntdll.dll and then into the NT kernel, while plenty of APIs, such as string handling, never touch the kernel at all. Most ordinary games request services through these DLLs. Wine provides compatible interfaces and the required kernel-service behaviour without booting an entire Windows kernel.\nBottom line: executing CPU instructions is only the starting line. What has to be supplied is the entire set of DLLs the game assumes will be there, down to their quirks.\nWine: familiar interfaces in a different environment # Wine began in 1993. Its name expands to Wine Is Not an Emulator. Notice anything? The first word of the expansion is Wine again, so you can keep expanding it forever, like a set of nesting dolls. A name that contains itself is a recursive acronym, a classic open-source joke: GNU stands for GNU’s Not Unix.\nThe name is more than a joke, though; it describes the approach. When CPU instruction sets differ, an additional emulator or instruction translator is needed. Emulators can also use dynamic compilation rather than interpreting each instruction. In the matching-instruction-set case discussed here, Wine usually needs no translation of ordinary CPU instructions, and the game\u0026rsquo;s machine code can run directly on the CPU. What Wine does instead is rewrite the Windows DLLs itself: its own kernel32.dll, user32.dll, ntdll.dll, gdi32.dll and so on, with exactly the same names and interfaces as Windows, implemented on top of Linux.\nEnough talk. Here is a simplified view of Wine handling one file open, there and back:\nTracing one CreateFileW: the game opens a save\ngame.exe CreateFileW(L\"C:\\\\Saves\\\\slot1.sav\", GENERIC_READ, …)The game believes it is on Windows: Windows path, Windows API.\nWinekernel32 → ntdll C:\\Saves\\slot1.sav → …/compatdata/\u0026lt;AppID\u0026gt;/pfx/drive_c/saves/slot1.savMap the drive letter to this game\u0026#39;s own folder. Windows paths ignore case and Linux paths do not, so Saves must match the saves that actually exists.\nwineserver→ Linux kernel openat(…, \"…/drive_c/saves/slot1.sav\", O_RDONLY) = 23wineserver performs the actual open and gets file descriptor 23 from Linux.\nWinewineserver fd 23 ↔ HANDLE 0x1a4Windows programs expect a HANDLE, not an fd. In the same step wineserver allocates a HANDLE that refers to the file, used by later ReadFile and CloseHandle calls.\ngame.exe hFile = 0x1a4The game receives what looks like an ordinary Windows HANDLE.\nPaths follow a Steam Proton prefix; numbers and system calls are conceptual, not an actual trace. The real path also translates access rights, sharing modes and errors: a missing file must come back as Windows\u0026#39; ERROR_FILE_NOT_FOUND, not Linux\u0026#39;s ENOENT. One innocent-looking CreateFileW, and Wine already has to deal with drive letters, case sensitivity, mapping file descriptors to HANDLEs, and translating error codes. File objects, sharing modes and other state requiring coordination are managed with the help of wineserver, which plays part of the role of the Windows kernel\u0026rsquo;s object manager.\nNow multiply that by tens of thousands of Windows API functions. Wine has been at it since 1993 and still isn\u0026rsquo;t done. Worse, programs rely on undocumented behaviour, quirks of particular Windows versions, and sometimes Windows\u0026rsquo; own bugs (a mountain of technical debt, you might say), all of which Wine has to faithfully reproduce. It may be one of the most patient projects in software.\nGames speak another language: graphics APIs # Great, the window is open. Unfortunately it is also black.\nA game engine talks to the GPU through a graphics API: it uploads meshes and textures, sets rendering state, and asks for batches of triangles. Most Windows games speak Direct3D, the 3D part of DirectX, while Linux 3D graphics stacks commonly expose OpenGL and Vulkan.\nSo on top of the system APIs, the graphics API needs an interpreter too: the game speaks Direct3D, and the compatibility layer has to turn that into something OpenGL or Vulkan understands.\nWineD3D: a route through OpenGL # Wine has long had its own interpreter, WineD3D, which implements Direct3D on OpenGL. Many older games first ran on Linux thanks to it, and it is still around: in Proton\u0026rsquo;s settings, PROTON_USE_WINED3D=1 switches back to it for Direct3D 9 to 11.\nThe trouble is that the two APIs think differently. The resource management, state objects and multithreading of Direct3D 10 and 11 have no direct equivalent in OpenGL, so WineD3D has to improvise, and shaders must first be turned into GLSL text that the driver then compiles from scratch. When features are hard to map efficiently, the result can be dropped frames or broken rendering. Outcomes still depend on the game, driver and WineD3D version, rather than simply the age of the game.\nVulkan: making GPU work explicit # Then came Vulkan. Khronos revealed it in 2015 and released Vulkan 1.0 on 16 February 2016. Compared with OpenGL, Vulkan hands back to the application many decisions the driver used to make quietly behind the scenes: how memory is allocated, when commands are submitted, how resources are synchronised.\nFor a compatibility layer, this was huge. All the bookkeeping a Direct3D 11 driver used to do in the background could now be done by the layer itself, on Vulkan, following Direct3D\u0026rsquo;s rules instead of wrestling with OpenGL\u0026rsquo;s assumptions. Vulkan still knows nothing about Direct3D, so an interpreter is still needed, but now it has much better tools.\nShaders: graphics calls are only part of the job # Even with every Direct3D call translated to Vulkan, we are only halfway there. Draw calls tell the GPU what to draw; shaders tell it how to compute each vertex and each pixel.\nSay a game draws a wall lit by a torch. The mesh and textures are just data, but \u0026ldquo;where does this vertex land on screen\u0026rdquo; and \u0026ldquo;what colour is this pixel in the firelight\u0026rdquo; are small programs running on the GPU: shaders. A game can contain thousands of them, and Direct3D games commonly ship compiled results from the Direct3D toolchain.\nSo shaders need translating as well. The diagram below follows a single shader from the moment it is written to the moment it runs on the GPU, and counts the formats it passes through:\nThe formats one shader passes through\nDeveloper\u0026#39;s machine Shipped Player\u0026#39;s machine HLSL developer source, usually not shipped ↓ compiled by fxc / dxc DXBC / DXIL bytecode in the game files ↓ translated by DXVK / vkd3d-proton SPIR-V intermediate format for this Vulkan path ↓ compiled by the driver GPU code compiled for the target GPU and driver DXC shortcut · needs source A common path for games shipping precompiled shaders. Without HLSL source, the shortcut is unavailable: the layer starts from DXBC/DXIL, translates to SPIR-V and hands it to the driver. Older D3D8/9 also have other shader formats and fixed-function paths. From HLSL to the bytecode inside a game # For newer programmable shader paths, Windows game shaders are usually written in HLSL and compiled on the developer\u0026rsquo;s machine with fxc or dxc. What ships with the game is compiled bytecode: DXBC from the older toolchain, DXIL from the newer Direct3D 12 one. In other words, players commonly receive bytecode; the compatibility layer cannot assume the HLSL source is also supplied.\nThis is the biggest difference between a compatibility layer and a port. A developer porting their own game can consider recompiling HLSL with tools for the target platform, adjusting the code where necessary. Proton faces a released game that may not have been touched in years. For games that ship only precompiled shaders, it must work from that bytecode. It is a bit like translating a printed book into another language when the author\u0026rsquo;s manuscript is long gone.\n(Strictly, DXBC is also the name of a container format, and DXIL is stored inside it; see LLVM\u0026rsquo;s notes. So \u0026ldquo;D3D12 means DXIL\u0026rdquo; is not exact: some Direct3D 12 games still use DXBC.)\nWhy does Vulkan need SPIR-V? # In the common translation path discussed here, Vulkan receives SPIR-V, rather than DXBC or GLSL source. SPIR-V is a shader intermediate representation defined by Khronos: lower level than source code, but not yet tied to a particular GPU. The driver compiles SPIR-V into its own GPU\u0026rsquo;s machine code.\nThe compatibility layer\u0026rsquo;s job is therefore the highlighted arrow in the diagram: DXBC/DXIL → SPIR-V. Both sides are structured bytecode, so this avoids the extra step of emitting GLSL source for the driver to parse again. Types, resource binding and edge-case behaviour still differ, though, so it is not a dictionary lookup.\nShader and graphics-pipeline compilation are important sources of shader stutter: if compilation remains on the critical path when a frame is needed, that frame can arrive late. Caching and precompilation reduce these stalls but cannot guarantee stutter-free play. Steam’s Shader Pre-Caching uses collected shader and pipeline data to reduce runtime compilation. Fossilize records and replays Vulkan objects so the driver can build a local cache in advance. This is not simply a download of GPU machine code that works unchanged on every system.\nAn open compiler and translation for existing games # You might be wondering: if there is a tool that compiles HLSL straight to SPIR-V, why not use it? There is one. Microsoft open-sourced the DirectX Shader Compiler (DXC) in 2017. Built on LLVM and Clang, it compiled HLSL to DXIL, and the community later added SPIR-V output. For developers who have the source, DXC is the dashed shortcut in the diagram.\nBut that DXC compilation path needs source code, which players usually do not have. The road that starts from bytecode still has to be travelled by the translators built into DXVK and vkd3d-proton.\nDXVK and vkd3d-proton: connecting graphics to Vulkan # With the targets in place (Vulkan and SPIR-V), it is finally time to meet the two projects that do the actual translating.\nDXVK, written by Philip Rebohle, provides d3d9.dll, d3d10core.dll, d3d11.dll, dxgi.dll and related files (plus d3d8.dll since version 2.4). Internally it implements Direct3D 8 to 11 on Vulkan, complete with its own compiler that turns DXBC (and D3D9-era shader bytecode) into SPIR-V. In Proton, D3D8 generally uses Wine’s implementation by default. PROTON_DXVK_D3D8=1 enables DXVK; version and compatibility settings also affect the choice. vkd3d-proton, a fork of Wine\u0026rsquo;s vkd3d, focuses on Direct3D 12 and turns both DXBC and DXIL into SPIR-V.\nThe DLL a game loads decides the route\nDirect3D 9 – 11 Direct3D 12 Fallback · D3D 9 – 11 Game loads d3d11.dllalso d3d9, dxgi … d3d12.dll\u0026nbsp; d3d11.dllopt-in only Handled by DXVK vkd3d-proton WineD3D Into Vulkan Vulkan OpenGL Linux graphics driver (Mesa, NVIDIA …) → GPU Proton places the DXVK and vkd3d-proton DLLs in the game\u0026#39;s Wine prefix. The game loads d3d11.dll as usual and actually gets DXVK. The route follows the API the game uses; a D3D11 game cannot be sent through vkd3d-proton. The neat part is that the game has no idea it has been swapped. It loads d3d11.dll as usual, calls D3D11CreateDevice, and gets objects that dutifully follow Direct3D 11\u0026rsquo;s rules, while every call underneath is quietly arranging Vulkan work. It is the same trick Wine plays with kernel32.dll, applied to the graphics layer. The DXVK and vkd3d-proton READMEs describe what each one currently supports.\nThe graphics components only handle the picture, of course. Files, windows, input and threads are still Wine\u0026rsquo;s job, and while the game runs the two kinds of calls interleave constantly.\nProton: bringing many projects into one Play button # Wine and later graphics compatibility projects made many Windows games playable on Linux. Before Proton came along, using Wine and the graphics components available at the time often meant a small adventure: install Wine yourself, create a prefix, drop the right DXVK version into it, dig through forums for the mysterious environment variables a particular game needed, and then start over when Wine updated.\nProton folds that whole adventure into a single Steam button. On 21 August 2018 Valve announced a new version of Steam Play that runs Windows games on Linux through Proton. The announcement also mentioned that Valve had brought on the DXVK developer to work on open-source graphics.\nWhat Steam assembles when you press Play\n▶ Steam · Play ↓ Steam Linux Runtime a consistent user-space library base Proton each release bundles and tests these together WineWindows APIs, files, windows, threads DXVKDirect3D 9 – 11 → Vulkan vkd3d-protonDirect3D 12 → Vulkan Mediavideo playback through GStreamer Per-game settingsdefaults for known problems Wine prefix compatdata/\u0026lt;AppID\u0026gt;/pfx Each game gets a separate C: drive and registry configuration to reduce interference. Some user directories may still map to the host.\n↓ game.exe starts Simplified. The player sees only the button at the top. Steam picks a Proton version for the game, creates the prefix, and starts the game inside the container. Proton itself is a fork of Wine, bundled with DXVK, vkd3d-proton and media components, with each release tested as a whole. Steam creates a separate prefix for every game, reducing the chance that game A’s settings interfere with game B. Newer Proton versions also run inside the Steam Linux Runtime container: this provides a more consistent user-space library base across distributions and makes problems easier to reproduce. GPU drivers and the kernel still depend on the host. The Steam Runtime documentation explains the environment.\nNone of this is Valve\u0026rsquo;s work alone. The Wine community has thirty years of implementation behind it; CodeWeavers develops Proton jointly with Valve, with Valve\u0026rsquo;s funding; and the developers of DXVK, vkd3d-proton and Mesa\u0026rsquo;s drivers hold down the graphics end.\nThe Steam Deck puts the stack in a handheld # The Steam Deck, released in February 2022, runs Linux. Its SteamOS 3 is based on Arch Linux; SteamOS 1 and 2 were based on Debian. The full configuration is in the Steam Deck\u0026rsquo;s specifications.\nThe Deck brought Proton into a handheld for mainstream players, who could use it every day without needing to know its name. Plenty of people may have owned a Deck for months without realising they were running Linux. Valve added \u0026ldquo;Deck Verified\u0026rdquo; ratings, testing games one by one on the Deck and turning compatibility problems into something developers could see and were willing to fix. To check whether a game you want to play works with Proton on Linux, look it up on ProtonDB, where a large number of players report how their games run.\nProton isn\u0026rsquo;t Deck-exclusive, of course; Steam on any Linux desktop can use it. What makes the Deck special is that hardware, drivers, operating system and Proton can be tuned together, against a small, relatively fixed set of hardware configurations. LCD and OLED models still have hardware differences.\nFrom Wine to the Steam Deck: where the paths meet # Looking back, this is really a story of three tracks: Wine handles the Windows environment, the graphics projects handle drawing and shaders, and Valve integrates components, drivers and the playing experience. They started in different places and ended up meeting at the same one.\nThree tracks meeting at the Steam Deck\nWindows environment Graphics and shaders Steam integration 1993Wine development begins 2008Wine 1.0 released 2016Vulkan 1.0 (uses SPIR-V) 2018DXVK runs D3D11 games on Vulkan 2018Steam Play adds Proton 2020vkd3d-proton handles D3D12 2022Steam Deck launches Only milestones relevant to this article. Wine and WineD3D supported many games before Vulkan. Vulkan later provided another graphics translation target. Valve integrated Proton in 2018, with vkd3d-proton improving D3D12 support in later releases. Why do some games still fail? # By now you can probably guess: a compatibility layer has to reproduce everything a game actually depends on, not just graphics. The usual sticking points:\nAnti-cheat: Easy Anti-Cheat and BattlEye have supported Proton since 2021, but each game\u0026rsquo;s developer has to flip that switch. Anti-cheat that relies on a Windows kernel driver (scanning memory from inside the kernel) needs a Windows kernel to load its driver into, and there is no Windows kernel underneath Wine, so those solutions are currently unsupported by Proton and need a compatible approach from their vendors. Valve\u0026rsquo;s Proton developer documentation lists these considerations. Launchers and video: a bundled login launcher, DRM, or cutscenes in an obscure codec can knock a game out before it reaches the main menu. GPU and driver: DXVK and vkd3d-proton require specific Vulkan features. Older cards or drivers that lack them cause trouble, especially for Direct3D 12 games. Updates and regressions: an update to the game, its launcher, the driver or Proton can break a combination that worked perfectly yesterday. Performance has to be judged game by game too. Translation costs some CPU time, and shader or pipeline compilation can cause stutter; yet in some benchmarks, on some hardware, games running through Proton have even beaten Windows. \u0026ldquo;An extra layer\u0026rdquo; does not mean \u0026ldquo;a fixed percentage slower\u0026rdquo;.\nThe next time you press Play # Back to that one press, using our Direct3D 11 example. Steam picks a Proton version, prepares the prefix and launches game.exe. The CPU runs the game\u0026rsquo;s instructions directly; the kernel32.dll the game calls was written by Wine; its d3d11.dll is really DXVK, turning draw commands into Vulkan and shaders into SPIR-V; and the Vulkan driver compiles them and sends them to the GPU. When things go smoothly, the title screen lights up after a few seconds. The compatibility components continue working throughout the game.\nAnd just like that, a game with no Linux release stays in your library, instead of being given up because you switched operating systems.\nSo next time you press Play on Linux, spare a thought for what is behind that button: Wine, filled in one API at a time since 1993; Vulkan, which finally gave the interpreters decent tools; DXVK and vkd3d-proton, chasing down one game after another; and Valve, which assembled it all into a single button.\nIf you enjoyed this article, I highly recommend watching SteamDeck 搭载 Linux，凭什么可以玩 Win 游戏？, a Chinese-language video by Redknot-乔红. Watching it is what made me want to write up the technology behind Proton. Technical details and dates were checked against the project documents and original announcements linked throughout; the diagrams are conceptual and leave out some components and calls.\n","date":"28 October 2026","externalUrl":null,"permalink":"/posts/proton/","section":"Writing","summary":"The CPU understands the instructions. Why does the game still need a compatibility layer? Follow Wine, Vulkan and Proton all the way to the Steam Deck.","title":"After you press Play: how Windows games run on Linux","type":"posts"},{"content":" \u0026gt;_ BEFORE YOU READ\nWhat question does this article answer? Core question: How can circles that only spin at constant speeds trace an outline as irregular as a raven?\nUseful background: Points in the plane written as complex numbers, and eiθ=cos⁡θ+isin⁡θe^{i\\theta} = \\cos\\theta + i\\sin\\thetaeiθ=cosθ+isinθ. The rest is built up step by step.\nReading route: Play with the figure first. Then follow one rotating arrow, a sum of arrows, how their sizes are found, and how many are worth keeping.\nWhen the homepage loads, a pen at the end of a chain of spinning circles draws the raven\u0026rsquo;s outline before the ASCII portrait appears. That animation is a Fourier series: a closed curve written as a sum of rotations. The figure below uses the same coefficients as the homepage. Change the number of circles and watch the outline sharpen.\n.:=\u0026#43;\u0026#43;\u0026#43;\u0026#43;\u0026#43;\u0026#43;*%@@@%#\u0026#43;: .\u0026#43;#%@@@@@@@@@@@@@@@*: .-\u0026#43;%@@@@@@@@@@@@- .#@@@@@@@@@@@@. -*#%@@@@@@@@@\u0026#43; -#%@@@@@@@@@@@@# .\u0026#43;%@@@@@@@@@@@@@@@@. :*@@@@@@@@@@@@@@@@@@@\u0026#43; .*@@@@@@@@@@@@@@@@@@@@@% .\u0026#43;@@@@@@@@@@@@@@@@@@@@@@@% .\u0026#43;%@@@@@@@@@@@@@@@@@@@@@@@@\u0026#43; .\u0026#43;%@@@@@@@@@@@@@@@@@@@@@@@@@# .=%@@@@@@@@@@@@@@@@@@@@@@@@@%= =%@@@@@@@@@@@@@@@@@@@@@@@@@#=. -%@@@@@@@@@@@@@@@@@@@@@@@@*=: -**%@@@@@@@@@@@@@@@@@@@@@@= :*@@@@@@@@@@@@@@@@%*=*@@% .*@@@@@@@@@@@@@@@%%@# .*@@: =@@@@@@@@@%@@@%*=: .-##: .\u0026#43;%\u0026#43;. -%@@@@@@@@**@%*-. =#*: .\u0026#43;#=. .*@@@@@@@%\u0026#43;::=: =%@#*=-#@%*\u0026#43;==-. -%@@@@@%*-. . ........:...:. %@@%#\u0026#43;-. 8 circles RMS — Energy — Ⅱ Pause Show circles Number of circles 12383296320 Spectrum: |cₙ| sorted from largest (log scale)\nThe dashed outline is the reference curve made from all 320 terms. The solid line uses only the largest K. RMS is the root-mean-square distance between the two curves as a share of the raven\u0026rsquo;s height. The bars below show every term\u0026rsquo;s size; highlighted bars are in use. A closed curve is a function of time # Imagine tracing the raven\u0026rsquo;s outline once at a steady pace, taking one unit of time for the whole loop. At each time ttt the pen has a position (x(t),y(t))(x(t), y(t))(x(t),y(t)). Writing that position as a single complex number turns the drawing into one function:\nz(t)=x(t)+i y(t),0≤t\u0026lt;1.z(t) = x(t) + i\\,y(t), \\qquad 0 \\le t \u0026lt; 1.z(t)=x(t)+iy(t),0≤t\u0026lt;1.Because the outline is closed, the pen returns to its starting point: z(t+1)=z(t)z(t+1) = z(t)z(t+1)=z(t). The curve is a periodic function, and periodic functions are what Fourier series describe.\nOne rotating arrow # The simplest periodic motion in the complex plane is\nc e2πint.c\\,e^{2\\pi i n t}.ce2πint.Here ccc is a complex number and nnn is an integer. As ttt runs from 0 to 1, this point moves around a circle:\nits radius is ∣c∣|c|∣c∣; its starting angle is the angle of ccc; it completes nnn full turns; positive and negative nnn rotate in opposite directions; with n=0n = 0n=0 it does not move. That term fixes the drawing\u0026rsquo;s centre. Set the figure to 1 circle: the pen moves around a single circle. It is the raven\u0026rsquo;s largest term, with n=1n = 1n=1, and sets the overall size of the loop.\nArrows placed tip to tail # One arrow can only draw a circle. To draw something more complex, connect several arrows: the second starts at the tip of the first, the third at the tip of the second, and so on.\nIn the complex plane, placing arrows tip to tail is simply addition: adding two complex numbers joins the arrows that represent them. So the end of the chain is the sum of all the arrows:\nz(t)=c0+c1e2πit+c−1e−2πit+c2e4πit+c−2e−4πit+⋯=∑ncn e2πint.\\begin{aligned} z(t) \u0026amp;= c_0 + c_1 e^{2\\pi i t} + c_{-1} e^{-2\\pi i t} \\\\ \u0026amp;\\quad + c_2 e^{4\\pi i t} + c_{-2} e^{-4\\pi i t} + \\cdots \\\\ \u0026amp;= \\sum_{n} c_n\\, e^{2\\pi i n t}. \\end{aligned}z(t)​=c0​+c1​e2πit+c−1​e−2πit+c2​e4πit+c−2​e−4πit+⋯=n∑​cn​e2πint.​Each arrow still turns at its own constant speed, but joined together, their end traces a path far more complex than any single circle. This sum is the curve\u0026rsquo;s Fourier series. Each cnc_ncn​ sets the size and starting angle of one circle.\nStart with the simplest pair: add the second-largest term, n=−1n = -1n=−1, to n=1n = 1n=1. It turns as fast as the first arrow, but in the opposite direction. While the large arrow makes one turn, the small arrow on its tip makes one turn the other way, stretching the pen\u0026rsquo;s path into an ellipse:\nn = 1 n = −1 their sum The large arrow (n=1n = 1n=1) turns once while the small arrow (n=−1n = -1n=−1) turns once the other way. The pen traces the same ellipse as \u0026ldquo;2 circles\u0026rdquo; in the interactive figure. Then keep adding terms in the interactive figure above:\n3 circles: adding n=−2n = -2n=−2 starts to bend the loop. After that: keep adding circles and watch when the beak, wing and tail appear. Finding the size of each circle # Now reverse the question: given the raven\u0026rsquo;s outline z(t)z(t)z(t), how do we find each cnc_ncn​?\nThe key is a simple fact: an arrow that makes a whole number of turns averages to zero over one loop. It spends equal time pointing in every direction, and those directions cancel:\n∫01e2πimt dt=0,m≠0.\\int_0^1 e^{2\\pi i m t}\\, dt = 0, \\qquad m \\ne 0.∫01​e2πimtdt=0,m=0.Suppose we want c3c_3c3​. Multiplying the whole curve by e−2πi⋅3te^{-2\\pi i \\cdot 3t}e−2πi⋅3t makes every arrow turn three extra times in the opposite direction:\nthe n=3n = 3n=3 arrow\u0026rsquo;s rotation is cancelled exactly, leaving c3c_3c3​ standing still; every other arrow now makes n−3n - 3n−3 turns, still a non-zero whole number. Averaging over one loop, every arrow that still turns averages to zero, and only the motionless c3c_3c3​ remains. The same works for any nnn:\ncn=∫01z(t) e−2πint dt.c_n = \\int_0^1 z(t)\\, e^{-2\\pi i n t}\\, dt.cn​=∫01​z(t)e−2πintdt.In practice a computer has samples, not a continuous curve. The homepage outline was traced from the ASCII raven itself and sampled at N=2048N = 2048N=2048 points z0,z1,…,zN−1z_0, z_1, \\dots, z_{N-1}z0​,z1​,…,zN−1​ around the loop, the kkk-th point at time t=k/Nt = k/Nt=k/N. Replacing \u0026ldquo;the average over one loop\u0026rdquo; with \u0026ldquo;the average of these 2,048 points\u0026rdquo; turns the integral into a sum:\ncn=1N∑k=0N−1zk e−2πink/N.c_n = \\frac{1}{N} \\sum_{k=0}^{N-1} z_k\\, e^{-2\\pi i n k / N}.cn​=N1​k=0∑N−1​zk​e−2πink/N.This is the discrete Fourier transform (DFT). 2,048 points give 2,048 coefficients, and the fast Fourier transform (FFT) computes them all efficiently. This was done once, when the animation was made; your browser only reads the results.\nWhich circles to keep # Of the 2,048 possible terms, the homepage keeps 320. The choice is simple: sort by radius ∣cn∣|c_n|∣cn​∣ and keep the largest. The figure\u0026rsquo;s spectrum shows the same ordering.\nThe reason comes from Parseval\u0026rsquo;s theorem. If zKz_KzK​ keeps only some of the terms, the average squared distance between the two curves equals the total squared size of the terms that were dropped:\n∫01∣z(t)−zK(t)∣2 dt=∑n dropped∣cn∣2.\\int_0^1 \\bigl|z(t) - z_K(t)\\bigr|^2\\, dt = \\sum_{n \\text{ dropped}} |c_n|^2.∫01​​z(t)−zK​(t)​2dt=n dropped∑​∣cn​∣2.Every dropped term adds its own ∣cn∣2|c_n|^2∣cn​∣2 to the error, and the terms do not interfere with each other. So for a fixed number of circles, keeping the largest ones gives the smallest average squared error. The figure\u0026rsquo;s RMS and energy readouts are computed directly from this identity.\nCompared with the 320-term curve:\nCircles Energy kept RMS gap (share of height) 1 86.62% 15.4% 2 91.56% 12.3% 3 95.69% 8.8% 8 99.15% 3.9% 32 99.98% 0.58% 96 \u0026gt; 99.99% 0.16% Energy here means ∑∣cn∣2\\sum |c_n|^2∑∣cn​∣2 over the rotating terms. The first eight circles already hold more than 99% of it. The remaining 1% is what separates a blob from a raven.\nWhat the circles find hard # Smooth, gently curving stretches are cheap: low frequencies describe them well. Sharp corners such as the tip of the beak, the claws and the tail are expensive. A corner changes direction suddenly, and only fast-turning arrows can follow that. With few circles every corner is rounded off; more circles make the corners sharper.\nThat is why the spectrum has a long, slowly shrinking tail. Among the 32 largest terms, the fastest turns 25 times per loop. Among the 96 largest, it turns 68 times. Further down the list, some kept terms turn up to 1,023 times per loop, the highest frequency 2,048 samples can represent. Every term faster than 200 turns, however, has a radius under 0.004% of the raven\u0026rsquo;s height. They hardly change the picture.\nFrom the formula to the homepage # The same mathematics shaped some engineering choices:\nThe homepage does not compute the series. A short script, generate_raven_path.py, adds up all 320 terms in advance and stores every point of the 2,048-sample loop as a 16-bit integer pair. The browser only decodes them. The homepage draws at most 96 circles. Circles with a radius under 0.2 pixels cannot be seen. The outline still uses all 320 terms, so skipping tiny circles only simplifies the illustration. This page computes the curve in your browser because you choose the number of circles. Recomputing 2,048 points from up to 320 terms takes no more than a few hundredths of a second. How this website is built describes the site around these pieces.\nCircles on circles # Drawing with circles on circles is an old idea. Ancient astronomers described planetary motion with epicycles: a small circle whose centre moves around a larger one. A Fourier series is the same construction with as many circles as needed. Given enough of them, it can follow almost any closed path. That flexibility explains both why epicycles could match observations well and why a good fit alone does not show that a model explains the motion.\nThe raven on the homepage is not a planet, but the principle is the same: 320 circles, each turning at its own constant speed, are enough to draw it.\n","date":"22 October 2026","externalUrl":null,"permalink":"/posts/fourier-raven/","section":"Writing","summary":"A Fourier series explained through the homepage raven: rotating arrows, the discrete Fourier transform, and why keeping the largest circles works.","title":"Drawing a raven with circles","type":"posts"},{"content":"The guitar neck is a grid. Each fret raises a string by one semitone, and neighbouring strings are a perfect fourth apart (five semitones), except G to B, which is a major third (four). Once you see that grid, a scale stops being a list of note names and becomes a pattern you can move.\nScales on the fretboard # Choose a root and a scale. Notes shows note names; Degrees shows each note\u0026rsquo;s role in the scale: 1 is the root, ♭3 a minor third above it, 5 a perfect fifth. Tap a position to hear it, or play the scale up and back down an octave.\nRoot Scale Notes Degrees Tone AcousticElectric (clean) ▶ Play scale A minor pentatonic A C D E G 1 ♭3 4 5 ♭7\n0357912 E F F♯ G G♯ A A♯ B C C♯ D D♯ E B C C♯ D D♯ E F F♯ G G♯ A A♯ B G G♯ A A♯ B C C♯ D D♯ E F F♯ G D D♯ E F F♯ G G♯ A A♯ B C C♯ D A A♯ B C C♯ D D♯ E F F♯ G G♯ A E F F♯ G G♯ A A♯ B C C♯ D D♯ E Squares are roots. Tap any position to hear it; scroll sideways for the whole neck. With a keyboard, Tab into the neck, move with the arrow keys and press Enter to play.\nA few things to try:\nMove the root. Change A to C and the whole pattern slides three frets up the neck. The shape stays the same; only its position changes. Find the box. A minor pentatonic between frets 5 and 8 is the shape most guitarists learn first: two notes on every string. Compare major and natural minor. Switch to Degrees and change only the scale: the 3rd, 6th and 7th drop by a semitone, everything else stays. Hear the blues note. The blues scale is minor pentatonic plus one note, the ♭5, which sits between 4 and 5. Hearing intervals # An interval is the distance between two notes, counted in semitones. On one string that is simply the number of frets between them: five frets up is a perfect fourth, seven a perfect fifth, twelve an octave.\nInterval Semitones Interval Semitones Minor 2nd (m2) 1 Tritone (TT) 6 Major 2nd (M2) 2 Perfect 5th (P5) 7 Minor 3rd (m3) 3 Minor 6th (m6) 8 Major 3rd (M3) 4 Major 6th (M6) 9 Perfect 4th (P4) 5 Minor 7th (m7) 10 Major 7th (M7) 11 Octave (P8) 12 Press New interval, listen, and choose what you heard. After you answer, the neck shows both notes: the lower one filled, the upper one outlined, and the closest fingering of the pair highlighted.\nIntervals Starter: m3 M3 P4 P5 P8 More: add M2 M6 m7 All 12 Play Rising (low → high) Falling (high → low) Together Mixed Tone AcousticElectric (clean) ▶ New interval ↻ Replay Press New interval, listen to the two notes, then choose what you heard.\n0357912 E F F♯ G G♯ A A♯ B C C♯ D D♯ E B C C♯ D D♯ E F F♯ G G♯ A A♯ B G G♯ A A♯ B C C♯ D D♯ E F F♯ G D D♯ E F F♯ G G♯ A A♯ B C C♯ D A A♯ B C C♯ D D♯ E F F♯ G G♯ A E F F♯ G G♯ A A♯ B C C♯ D D♯ E 0 / 0 · streak 0\nReset Accuracy by interval (kept in this browser only) Guitar samples: nbrosowsky / Iowa / Karoryfer · CC BY 3.0\nThe ear trainer needs JavaScript to play sound.\nStart with the Starter set and rising intervals. Hum the two notes back before answering: if you can sing it, you have heard it. Then try falling intervals, which most people find harder, and finally both notes together. Your accuracy for each interval is kept only in this browser, so you can see which ones need work.\n","date":"22 October 2026","externalUrl":null,"permalink":"/posts/fretboard-and-intervals/","section":"Writing","summary":"An interactive fretboard for scales and degrees, with an interval ear trainer that shows each answer on the neck.","title":"Fretboard scales and interval ear training","type":"posts"},{"content":"","date":"15 October 2026","externalUrl":null,"permalink":"/posts/electric-guitar/","section":"Writing","summary":"An interactive guide to electric guitar parts, hardware, pickups, and internal mechanisms.","title":"Anatomy of an electric guitar","type":"posts"},{"content":" Guitar notation format STANDARD TUNING E · A · D · G · B · e\nNew here? Start practising in five steps Tune first: press Tuner above, then tap a string for its reference tone or let the microphone listen. Learn the shapes: tap a card to hear it, then fret it and strum to compare. Squares mark the root. Start with Em → Am → C → G → D. Stuck on barres: F, Bm and Fm cards switch to an Easy voicing; the 1–6–4–5 and royal road loops use Fmaj7 instead of F. Practise changes: press ▶ Play on a progression; pick another Key and it works out the capo and shapes. Lower the BPM and tick Loop. Tick Click only to strum yourself. Hands on the guitar: after the first play, Space (or a page-turner pedal set to Space) stops and restarts. The screen stays awake while playing. Chord diagramsChords TablatureTAB Staff notationStaff ToneAcousticElectric (clean) Tuner Practice BPM−+ Strum Quarter notes　↓ ↓ ↓ ↓One strum per bar　↓ – – –Folk pattern　↓ ↓↑ ↑↓↑Eighth notes　↓↑↓↑↓↑↓↑ Loop Count-in Click only Tap a chord ↓ Hear the selected guitar tone\nLeft → right: low → high strings · ○ Open · × Mute · 1–4 Fingers (index → little) · Bar = barre · Square = root Top → bottom: high → low strings · Numbers = frets · 0 Open · × Mute · Aligned notes sound together Octave treble clef · One beat per chord · Same voicings Basic chordsSong progressionsAdvanced chordsYour progression BasicCDEGAAmDmEmFmaj7Cadd9G/BEm7AdvancedFBmFmB7Cmaj7G7D7A7E7Am7Dsus2Asus4Dsus4C7E5A5F#mBC#mG#m 01 Basic chords C × 3 2 0 1 0 EADGBe 1 eBGDAE 0 1 0 2 3 × 𝄞8 ♪ D × × 0 1 3 2 EADGBe 1 eBGDAE 2 3 2 0 × × 𝄞8 ♯ ♪ E 0 2 3 1 0 0 EADGBe 1 eBGDAE 0 0 1 2 2 0 𝄞8 ♯ ♪ G 2 1 0 0 0 3 EADGBe 1 eBGDAE 3 0 0 0 2 3 𝄞8 ♪ A × 0 1 2 3 0 EADGBe 1 eBGDAE 0 2 2 2 0 × 𝄞8 ♯ ♪ Am × 0 2 3 1 0 EADGBe 1 eBGDAE 0 1 2 2 0 × 𝄞8 ♪ Dm × × 0 2 3 1 EADGBe 1 eBGDAE 1 3 2 0 × × 𝄞8 ♪ Em 0 2 3 0 0 0 EADGBe 1 eBGDAE 0 0 0 2 2 0 𝄞8 ♪ Fmaj7 × × 3 2 1 0 EADGBe 1 eBGDAE 0 1 2 3 × × 𝄞8 ♪ Cadd9 × 2 1 0 3 4 EADGBe 1 eBGDAE 3 3 0 2 3 × 𝄞8 ♪ G/B × 1 0 0 0 3 EADGBe 1 eBGDAE 3 0 0 0 2 × 𝄞8 ♪ Em7 0 1 2 0 3 0 EADGBe 1 eBGDAE 0 3 0 2 2 0 𝄞8 ♪ maj · m · 7 · sus · add9 · /: chord symbols at a glance 1 = root; intervals refer to its major scale. ♭ = one semitone lower. The feel depends on rhythm, arrangement and context.\nSymbolIntervalsDifference / feel maj C1 · 3 · 5Major triad; 3 is four semitones above the root. Often bright. C usually omits “maj”. m Am1 · ♭3 · 5Lower the third by one semitone (three above the root). Often darker. 7 G71 · 3 · 5 · ♭7Major triad plus minor seventh (10 semitones). Tension, often resolving home; also a blues sound. maj7 Cmaj71 · 3 · 5 · 7Add a major seventh (11 semitones), one semitone higher than ♭7. Often mellow or dreamy. m7 Am71 · ♭3 · 5 · ♭7Minor triad plus minor seventh. Often mellow and understated. sus2 Dsus21 · 2 · 5Replace the third with a second (two semitones). No major/minor third; often open or floating. sus4 Asus41 · 4 · 5Replace the third with a fourth (five semitones). Often suspended; 4 can resolve to 3. “sus” usually means sus4. add9 Cadd91 · 3 · 5 · 9Keep the third and add a ninth (the 2 an octave up). Unlike sus2 it keeps its major/minor colour; common in pop. 5 E51 · 5Power chord: root and fifth, no third. Stays clear under distortion; a rock staple. / G/BChord / bassChord over a bass note: G/B is G with B lowest. It lets the bass step, as in the Canon’s C → G/B → Am. Remember: 7 ≠ maj7. sus replaces the third; keeping it and adding 2 or 4 gives add2 / add4. Uppercase Roman numerals mean major, lowercase mean minor; progression degrees refer to the key’s tonic.\nFender: sus · Berklee: chords\nCommon song progressions 4/4 · One bar / four beats per cell · Read left to right · Set tempo, strum and looping under Practice above Pop four-chord loop G Key Show chord diagramsHide chord diagrams · Pop four-chord loop ▶ Play GI↓ ↓ ↓ ↓ 2 1 0 0 0 3 EADGBe 1 DV↓ ↓ ↓ ↓ × × 0 1 3 2 EADGBe 1 Emvi↓ ↓ ↓ ↓ 0 2 3 0 0 0 EADGBe 1 CIV↓ ↓ ↓ ↓ × 3 2 0 1 0 EADGBe 1 Minor pop loop Em Key Show chord diagramsHide chord diagrams · Minor pop loop ▶ Play Emi↓ ↓ ↓ ↓ 0 2 3 0 0 0 EADGBe 1 CVI↓ ↓ ↓ ↓ × 3 2 0 1 0 EADGBe 1 GIII↓ ↓ ↓ ↓ 2 1 0 0 0 3 EADGBe 1 DVII↓ ↓ ↓ ↓ × × 0 1 3 2 EADGBe 1 Folk / rock three chords G Key Show chord diagramsHide chord diagrams · Folk / rock three chords ▶ Play GI↓ ↓ ↓ ↓ 2 1 0 0 0 3 EADGBe 1 CIV↓ ↓ ↓ ↓ × 3 2 0 1 0 EADGBe 1 DV↓ ↓ ↓ ↓ × × 0 1 3 2 EADGBe 1 GI↓ ↓ ↓ ↓ 2 1 0 0 0 3 EADGBe 1 50s / doo-wop loop G Key Show chord diagramsHide chord diagrams · 50s / doo-wop loop ▶ Play GI↓ ↓ ↓ ↓ 2 1 0 0 0 3 EADGBe 1 Emvi↓ ↓ ↓ ↓ 0 2 3 0 0 0 EADGBe 1 CIV↓ ↓ ↓ ↓ × 3 2 0 1 0 EADGBe 1 DV↓ ↓ ↓ ↓ × × 0 1 3 2 EADGBe 1 1–6–4–5 pop loop C Key Show chord diagramsHide chord diagrams · 1–6–4–5 pop loop ▶ Play CI↓ ↓ ↓ ↓ × 3 2 0 1 0 EADGBe 1 Amvi↓ ↓ ↓ ↓ × 0 2 3 1 0 EADGBe 1 Fmaj7IVmaj7↓ ↓ ↓ ↓ × × 3 2 1 0 EADGBe 1 GV↓ ↓ ↓ ↓ 2 1 0 0 0 3 EADGBe 1 Royal road (J-pop) C Key Show chord diagramsHide chord diagrams · Royal road (J-pop) ▶ Play Fmaj7IVmaj7↓ ↓ ↓ ↓ × × 3 2 1 0 EADGBe 1 GV↓ ↓ ↓ ↓ 2 1 0 0 0 3 EADGBe 1 Em7iii7↓ ↓ ↓ ↓ 0 1 2 0 3 0 EADGBe 1 Amvi↓ ↓ ↓ ↓ × 0 2 3 1 0 EADGBe 1 02 Advanced chords F 1 3 4 2 1 1 EADGBe 1 eBGDAE 1 1 2 3 3 1 𝄞8 × × 3 2 1 1 EADGBe 1 eBGDAE 1 1 2 3 × × 𝄞8 StandardEasy ♪ Bm × 1 3 4 2 1 EADGBe 1 eBGDAE 2 3 4 4 2 × 𝄞8 ♯ ♯ × × 3 4 2 1 EADGBe 1 eBGDAE 2 3 4 4 × × 𝄞8 ♯ ♯ StandardEasy ♪ Fm 1 3 4 1 1 1 EADGBe 1 eBGDAE 1 1 1 3 3 1 𝄞8 ♭ × × 3 1 1 1 EADGBe 1 eBGDAE 1 1 1 3 × × 𝄞8 ♭ StandardEasy ♪ B7 × 2 1 3 0 4 EADGBe 1 eBGDAE 2 0 2 1 2 × 𝄞8 ♯ ♯ ♪ Cmaj7 × 3 2 0 0 0 EADGBe 1 eBGDAE 0 0 0 2 3 × 𝄞8 ♪ G7 3 2 0 0 0 1 EADGBe 1 eBGDAE 1 0 0 0 2 3 𝄞8 ♪ D7 × × 0 2 1 3 EADGBe 1 eBGDAE 2 1 2 0 × × 𝄞8 ♯ ♪ A7 × 0 1 0 2 0 EADGBe 1 eBGDAE 0 2 0 2 0 × 𝄞8 ♯ ♪ E7 0 2 0 1 0 0 EADGBe 1 eBGDAE 0 0 1 0 2 0 𝄞8 ♯ ♪ Am7 × 0 2 0 1 0 EADGBe 1 eBGDAE 0 1 0 2 0 × 𝄞8 ♪ Dsus2 × × 0 1 3 0 EADGBe 1 eBGDAE 0 3 2 0 × × 𝄞8 ♪ Asus4 × 0 1 2 3 0 EADGBe 1 eBGDAE 0 3 2 2 0 × 𝄞8 ♪ Dsus4 × × 0 1 3 4 EADGBe 1 eBGDAE 3 3 2 0 × × 𝄞8 ♪ C7 × 3 2 4 1 0 EADGBe 1 eBGDAE 0 1 3 2 3 × 𝄞8 ♭ ♪ E5 0 1 2 × × × EADGBe 1 eBGDAE × × × 2 2 0 𝄞8 ♪ A5 × 0 1 2 × × EADGBe 1 eBGDAE × × 2 2 0 × 𝄞8 ♪ F#m 1 3 4 1 1 1 EADGBe 1 eBGDAE 2 2 2 4 4 2 𝄞8 ♯ ♯ ♯ ♯ ♯ × × 3 1 1 1 EADGBe 1 eBGDAE 2 2 2 4 × × 𝄞8 ♯ ♯ ♯ StandardEasy ♪ B × 1 2 3 4 1 EADGBe 1 eBGDAE 2 4 4 4 2 × 𝄞8 ♯ ♯ ♯ × × 2 3 4 1 EADGBe 1 eBGDAE 2 4 4 4 × × 𝄞8 ♯ ♯ ♯ StandardEasy ♪ C#m × 1 3 4 2 1 EADGBe 4 eBGDAE 4 5 6 6 4 × 𝄞8 ♯ ♯ ♯ ♯ ♪ G#m 1 3 4 1 1 1 EADGBe 4 eBGDAE 4 4 4 6 6 4 𝄞8 ♯ ♯ ♯ ♯ ♯ ♪ Common song progressions 4/4 · One bar / four beats per cell · Read left to right · Set tempo, strum and looping under Practice above Canon progression C Key Show chord diagramsHide chord diagrams · Canon progression ▶ Play CI↓ ↓ ↓ ↓ × 3 2 0 1 0 EADGBe 1 G/BV↓ ↓ ↓ ↓ × 1 0 0 0 3 EADGBe 1 Amvi↓ ↓ ↓ ↓ × 0 2 3 1 0 EADGBe 1 Emiii↓ ↓ ↓ ↓ 0 2 3 0 0 0 EADGBe 1 FIV↓ ↓ ↓ ↓ 1 3 4 2 1 1 EADGBe 1 CI↓ ↓ ↓ ↓ × 3 2 0 1 0 EADGBe 1 FIV↓ ↓ ↓ ↓ 1 3 4 2 1 1 EADGBe 1 GV↓ ↓ ↓ ↓ 2 1 0 0 0 3 EADGBe 1 Minor dominant resolution Am Key Show chord diagramsHide chord diagrams · Minor dominant resolution ▶ Play Ami↓ ↓ ↓ ↓ × 0 2 3 1 0 EADGBe 1 Dmiv↓ ↓ ↓ ↓ × × 0 2 3 1 EADGBe 1 E7V7↓ ↓ ↓ ↓ 0 2 0 1 0 0 EADGBe 1 Ami↓ ↓ ↓ ↓ × 0 2 3 1 0 EADGBe 1 Jazz ii–V–I G Key Show chord diagramsHide chord diagrams · Jazz ii–V–I ▶ Play Am7ii7↓ ↓ ↓ ↓ × 0 2 0 1 0 EADGBe 1 D7V7↓ ↓ ↓ ↓ × × 0 2 1 3 EADGBe 1 GI↓ ↓ ↓ ↓ 2 1 0 0 0 3 EADGBe 1 GI↓ ↓ ↓ ↓ 2 1 0 0 0 3 EADGBe 1 12-bar blues E Key Show chord diagramsHide chord diagrams · 12-bar blues ▶ Play E7I7↓ ↓ ↓ ↓ 0 2 0 1 0 0 EADGBe 1 E7I7↓ ↓ ↓ ↓ 0 2 0 1 0 0 EADGBe 1 E7I7↓ ↓ ↓ ↓ 0 2 0 1 0 0 EADGBe 1 E7I7↓ ↓ ↓ ↓ 0 2 0 1 0 0 EADGBe 1 A7IV7↓ ↓ ↓ ↓ × 0 1 0 2 0 EADGBe 1 A7IV7↓ ↓ ↓ ↓ × 0 1 0 2 0 EADGBe 1 E7I7↓ ↓ ↓ ↓ 0 2 0 1 0 0 EADGBe 1 E7I7↓ ↓ ↓ ↓ 0 2 0 1 0 0 EADGBe 1 B7V7↓ ↓ ↓ ↓ × 2 1 3 0 4 EADGBe 1 A7IV7↓ ↓ ↓ ↓ × 0 1 0 2 0 EADGBe 1 E7I7↓ ↓ ↓ ↓ 0 2 0 1 0 0 EADGBe 1 B7V7↓ ↓ ↓ ↓ × 2 1 3 0 4 EADGBe 1 Pop in D D Key Show chord diagramsHide chord diagrams · Pop in D ▶ Play DI↓ ↓ ↓ ↓ × × 0 1 3 2 EADGBe 1 AV↓ ↓ ↓ ↓ × 0 1 2 3 0 EADGBe 1 Bmvi↓ ↓ ↓ ↓ × 1 3 4 2 1 EADGBe 1 GIV↓ ↓ ↓ ↓ 2 1 0 0 0 3 EADGBe 1 Suspended colour D Key Show chord diagramsHide chord diagrams · Suspended colour ▶ Play DI↓ ↓ ↓ ↓ × × 0 1 3 2 EADGBe 1 Dsus4Isus4↓ ↓ ↓ ↓ × × 0 1 3 4 EADGBe 1 DI↓ ↓ ↓ ↓ × × 0 1 3 2 EADGBe 1 Dsus2Isus2↓ ↓ ↓ ↓ × × 0 1 3 0 EADGBe 1 03 Your own progression Add chords in order · One bar / four beats per cell · Saved in this browser\nChord CDEGAAmDmEmFmaj7Cadd9G/BEm7FBmFmB7Cmaj7G7D7A7E7Am7Dsus2Asus4Dsus4C7E5A5F#mBC#mG#m ＋ Add Clear My progression Show chord diagramsHide chord diagrams ▶ Play Choose a chord to start your progression.\nTuner E · A · D · G · B · e × Tap a string to hear it and lock the target, or start listening and pluck an open string.\nAuto EE2AA2DD3GG3BB3eE4 –\n−500+50 Start listening Sound is analysed live in this browser; nothing is recorded or uploaded. Closing this window stops listening.\nProgression references: Fender · Berklee\nGuitar samples: nbrosowsky / Iowa / Karoryfer · CC BY 3.0\n","date":"14 October 2026","externalUrl":null,"permalink":"/posts/basic-guitar-chords/","section":"Writing","summary":"C · D · E · G · A · Am · Dm · Em · Fmaj7 · Cadd9 · G/B · Em7 / F · Bm · Fm · B7 · Cmaj7 · G7 · D7 · A7 · E7 · Am7 · Dsus2 · Asus4 · Dsus4 · C7 · E5 · A5 · F#m · B · C#m · G#m","title":"Basic guitar chords","type":"posts"},{"content":"Building a personal website no longer requires learning web development from scratch first. With a coding agent such as Codex or Claude Code, you can describe your requirements, create pages, adjust layouts, and set up publishing, then refine the result through previews.\nStill, “build me a website” leaves many decisions to the tool. Where should articles live? Where will the site be hosted? How will you update it? Does your computer need to stay on?\nThis article uses the website you are reading as an example. It introduces the main components and their roles, so you can use its architecture as a reference, describe what you want, and work with a coding agent on the implementation.\nThe big picture: from articles to a website # The basic process is to turn text files and templates into pages, then let a hosting platform serve them to readers.\nArticles, images, settings + Blowfish theme ↓ Hugo generates the site ↓ HTML, CSS, JavaScript, images ↓ GitHub Pages / Cloudflare ↓ Reader\u0026#39;s browser Component Its role on this site Markdown Holds articles and page content Hugo Combines content, settings, and templates into website files Blowfish Provides the appearance and common reading interfaces Git / GitHub Stores source files and revision history GitHub Actions Automatically builds and publishes updates GitHub Pages Hosts the primary public website Cloudflare Hosts another copy as a mirror Codex / Claude Code Helps connect the components, adjust the design, and check results To begin, you can use Hugo, a theme, and one hosting platform. Publishing to two platforms is a choice made for this site; you do not need both from the start.\nStatic websites: prepare the pages before readers arrive # A static website has its main page content generated before publication. When someone opens an article, the server sends existing HTML, styles, and images, which the browser displays.\nThink of it as a typeset ebook: after adding or editing content, you generate an updated copy and put it online.\nThis works well for personal profiles, research publications, portfolios, technical notes, and blogs. Their content is usually updated by the author, so there is little need to assemble each page from a database whenever someone visits.\nMaintenance is relatively simple, too. This site does not require me to manage a continuously running application and database. Once published, it remains available even when my computer is off.\n“Static” does not mean the page cannot move. The galaxy, terminal, and raven interactions on this site run as JavaScript in the browser. Theme switching, expandable content, and article search using a prebuilt index can also work on a static site.\nFeatures that need server-side processing require additional planning: signing users in, storing individual users\u0026rsquo; data, or collecting payments, for example. If your main goal is to present your work and write articles, a static website is an approachable starting point.\nHugo: turning content into pages # Hugo is a static site generator. You supply articles, images, settings, and templates; it combines them into a complete website.\nArticles are mainly written in Markdown, a text format with simple formatting markers. For example, ## introduces a section heading, and **text** makes text bold. The source remains readable and is easy to work on with a coding agent.\nAn article might look like this:\n--- title: \u0026#34;My first article\u0026#34; date: 2026-10-05 draft: true --- This is the opening paragraph. ## Why build a website? I want somewhere to collect my work and notes. ... The information between the two --- lines is called front matter. It tells Hugo the title, date, and whether the article is a draft. The body follows below.\nHugo also supports multilingual websites. This site\u0026rsquo;s English and Traditional Chinese pages are written separately and linked through the language switcher. The translations still need to be prepared and checked; Hugo organises them and generates the pages.\nFor everyday writing, you edit the content while templates take care of navigation, footers, and article layout. As the collection grows, this avoids repeatedly editing the same elements on individual pages.\nBlowfish: start with a complete design, then make it your own # Hugo generates the website; the theme supplies its presentation. This site uses Blowfish, a Hugo theme with article layouts, navigation, and light and dark appearances.\nA theme gives you a usable site early on. You can add a profile and a few articles, check the structure, and then adjust typography, colours, the homepage, and interactions.\nThe current homepage includes custom elements such as a research galaxy, a profile panel, and an ASCII raven. These build on the theme: I used Codex to modify HTML templates, CSS, and JavaScript to create the appearance and interactions I wanted.\nFor example, you could ask:\nUse a dark background on the homepage. Show my name, research interests, and contact details first. On mobile, place those details before interactive decorations. Keep article pages quiet and easy to read.\nSpecific requirements make it easier to judge the preview. Once you can see the result, refine it one change at a time.\nGitHub and GitHub Actions: save the content and automate updates # Git records file changes, and GitHub hosts Git repositories. Changes to articles and designs can have a recorded history, making it easier to compare revisions or recover an earlier version.\nThis site keeps source content and editing history in a private repository. The public repository contains only the generated website files. Readers can access published pages, while drafts, internal notes, and other working files do not have to be published alongside them.\nGitHub Actions automates building and publishing. When I push an update to the source repository, GitHub starts a build environment, runs Hugo, and sends the generated files to the hosting platform.\nAn everyday update therefore becomes: edit an article, preview it locally, push the changes once satisfied, and check that publishing succeeded.\nGitHub Pages: giving the website a public address # After generating the files, you need somewhere readers can access them. GitHub Pages is GitHub\u0026rsquo;s static website hosting service.\nIts role differs from the repository: the repository stores files and revisions, while Pages serves website content through a URL. This site\u0026rsquo;s primary address is https://yenjia.github.io/.\nYou can start with the address provided by the platform. If you later want your own domain, you can add the domain and DNS configuration. The domain is the address readers enter; the hosting platform supplies the website files.\nThe initial setup connects Pages with the publishing workflow. A coding agent can help with those settings, but you should still open the production URL after publishing and check the homepage, articles, images, and links.\nCloudflare: hosting the same content on another platform # Cloudflare provides several website and networking services. For static sites, you may encounter Cloudflare Pages or Workers Static Assets. Both can host website files, but their setup and deployment methods differ.\nThis site\u0026rsquo;s Cloudflare mirror uses Workers Static Assets. The deployment tool Wrangler uploads the files generated by Hugo. This configuration serves static content without an additional backend program for application logic.\nCloudflare Pages also allows you to upload a prebuilt website. When setting up hosting, identify which service you are using and ask the agent to follow the corresponding documentation.\nOn this site, GitHub Pages and Cloudflare are independent entry points built and deployed from the same source content. Cloudflare acts as a mirror. It does not sit in front of GitHub Pages, and automatic failover is not configured.\nAfter setup, how do you write the next article? # Once the website is ready, most of your time can go into content. Here, articles live in content/posts/. Add a Markdown file with a title, date, and body, and you have the source for another article.\nWhile writing, keep draft: true so ordinary production builds skip it. Locally, preview with drafts included:\nhugo server --buildDrafts This command starts a local preview and prints its URL in the terminal. If a coding agent handles the operation, you do not need to memorize the command. It does not publish the article online. Once the content is ready, change the draft flag to false and use the existing publishing workflow.\nFor English and Chinese versions, you can follow this site\u0026rsquo;s naming convention: my-first-post.md and my-first-post.zh-tw.md. Place images in the project\u0026rsquo;s image directories and reference them from the article. An agent can follow the existing project structure rather than inventing a new arrangement each time.\nThe initial setup connects the components; later articles reuse that workflow. You can focus on writing and ask the agent for changes when you need a new layout or feature.\nHow to describe the project to Codex or Claude Code # Once you understand the components, you can give the agent an architecture, content requirements, and completion criteria together. Here is a starting prompt:\nBuild a personal website with Hugo and Blowfish, including a homepage, an About page, an article list, and research publications. Manage content in Markdown, support English and Traditional Chinese, use a dark appearance, and make it comfortable to read on mobile. Set up GitHub Actions to publish automatically to GitHub Pages. Complete local previews and build checks first, summarize the changes, and wait for my confirmation before publishing. Keep source files in a private repository and publish only generated website files. Store credentials in the platform\u0026rsquo;s secrets settings.\nAfter the first version, assign another focused task, such as: “Display homepage publications as three cards, stacked in a single column on mobile.” Once the content and appearance are stable, add Cloudflare deployment or more elaborate interactions.\nLook at the result after each round: is the text readable, does the mobile page scroll sideways, does language switching work, and are images and links intact? Ask the agent to check keyboard operation for interactive elements and ensure content remains accessible when users request reduced motion.\nYou do not have to memorize every command, but it helps to know which layer you are changing: content, appearance, or publishing. That makes problems easier to describe and proposed changes easier to understand.\nThese roles connect to make this website: Markdown holds content, Hugo and the theme generate pages, GitHub records changes, Actions automates builds, and hosting platforms provide public access. Prepare the content you want people to see, choose a simple publishing route, and work with a coding agent on the first version. You can develop it into your own website over time.\n","date":"5 October 2026","externalUrl":null,"permalink":"/posts/building-this-website/","section":"Writing","summary":"Understanding each component makes it easier to describe what you want to a coding agent. This article explains how this site goes from content and design to automated publishing.","title":"How this website is built: Hugo, GitHub Pages, and Cloudflare","type":"posts"},{"content":" What is a sequence model? # A sequence model can be seen as a function that maps one sequence to another, and the Transformer is the classic example. Models of this kind handle many types of problems and data, including text, images, audio and video. For example:\nLanguage models: GPT, Claude, Gemini and others Vision-language models: LLaVA, and LLaVA-Med, which I covered in another article Image models: the many vision transformers Most of these state-of-the-art models are built on Transformers, which means one architecture can handle problems in different modalities. Take LLaVA: an image is encoded into feature vectors by a vision encoder, text is turned into tokens by a tokenizer, and then a single Transformer-based model can classify, or act as a chatbot. ViT does something similar.\nWhy are Transformers so convenient? # A Transformer block consists of multi-head attention, layer norm, feed forward (MLP), dropout and skip connections. Multi-head attention is the most important part.\nA Transformer block (from Build a Large Language Model From Scratch) Once you have a Transformer block, scaling the model up is easy: stack more blocks, or use a Mixture of Experts (MoE, such as Mixtral 8×7B). Model size can be adjusted to whatever you need. This simplicity is one reason Transformer-based models became so popular.\nScaling laws # Transformers also come with an important rule of thumb, scaling laws. These are empirical observations that let you predict a model\u0026rsquo;s performance before training, from the dataset size, total compute and model size.\nDeepMind\u0026rsquo;s Chinchilla scaling law is one of the best known. Here LLL can be read as the loss, NNN is the number of model parameters, and DDD is the number of training tokens:\nL(N,D)=E+AN0.34+BD0.28,E=1.69, A=406.4, B=410.7L(N, D) = E + \\frac{A}{N^{0.34}} + \\frac{B}{D^{0.28}}, \\quad E = 1.69,\\ A = 406.4,\\ B = 410.7L(N,D)=E+N0.34A​+D0.28B​,E=1.69, A=406.4, B=410.7Its main conclusion is that for a fixed compute budget, model size and the number of training tokens should be scaled in equal proportion, at roughly 20 training tokens per parameter. In other words, growing the model and the data together should lower the loss. The figure below is from OpenAI\u0026rsquo;s earlier scaling-law study: test loss falls steadily as compute, data and parameters increase.\nFigure 1 from Kaplan et al. (2020) The limits of Transformers # Transformers have proved powerful across many applications, and their performance improves readily with more resources. But there is a problem: because of attention, the computation grows quadratically with the context length. So the number of input and output tokens is capped, and they are hard to apply directly to long sequences such as video.\nThere are two mainstream answers for long sequences:\nRetrieval-Augmented Generation (RAG) works like an extension: it retrieves data from an external database and gives a tailored answer. It\u0026rsquo;s like being allowed a cheat sheet in an exam. You have to organize and condense the information onto the sheet beforehand so you can find what you need during the exam. A larger context window lets the model read more tokens at once, for example a context window of a million tokens. Either way, it is better to cut the computation so that replies over long sequences come faster. Mamba is designed to handle long sequences efficiently in both training and inference.\nState space models # Before Mamba, we need to meet its predecessors. We start with the state space model (SSM), which comes from control theory and describes a dynamic system with differential equations:\nx′(t)=Ax(t)+Bu(t)y(t)=Cx(t)+Du(t)\\begin{aligned} x\u0026#x27;(t) \u0026amp;= Ax(t) + Bu(t) \\\\ y(t) \u0026amp;= Cx(t) + Du(t) \\end{aligned}x′(t)y(t)​=Ax(t)+Bu(t)=Cx(t)+Du(t)​Here u(t)u(t)u(t) is the input signal, x(t)x(t)x(t) is the state, and y(t)y(t)y(t) is the output. AAA is the state matrix, which multiplies the state; BBB and CCC are the input and output matrices; DDD acts like a skip connection and is usually set to 0 to drop the term.\nBlock diagram of a state space model The idea of an SSM is to remember past information in a smaller state, a bit like an RNN. That is how it handles long sequences.\nDiscretization: the recurrent and convolutional views # The most important step in an SSM is discretization, because it determines how efficient training and inference are. After discretization, the continuous system can be turned into two views.\nThe first is the recurrent view. Discretizing with the trapezoid (bilinear) method and a step size Δ\\DeltaΔ turns the system into a recurrence:\nxk=Aˉxk−1+Bˉuk,Aˉ=(I−Δ2A)−1(I+Δ2A)yk=Cˉxk,Bˉ=(I−Δ2A)−1ΔB,Cˉ=C\\begin{aligned} x_k \u0026amp;= \\bar{A}x_{k-1} + \\bar{B}u_k, \u0026amp; \\bar{A} \u0026amp;= (I - \\tfrac{\\Delta}{2}A)^{-1}(I + \\tfrac{\\Delta}{2}A) \\\\ y_k \u0026amp;= \\bar{C}x_k, \u0026amp; \\bar{B} \u0026amp;= (I - \\tfrac{\\Delta}{2}A)^{-1}\\Delta B, \\quad \\bar{C} = C \\end{aligned}xk​yk​​=Aˉxk−1​+Bˉuk​,=Cˉxk​,​AˉBˉ​=(I−2Δ​A)−1(I+2Δ​A)=(I−2Δ​A)−1ΔB,Cˉ=C​At inference time we can generate outputs with this formula. The next output depends only on the current state and the current input, so inference is very efficient, just like an RNN.\nThe second is the convolutional view. Unrolling the recurrence writes the output as a convolution of the input with a kernel:\ny=Kˉ∗u,Kˉ=(CˉBˉ, CˉAˉBˉ, …, CˉAˉL−1Bˉ)y = \\bar{K} \\ast u, \\qquad \\bar{K} = (\\bar{C}\\bar{B},\\ \\bar{C}\\bar{A}\\bar{B},\\ \\dots,\\ \\bar{C}\\bar{A}^{L-1}\\bar{B})y=Kˉ∗u,Kˉ=(CˉBˉ, CˉAˉBˉ, …, CˉAˉL−1Bˉ)During training the whole sequence is known, so the convolution can be computed in parallel. This is where SSMs differ from RNNs, which must be trained one step at a time.\nThe matrix A and HiPPO # In an SSM, BBB and CCC are learnable, and the choice of AAA is crucial. The convolution kernel needs Aˉk\\bar{A}^kAˉk, which is still expensive, so AAA should ideally be a normal matrix: normal matrices are unitarily diagonalizable, which makes powers easy to compute.\nSSMs also initialize AAA with the HiPPO (High-Order Polynomial Projection Operator) matrix. The HiPPO matrix is derived from a specific measure and helps the state remember earlier information; the proofs and experiments are in an earlier paper by the same author. The version used in S4 (HiPPO-LegS) is:\nAnk=−{2n+1 2k+1n\u0026gt;kn+1n=k0n\u0026lt;kA_{nk} = -\\begin{cases} \\sqrt{2n+1}\\,\\sqrt{2k+1} \u0026amp; n \u0026gt; k \\\\ n + 1 \u0026amp; n = k \\\\ 0 \u0026amp; n \u0026lt; k \\end{cases}Ank​=−⎩⎨⎧​2n+1​2k+1​n+10​n\u0026gt;kn=kn\u0026lt;k​This matrix is not normal, though. The authors decompose it into a normal matrix plus a low-rank matrix, then use their algorithm to speed up both the recurrent and the convolutional computation. Empirically, SSMs initialized with HiPPO perform well, but not when AAA is initialized randomly.\nStructured state space models (S4) # Put all this together and you get S4:\nS4 = SSM + HiPPO + Structured matrices\nThat is, use a state space model, replace AAA with the HiPPO matrix, and learn the parameters with structured matrices and a dedicated algorithm.\nThree aspects of S4 (from Albert Gu\u0026rsquo;s talk) S4 has some useful properties:\nResolution invariance: because the model comes from a continuous system, it can be trained on low-resolution data and used on high-resolution data. This is especially handy for audio, where lowering the sample rate speeds up training. Efficient training: training can use the convolution and run in parallel. Efficient inference: inference can use the recurrence. Mamba # Mamba: Linear-Time Sequence Modeling with Selective State Spaces by Albert Gu and Tri Dao (code on GitHub) sets out to solve the problems that attention brings. It adds two improvements on top of SSMs:\nA selective mechanism, which lets the model decide, based on the input, what to focus on or ignore. A hardware-aware algorithm, which designs the computation around the GPU\u0026rsquo;s memory hierarchy. According to the paper, Mamba reaches 5× higher inference throughput than Transformers and state-of-the-art results across modalities such as language, audio and genomics. It is also the first attention-free model to match Transformer performance: Mamba-3B outperforms Transformers of the same size.\nNotation and discretization # The Mamba paper uses slightly different notation: hhh is the state, xxx the input, and yyy the output. The continuous and discretized systems are:\nh′(t)=Ah(t)+Bx(t)ht=Aˉht−1+Bˉxty(t)=Ch(t)yt=Cht\\begin{aligned} h\u0026#x27;(t) \u0026amp;= Ah(t) + Bx(t) \u0026amp; \\qquad h_t \u0026amp;= \\bar{A}h_{t-1} + \\bar{B}x_t \\\\ y(t) \u0026amp;= Ch(t) \u0026amp; \\qquad y_t \u0026amp;= Ch_t \\end{aligned}h′(t)y(t)​=Ah(t)+Bx(t)=Ch(t)​ht​yt​​=Aˉht−1​+Bˉxt​=Cht​​Here the discretization is the zero-order hold (ZOH):\nAˉ=exp⁡(ΔA),Bˉ=(ΔA)−1(exp⁡(ΔA)−I)⋅ΔB\\bar{A} = \\exp(\\Delta A), \\qquad \\bar{B} = (\\Delta A)^{-1}\\left(\\exp(\\Delta A) - I\\right) \\cdot \\Delta BAˉ=exp(ΔA),Bˉ=(ΔA)−1(exp(ΔA)−I)⋅ΔBDiscretization is deeply tied to the continuous-time system, which gives the model extra properties such as resolution invariance and keeps it properly normalized. The figure below shows the state space model inside Mamba. The orange part is the state; AAA extracts features and information from the state, and BBB and CCC handle the input and output.\nSelective state space model (Figure 1 of the Mamba paper) The first improvement: the selective mechanism # In S4, AAA, BBB, CCC and Δ\\DeltaΔ don\u0026rsquo;t depend on the input; the model is time-invariant. Mamba makes BBB, CCC and Δ\\DeltaΔ depend on the input by adding the sequence length LLL as a dimension in the algorithm, so the model becomes time-varying:\nS4 and S6, which adds selection (Algorithms 1 and 2 of the Mamba paper) where:\nsB(x)=LinearN(x)sC(x)=LinearN(x)sΔ(x)=BroadcastD(Linear1(x))τΔ=softplus\\begin{aligned} s_B(x) \u0026amp;= \\mathrm{Linear}_N(x) \\\\ s_C(x) \u0026amp;= \\mathrm{Linear}_N(x) \\\\ s_\\Delta(x) \u0026amp;= \\mathrm{Broadcast}_D(\\mathrm{Linear}_1(x)) \\\\ \\tau_\\Delta \u0026amp;= \\mathrm{softplus} \\end{aligned}sB​(x)sC​(x)sΔ​(x)τΔ​​=LinearN​(x)=LinearN​(x)=BroadcastD​(Linear1​(x))=softplus​sBs_BsB​, sCs_CsC​ and sΔs_\\DeltasΔ​ are linear layers, τΔ\\tau_\\DeltaτΔ​ is softplus (a smooth approximation of ReLU), and the selective mechanism lives mainly in sΔs_\\DeltasΔ​ and τΔ\\tau_\\DeltaτΔ​.\nThe selective mechanism is related to gating in RNNs. Theorem 1 of the paper looks at a special case: when N=1N = 1N=1, A=−1A = -1A=−1, B=1B = 1B=1, sΔ=Linear(x)s_\\Delta = \\mathrm{Linear}(x)sΔ​=Linear(x) and τΔ=softplus\\tau_\\Delta = \\mathrm{softplus}τΔ​=softplus, the selective SSM recurrence becomes:\ngt=σ(Linear(xt))ht=(1−gt) ht−1+gt xt\\begin{aligned} g_t \u0026amp;= \\sigma(\\mathrm{Linear}(x_t)) \\\\ h_t \u0026amp;= (1 - g_t)\\,h_{t-1} + g_t\\,x_t \\end{aligned}gt​ht​​=σ(Linear(xt​))=(1−gt​)ht−1​+gt​xt​​This is very similar to the forget gate in an RNN: a gate decides what to keep, the past state or the current input. The proof is in the paper\u0026rsquo;s appendix.\nThe second improvement: a hardware-aware algorithm # Once the selective mechanism is added, Aˉ\\bar{A}Aˉ and Bˉ\\bar{B}Bˉ change over time, so the model can no longer be trained as a convolution. The authors solve this with three classic techniques:\nKernel fusion Parallel scan Recomputation Parallel scan is the most important; it is also used to compute linear RNNs. The real bottleneck is not the arithmetic but the I/O between two kinds of GPU memory: HBM (High Bandwidth Memory) and SRAM (Static Random-Access Memory), and SRAM is much faster than HBM. The main idea is to compute the key steps, discretization and the scan, in SRAM to reduce I/O.\nMamba\u0026rsquo;s architecture # H3 is one branch of SSM work. Mamba combines H3 with a gated MLP into a single Mamba block; the gated MLP is often used as an alternative to self-attention with fewer parameters. Mamba blocks can be stacked just like Transformer blocks.\nThe Mamba block (Figure 3 of the Mamba paper) Results # The first experiment covers scaling laws on The Pile with models from 125M to 1.3B parameters. Mamba follows scaling laws just like Transformers do, with similar results at longer sequence lengths.\nScaling laws (Figure 4 of the Mamba paper) The second is efficiency. Thanks to the hardware-aware algorithm, Mamba\u0026rsquo;s scan is faster than both FlashAttention-2 and convolution, which gives Mamba higher inference throughput, about five times that of a Transformer.\nEfficiency benchmarks (Figure 8 of the Mamba paper) Conclusion # Mamba starts from state space models, uses HiPPO and S4 to lay the groundwork for remembering long sequences and computing efficiently, adds a selective mechanism so the model can choose what to remember based on content, and wins back efficiency with a hardware-aware algorithm.\nFor me, the most interesting thing about this paper is that it offers a path beyond attention. Attention-free sequence models are worth following, worth trying for training and inference, and could even be used to build foundation models.\nReferences # Albert Gu and Tri Dao. Mamba: Linear-Time Sequence Modeling with Selective State Spaces. arXiv preprint arXiv:2312.00752, 2023. Albert Gu, Karan Goel, and Christopher Ré. Efficiently Modeling Long Sequences with Structured State Spaces. arXiv preprint arXiv:2111.00396, 2021. Jordan Hoffmann et al. Training Compute-Optimal Large Language Models. arXiv preprint arXiv:2203.15556, 2022. Jared Kaplan et al. Scaling Laws for Neural Language Models. arXiv preprint arXiv:2001.08361, 2020. Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual Instruction Tuning. Advances in Neural Information Processing Systems, 2023. Alexey Dosovitskiy et al. An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale. arXiv preprint arXiv:2010.11929, 2020. Sebastian Raschka. Build a Large Language Model From Scratch. Loïck Bourdois. Introduction to State Space Models (SSM). Albert Gu\u0026rsquo;s talk on S4, 2022. ","date":"19 April 2024","externalUrl":null,"permalink":"/posts/mamba/","section":"Writing","summary":"Attention grows quadratically with length. How does Mamba remember the past in a small state and still train and run fast?","title":"Sequence models without attention: from state space models to Mamba","type":"posts"},{"content":" \u0026gt;_ BEFORE YOU READ\nWhat question does this article answer? Core question: How can existing vision and language models be adapted into a conversational model that answers questions about medical images?\nUseful background: A basic understanding of encoders, embeddings, and fine-tuning is enough; prior reading of LLaVA is optional.\nReading route: Follow the data construction, the two training stages, and then the evaluation methods. Notice how GPT-4 generates training conversations without seeing the images.\nThis reading note covers the original 2023 paper and was published in February 2024. Descriptions of models and tools should be read in that historical context.\nDeep learning has shown promising performance on a range of medical tasks. In classification, for example, physicians can combine model outputs with their own experience to inform diagnosis. Yet many common models produce just one output for an image, such as classification logits or a segmentation mask.\nA medical image can contain much more information. Some findings may relate to the target task without being its main focus—for example, an organ may show inflammation rather than a malignant tumor. Others may be unrelated to the original question but still warrant follow-up. Microsoft\u0026rsquo;s LLaVA-Med: Training a large language-and-vision assistant for biomedicine in one day, published in 2023, combines language and vision to help describe the contents of medical images.\nLLaVA-Med is a conversational vision-language model. Given an image, users can ask questions or request a description, much like chatting with ChatGPT. General-purpose multimodal models available at the time of this article, such as Google Bard, could also process images and text, but their answers could be unreliable because they lacked specialized medical knowledge. This paper presents an efficient training approach that adapts existing open-source models using medical data, reporting promising results after 15 hours of training on eight 40 GB A100 GPUs.\nFeatures and contributions # The main features and contributions can be summarised as follows:\nA large, diverse dataset of medical figure-caption pairs. Open-ended instruction-following data generated with GPT-4. Two-stage training: biomedical concept alignment followed by end-to-end instruction tuning. Affordable development costs and an approach that can transfer to other domains. Low-cost serving, with inference possible on consumer GPUs. Biomedical visual instruction-following data # The two training stages require different datasets. The source is PMC-15M, a collection of 15 million image-text pairs extracted from PubMed Central. Each pair contains an image and its corresponding caption.\nFor stage 1, the authors randomly sample 600,000 pairs to help align visual and language representations with biomedical concepts. They call this biomedical concept alignment data. Training uses single-turn instructions, as illustrated below.\nHere, X_q denotes the question, X_v the image, and X_c its caption. The model describes the image using either a brief description or a detailed description.\nFor stage 2, the authors sample 60,000 pairs and prepare multi-turn conversations. The images cover five modalities: chest X-rays, CT, MRI, histopathology, and gross pathology. Because the source dataset does not include multi-turn image-based conversations, GPT-4 generates them from the captions.\nCrucially, GPT-4 did not see the images in this process. It received captions and prompts asking it to respond as though it could see the image, generating two or three turns of questions and answers from a visual perspective. Figure 4 illustrates this procedure. The resulting dataset is called biomedical instruction-tuning data.\nTraining approach # Training has two stages. Biomedical concept alignment runs for one epoch, followed by three epochs of end-to-end instruction tuning, as shown in Figure 3. Additional fine-tuning can then be performed for downstream tasks.\nThe approach does not depend on a special architectural trick and can be applied to other vision-language architectures. In stage 1, the model predicts image captions while the image encoder and language model remain frozen. Only the projection matrix after the image encoder is updated, with the aim of aligning visual concepts with word embeddings.\nIn stage 2, the language model also participates in training using the GPT-4-generated multi-turn conversations. The authors report strong zero-shot performance on some visual question answering (VQA) datasets after this stage.\nExperimental results # The authors evaluate the medical chatbot in two ways. First, they construct a validation set of 193 questions, including conversations and detailed image descriptions, and use GPT-4 to score the responses. Table 1 compares LLaVA-Med with LLaVA, a model trained only on stage 1, and models trained with different amounts of data. Even with 10,000 examples, LLaVA-Med outperforms LLaVA in this evaluation, and additional data further improves performance.\nThe second evaluation uses three medical VQA datasets:\nVQA-RAD: 315 radiology images and 3,515 question-answer pairs generated by clinicians. SLAKE (Semantically-Labeled Knowledge-Enhanced dataset for medical VQA): 642 radiology images and more than 7,000 question-answer pairs created by experienced physicians. PathVQA: 4,998 pathology images and 32,799 question-answer pairs. Questions are divided into open-ended and closed-ended categories. Open-ended answers are evaluated by the proportion of ground-truth tokens appearing in the generated answer; closed-ended answers are evaluated using accuracy. Table 3 shows promising results for LLaVA-Med in both categories.\nTogether with the paper\u0026rsquo;s ablation studies, these experiments suggest two main points:\nLonger stage 1 training improves zero-shot transfer, but stage 1 alone is insufficient. Instruction-following data is crucial for stage 2. An additional case study # Although the training conversations use only English, the model demonstrates an ability to answer Chinese questions in the example shown in Table 6. The authors speculate that LLaMA may already have acquired some multilingual knowledge, making this transfer possible. Other existing models may not transfer to a different language as successfully in a zero-shot setting.\nConclusion # LLaVA-Med is a large vision-language model focused on biomedicine. GPT-4 is used to create medical visual instruction-following data. After further fine-tuning, LLaVA-Med surpasses other models on some evaluation metrics. It still exhibits familiar limitations of large language models, including hallucinations and limited deep reasoning. ↳ TAKEAWAYS\nThree ideas and a follow-up question Data construction is part of the method: Figure-caption pairs and GPT-4-generated conversations serve different training stages. The stages have different purposes: First align visual and language representations, then learn to follow biomedical instructions. Evaluation methods shape the interpretation: GPT-4 scores, answer-token coverage, and closed-ended accuracy measure different aspects of performance. A follow-up question: Which information in an image can caption-generated conversations capture, and which information might they miss?\nScope of the evidence: Read the reported evaluations and Chinese-language example alongside the model\u0026rsquo;s hallucinations and reasoning limitations.\nFor further reading, start with the original paper and official code linked below.\nReferences # Li, Chunyuan, Cliff Wong, Sheng Zhang, Naoto Usuyama, Haotian Liu, Jianwei Yang, Tristan Naumann, Hoifung Poon, and Jianfeng Gao. “LLaVA-Med: Training a large language-and-vision assistant for biomedicine in one day.” arXiv preprint arXiv:2306.00890 (2023). Microsoft LLaVA-Med repository ","date":"3 February 2024","externalUrl":null,"permalink":"/posts/llava_med/","section":"Writing","summary":"The data, training approach, and experiments behind a conversational medical vision-language model.","title":"LLaVA-Med: a vision-language model for medicine","type":"posts"},{"content":" In 2023, when everyone is focused on LLMs, here is an image visualization method that has received little attention but works well. For image classification, many people use visualization to explain what a model bases its decision on. The method in this article builds on one idea, the Information Bottleneck, to create an alternative to gradient-based methods such as Grad-CAM. The paper shows that it comes with some theoretical guarantees and can easily be applied to all kinds of model architectures. This article aims for an intuitive understanding rather than a detailed derivation.\nIntroduction # Restricting the Flow: Information Bottlenecks for Attribution, published at ICLR 2020, is the paper we will discuss. Work on visualization and interpretability often runs into a few hard problems, for example:\nMethods are hard to apply to unusual, custom model architectures. Some methods are slow and inefficient (Occlusion Sensitivity, for instance). Gradient-based methods are sensitive to model parameters and tend to include unimportant regions. To get precise results, the authors bring in the Information Bottleneck. Backed by information theory, it guarantees that regions of an image judged irrelevant are not necessary for the model\u0026rsquo;s prediction.\nWhat is the Information Bottleneck? # Information Bottleneck The Information Bottleneck is this one expression, first proposed in 2000, where I denotes mutual information. Put simply, the goal is to maximize the mutual information between Y and Z while minimizing (hence the minus sign) the mutual information between X and Z. β is a manually tuned parameter.\nThat may still not make clear what X, Y and Z mean here, so let\u0026rsquo;s map the idea onto a familiar model. The blue boxes are one complete model (ResNet50, say), split into a front and a back half. X is the input, Z is the intermediate result after X passes through the front half, that is, the features, and Y is the output. Back to the expression: minimizing the information between X and Z means filtering out as much unimportant information as possible (such as an image\u0026rsquo;s background) and keeping the important information Z, which is the idea of feature extraction. The remaining features must still classify well, so we also maximize the information between Y and Z, which is what an ordinary classification model already does.\nYou might notice that the whole process resembles compression and decompression. When compressing, we want a high compression ratio without losing too much of the file (for lossy compression).\nArchitecture # Per-Sample Bottleneck The paper proposes two architectures. Since they share the main idea, I\u0026rsquo;ll introduce the first one, the Per-Sample Bottleneck. First, the model is split into two parts, \u0026ldquo;net-\u0026rdquo; and \u0026ldquo;-work\u0026rdquo; in the figure. R is the features obtained after the input passes through the front half. α is a trainable mask. λ is the result of applying the sigmoid function to α, and ε is noise drawn from a Gaussian distribution. Z is a weighted average of R and the noise, weighted by λ according to the mask.\nThe core idea is to add noise to the features, using the mask to control which positions are replaced with noise, and then feed the noisy features into the back half to get the output. We learn the mask with the Information Bottleneck objective, so that it finds which positions can be replaced with noise without affecting the final prediction. Finally, α gives us the heatmap for the image.\nResults # Figure 8 from reference 1 Figure 4 from reference 2 Besides the paper\u0026rsquo;s own results, I\u0026rsquo;ve added results on medical images. Overall, compared with the familiar Grad-CAM, Grad-CAM more often highlights unimportant regions and its results tend to blur together, and the same problem appears in the medical imaging examples. Still, neither visualization methods nor models are perfect, so use them with care.\nConclusion # This article introduced the paper as simply and intuitively as possible, covering:\nThe Information Bottleneck How the Information Bottleneck can be applied to visualization The idea can be applied to other problems and needs too, such as the compression mentioned above. The authors of this paper approached it from visualization and the structure of classification models, designed a method around the concept, and achieved good results.\nReferences # Karl Schulz, Leon Sixt, Federico Tombari, \u0026amp; Tim Landgraf (2020). Restricting the Flow: Information Bottlenecks for Attribution. In International Conference on Learning Representations. Demir, Ugur, et al. \u0026ldquo;Information bottleneck attribution for visual explanations of diagnosis and prognosis.\u0026rdquo; Machine Learning in Medical Imaging: 12th International Workshop, MLMI 2021, Held in Conjunction with MICCAI 2021, Strasbourg, France, September 27, 2021, Proceedings 12. Springer International Publishing, 2021. Naftali Tishby, Fernando C Pereira, and William Bialek. The information bottleneck method. arXiv preprint physics/0004057, 2000. ","date":"30 September 2023","externalUrl":null,"permalink":"/posts/information-bottleneck/","section":"Writing","summary":"Unlike gradient-based methods such as Grad-CAM, the Information Bottleneck finds the regions of an image a model actually needs.","title":"Information Bottleneck: visual, interpretable explanations for classification models","type":"posts"},{"content":"I am Yenjia Chen (陳彥嘉), a Ph.D. student in the Data Science Degree Program at National Taiwan University. My research interests span deep learning, medical AI, data science, and mathematics, with an interest in applications to medical image analysis.\nEducation Ph.D. student, Data Science Degree Program\nNational Taiwan University · September 2023–present\nDirect-entry doctoral program M.S., Data Science Degree Program\nNational Taiwan University · September 2021–June 2023 B.S., Mathematics\nNational Taiwan Normal University · September 2017–June 2020\nGraduated early International research experience Visiting research, Erasmus Medical Center\nRotterdam, the Netherlands · July 2026\nCollaborated with the Department of Radiology and Nuclear Medicine on external validation of a CT-based pancreatic cancer AI model, including image quality control and review of model errors with radiologists. UCTS summer research exchange, University of Chicago\nChicago, United States · June–August 2025\nParticipated as a visiting student in the UChicago–Taiwan summer research exchange. Earlier research NCTS Undergraduate Research Program\nOctober 2020–June 2021\nMathematical models for noise reduction in ancient paintings. NCTS Undergraduate Summer Research Program\nJuly–August 2020\nMathematical modelling and data prediction for infectious disease transmission and COVID-19. Teaching \u0026amp; academic activities Workshop speaker, Asia-Pacific Medical Students’ Symposium · June 2024 Instructor, AI4Kids AI in Healthcare Project Camps · 2022–2024 Teaching assistant, Image Processing and Analysis (I) · February–June 2021 NCTS Student Workshop on Scientific Computing · April 2023 11th Japan–Taiwan Joint Workshop for Young Scholars in Applied Mathematics · March 2021 Publications My publications span medical imaging AI and mathematical modelling. View the publication list, including journal articles, a conference abstract, preprints, and an accepted article in The Lancet Digital Health.\nContact CV · Email · GitHub · Google Scholar · Discord\n","externalUrl":null,"permalink":"/about/","section":"Yenjia Chen","summary":"","title":"About","type":"page"},{"content":"","externalUrl":null,"permalink":"/cv/","section":"Yenjia Chen","summary":"","title":"CV","type":"page"},{"content":"My research publications in medical imaging AI and mathematical modelling.\nAccepted manuscripts1 Accepted Co-first author AI-enabled Computed Tomography for Opportunistic Detection of Ovarian Cancer: A Nationwide Study In Taiwan With External Validation in the United States The Lancet Digital Health\nGigin Lin*\u0026#43;, Yenjia Chen\u0026#43;, Yu-Fu Wu, Hsin-Ying Lu, An-Yu Zhuang, Yu-Wen Wang, Yu-Chun Lin, Hsin-Ju Chiang, Yen-Ling Huang, Yenpo Lin, Ren-Chin Wu, Elie J. Najem, Atul B. Shinagare, Chyong-Huey Lai, Lan-Yan Yang, Weichung Wang*.\n+ Co-first authors* Corresponding authors\nCopy BibTeX Journal articles2 Journal article 2026 Pancreatic cancer diagnosis on unenhanced CT with deep learning for opportunistic diagnosis Radiology Advances · 3(2), umag017\nPo-Ting Chen, Dawei Chang, Yenjia Chen, Pochuan Wang, Andre Yanchen Yeh, Kao-Lang Liu, Ming-Shiang Wu, Wei-Chih Liao, Weichung Wang.\nDOI: 10.1093/radadv/umag017 ↗Copy BibTeX Journal article 2026 Artificial intelligence for early detection of pancreatic cancer in prediagnostic and diagnostic computed tomography examinations: A multicenter retrospective case-control study Diagnostic and Interventional Imaging · 107(7–8), 265–275\nAndre Yanchen Yeh, Dawei Chang, Pochuan Wang, Yenjia Chen, Kao-Lang Liu, Holger Roth, Hsu-Heng Yen, David Yen-Ting Chen, Po-Ting Chen, Wei-Chih Liao, Weichung Wang.\nDOI: 10.1016/j.diii.2026.01.007 ↗Copy BibTeX Conference abstracts1 Conference abstract 2026 First author Deep Learning-Based Denoising for Ultra-Low-Dose Molecular Breast Imaging Journal of Nuclear Medicine · 67 (Supplement 1), 261712 · SNMMI Annual Meeting\nYenjia Chen, Weichung Wang, James Hugg, Bradley Patt, Chin-tu Chen, Chien-min Kao.\nAbstract ↗Copy BibTeX Preprints2 Preprint 2022 Data Forecasts of the Epidemic COVID-19 by Deterministic and Stochastic Time-Dependent Models arXiv · 2209.02880\nBo-Sheng Chen, Zong-Ying Wu, Yen-Jia Chen, Jann-Long Chern.\narXiv: 2209.02880 ↗Copy BibTeX Preprint 2020 The Data Forecast in COVID-19 Model with Applications to US, South Korea, Brazil, India, Russia and Italy arXiv · 2011.04738\nBo-Cyuan Lin, Yen-Jia Chen, Yi-Cheng Hung, Chun-sheng Chen, Han-Chun Wang, Jann-Long Chern.\narXiv: 2011.04738 ↗Copy BibTeX ","externalUrl":null,"permalink":"/publications/","section":"Yenjia Chen","summary":"","title":"Publications","type":"page"}]