<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts | Shunyang Wang</title><link>https://shunyang.xyz/posts/</link><atom:link href="https://shunyang.xyz/posts/index.xml" rel="self" type="application/rss+xml"/><description>Posts</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Sun, 07 Jun 2026 00:00:00 +0000</lastBuildDate><image><url>https://shunyang.xyz/media/icon_hua2ec155b4296a9c9791d015323e16eb5_11927_512x512_fill_lanczos_center_3.png</url><title>Posts</title><link>https://shunyang.xyz/posts/</link></image><item><title>How to Automate the Last Mile in the Lab</title><link>https://shunyang.xyz/posts/automating-the-last-mile-in-the-lab/</link><pubDate>Sun, 07 Jun 2026 00:00:00 +0000</pubDate><guid>https://shunyang.xyz/posts/automating-the-last-mile-in-the-lab/</guid><description>&lt;p>Orchestration, lab informatics systems such as LIMS and ELNs, liquid handlers, and robotic arms are hot topics in lab automation. Recent examples include &lt;a href="https://doi.org/10.1038/s41586-023-06792-0" target="_blank" rel="noopener">Coscientist&lt;/a>, which connected a large language model with laboratory tools, and &lt;a href="https://doi.org/10.1038/s41586-023-06734-w" target="_blank" rel="noopener">A-Lab&lt;/a>, which connected machine learning, robotics, and material characterization. OpenAI and Ginkgo Bioworks also recently used GPT-5 with a cloud lab to run closed-loop experiments for &lt;a href="https://openai.com/index/gpt-5-lowers-protein-synthesis-cost/" target="_blank" rel="noopener">cell-free protein synthesis&lt;/a>.&lt;/p>
&lt;p>These systems can automate experiments and speed up the testing and validation of ideas. However, they can also be expensive and time-consuming to build. Today, they are often better at replacing repeated operations than replacing the daily scientific decisions made by scientists. Even in the OpenAI and Ginkgo study, human oversight was still needed for protocol improvements and reagent handling.&lt;/p>
&lt;h2 id="what-is-the-last-mile-in-the-lab">What is the last mile in the lab?&lt;/h2>
&lt;p>There are also bottlenecks where a small investment can save a lot of valuable scientists&amp;rsquo; time, but a general solution may not fit. These projects may not support a new business by themselves. They often need highly specific optimization and close collaboration with scientists. I call this the last mile in lab automation: the small but essential steps between a working tool and an end-to-end scientific workflow.&lt;/p>
&lt;p>For example, identifying the structures of impurities or drug metabolites often requires evidence from LC-MS, MS/MS, NMR, and other experiments. MS alone may not identify the exact position of a modification or distinguish isomers, so scientists need to cross-check different data and do a large amount of manual annotation (&lt;a href="https://pubmed.ncbi.nlm.nih.gov/17405144/" target="_blank" rel="noopener">Prakash et al., 2007&lt;/a>).&lt;/p>
&lt;p>Another example is choosing liquid chromatography methods for purification. This can require method screening, analytical runs, and then preparative runs. Each round needs decisions and setup and can use a lot of samples, solvents, and other consumables. Published workflows also describe screening analytical conditions before scaling promising methods to preparative purification (&lt;a href="https://pubmed.ncbi.nlm.nih.gov/21122868/" target="_blank" rel="noopener">Font et al., 2011&lt;/a>). What if we can automate some of these experience- and knowledge-based decisions?&lt;/p>
&lt;h2 id="why-the-last-mile-remains-manual">Why the last mile remains manual&lt;/h2>
&lt;p>These last-mile tasks often remain manual because the work is spread across different instruments, file formats, and software. The person who understands the scientific question may not own the instruments or the data systems. The workflow may also change from one project to another and still needs validation.&lt;/p>
&lt;p>In the structure annotation example, evidence from different instruments needs to be connected before a scientist can make a decision. In the chromatography example, results from one screening run affect the setup of the next run. The difficult part is not always running the instrument. It is connecting the data, decisions, and next actions.&lt;/p>
&lt;p>
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img src="./last-mile-workflow.jpg" alt="A last-mile automation loop connecting a scientific question, an instrument, scattered data, a scientist&amp;amp;rsquo;s decision, and the next experiment." loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p>&lt;em>The last mile connects the scientific need, laboratory work, data, decisions, and the next experiment.&lt;/em>&lt;/p>
&lt;h2 id="find-the-real-bottleneck">Find the real bottleneck&lt;/h2>
&lt;p>Finding the real bottleneck is why we automate the last mile. We are here to help scientists reduce the problems that take the most time and effort, not to force a top-down automation plan across the whole lab. This also gives us the advantage of working closely with scientists, understanding their real needs, and getting them fully involved in the project.&lt;/p>
&lt;h2 id="learnings">Learnings&lt;/h2>
&lt;p>Through my work, I have had the advantage of working closely with scientists from different parts of the drug discovery life cycle and with very different backgrounds. These are the lessons that I found general enough across projects.&lt;/p>
&lt;h3 id="you-need-to-win-the-trust">You need to win the trust&lt;/h3>
&lt;p>We are in a new period of automation, and no one has all the answers. The old methods are already validated, robust, and familiar to scientists. We need to get scientists on board by winning their trust.&lt;/p>
&lt;p>We should start small and always provide verifiable results. This does not mean that we cannot talk about the big picture, but we should plan in phases. When we reach each milestone, we gain more trust and move closer to the big picture. Do not think that starting small is a waste of talent. During this process, we can build the infrastructure, identify barriers, and change direction more easily. We can also show what we are capable of and where the limits of automation are. This will help with future collaborations.&lt;/p>
&lt;h3 id="get-a-prototype-as-soon-as-possible">Get a prototype as soon as possible&lt;/h3>
&lt;p>You and your collaborators may come from very different backgrounds. Sometimes, after a long discussion, both sides still understand the problem differently. It can feel like you are talking past each other. In this case, an early prototype can help communication.&lt;/p>
&lt;ol>
&lt;li>Scientists may not be fully clear about what they need. A hands-on demo can help them clarify the request.&lt;/li>
&lt;li>They will have a better understanding of the complexity.&lt;/li>
&lt;li>A quick prototype can prevent you from building too much before collaborators ask to start over.&lt;/li>
&lt;/ol>
&lt;p>This is a bitter lesson I have learned more than once.&lt;/p>
&lt;h3 id="save-as-much-useful-data-as-possible">Save as much useful data as possible&lt;/h3>
&lt;p>As a machine learning scientist working in lab automation, one of my most common and time-consuming problems is data. Why do we not collect data intentionally while building new tools?&lt;/p>
&lt;p>A mass spectrometry database built for spectral matching can also save method information and retention times, even if they are not needed at first. These data may later support retention time prediction, while the method information can help define how transferable a model is.&lt;/p>
&lt;p>We should also help guide data collection and point out missing data that may be useful later. For example, if a model shows that changes in the environment over time are more important than a few separate readings, we can start collecting more time points for cell culture.&lt;/p>
&lt;h3 id="separate-models-from-complex-tasks">Separate models from complex tasks&lt;/h3>
&lt;p>I will discuss this more in another article. Briefly, we should build the system in modules and define the scope of the current model. What are its inputs and outputs? How does it fit into future steps? Saying no to a request because it is outside the current scope can make the discussion much easier.&lt;/p>
&lt;h3 id="leave-extendable-plugins-for-the-future">Leave extendable plugins for the future&lt;/h3>
&lt;p>Based on the last lesson, we should also think about future extensions. This includes plugin design, database schemas, model transferability, and new modalities. For example, a workflow built for small molecules may reuse the same pipelines and experiment setup for peptides while changing the machine learning model in the backend.&lt;/p>
&lt;h2 id="closing-thoughts">Closing thoughts&lt;/h2>
&lt;p>The last mile may not look as exciting as a fully automated lab. However, these small and highly specific improvements can remove real bottlenecks from scientists&amp;rsquo; daily work. Large companies and startups may first capture the low-hanging fruit and the most profitable parts of lab automation. The real challenge of last-mile automation starts after that. These problems are highly specific to each organization and depend heavily on internal collaboration and development. This is why the practical approach described above matters: start from scientists&amp;rsquo; needs, keep the big picture in mind, and move toward it in small steps. Small results help build trust, prototypes help us learn, and useful data supports the next steps.&lt;/p></description></item><item><title>A Chemist's Notes on Agentic Coding using Claude</title><link>https://shunyang.xyz/posts/llm_learning_notes/</link><pubDate>Mon, 25 May 2026 00:00:00 +0000</pubDate><guid>https://shunyang.xyz/posts/llm_learning_notes/</guid><description>&lt;blockquote>
&lt;p>&lt;em>Six weeks of token usage, in numbers.&lt;/em>
&lt;em>I&amp;rsquo;m a slow adopter. This is what catching up looks like.&lt;/em>&lt;/p>
&lt;/blockquote>
&lt;hr>
&lt;h2 id="where-i-started">Where I started&lt;/h2>
&lt;p>I&amp;rsquo;m a computational chemist at a pharma. I write code, but I&amp;rsquo;m slow to pick up new tools. This time I want that to change.&lt;/p>
&lt;p>The timeline:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>GPT era (late 2022 – mid 2023):&lt;/strong> I thought it was an ads event. Overpresented, underdelivering.&lt;/li>
&lt;li>&lt;strong>Mid 2023:&lt;/strong> Tried coding with it. Copy-paste from chat to IDE, paste back, ran it. Treated it like a slightly faster Stack Overflow.&lt;/li>
&lt;li>&lt;strong>Mid 2024 – early 2025:&lt;/strong> Started using LLMs for information search instead of Google. The switch was about a year behind when I should have made it.&lt;/li>
&lt;li>&lt;strong>Through 2025:&lt;/strong> Started reviewing what it wrote, line by line. Caught some things, missed others. Trust grew slowly.&lt;/li>
&lt;li>&lt;strong>Spring 2026 (now):&lt;/strong> Letting an agent take over most of the code-writing for a dozen active projects. Reviewing diffs, not lines. Weekly load grew about 12× in five weeks.&lt;/li>
&lt;/ul>
&lt;p>This essay is what a slow adopter looks like when the thing finally clicks.&lt;/p>
&lt;hr>
&lt;h2 id="why-i-care-about-token-usage">Why I care about token usage&lt;/h2>
&lt;p>It is obviously wrong to optimize for maximum tokens, but as a beginner I realized token use is a decent proxy for how familiar I am with the tool.&lt;/p>
&lt;p>More tokens per task usually means fewer back-and-forth turns, more self-evaluation, and more iteration. It pushed me to think about better harnessing and how to interact with the agent like a code reviewer.&lt;/p>
&lt;p>Through this journey, I learned how to set up tools, skills, and memories.&lt;/p>
&lt;hr>
&lt;h2 id="what-the-numbers-say">What the numbers say&lt;/h2>
&lt;p>Weekly volume, normalized to week 1 (laptop + cluster combined):&lt;/p>
&lt;p>
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img src="./weekly_load.png" alt="Weekly load (fold change vs W1), with the unlock that drove each week" loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p>The eye goes to the spike on the right — week 5 was about &lt;strong>12× week 1&lt;/strong>. But the more interesting number is hidden in weeks 3 and 4: load stayed level &lt;em>while requests dropped&lt;/em> (3,167 → 1,719). I wasn&amp;rsquo;t running more turns. I was running heavier ones.&lt;/p>
&lt;p>
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img src="./tokens_per_request.png" alt="Tokens per request — content per call kept rising" loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p>86K → 216K is a &lt;strong>2.5× fold change&lt;/strong> in payload per call. Output tokens per call grew 1.5× over the same window (512 → 778). Much denser sessions.&lt;/p>
&lt;p>What&amp;rsquo;s more, I slowly moved all work from my laptop to the cluster — long-running sessions under tmux or Zellij, with a sandbox where the agent could run autonomously without me re-approving every command.&lt;/p>
&lt;hr>
&lt;h2 id="six-weeks-six-unlocks">Six weeks, six unlocks&lt;/h2>
&lt;p>&lt;strong>W1&lt;/strong> — 186M tokens · 2,164 requests&lt;/p>
&lt;p>First cluster sessions. First three skill templates landed: experiment runs, cluster submission, PR descriptions. Earliest memory rules: file scope (don&amp;rsquo;t touch other users&amp;rsquo; code), review-figures-before-commit. The unlock was vocabulary — naming the rules the agent would follow.&lt;/p>
&lt;p>&lt;strong>W2&lt;/strong> — 544M tokens · 3,551 requests&lt;/p>
&lt;p>First two project repos shipped. No new infrastructure — pure use of W1 scaffolding. 3× the token volume of W1; the unlock was just committing to real projects.&lt;/p>
&lt;p>&lt;strong>W3&lt;/strong> — 382M tokens · 3,167 requests&lt;/p>
&lt;p>&amp;ldquo;No login-node abuse&amp;rdquo; memory written after a long BFS scan slowed the host. Slurm cluster reference memory added.&lt;/p>
&lt;p>&lt;strong>W4&lt;/strong> — 362M tokens · 1,719 requests&lt;/p>
&lt;p>Heavy iteration on existing projects. Set up repos and READMEs so projects could reference each other.&lt;/p>
&lt;p>&lt;strong>W5&lt;/strong> — 1,762M tokens · 8,168 requests&lt;/p>
&lt;p>Six new project repos shipped first commits in five days. First skill promotions — a job-resume skill and a figure-review skill, both graduated from feedback memories that kept firing. First three hooks landed: a Stop-event lint, a Stop-event commit-recommend, and a PreToolUse pre-commit hook that blocks &lt;code>git commit&lt;/code> when the staged diff touches numerical logic until the math is articulated in the message body. Multiagent workloads also drove the usage spike. The unlock was compounding — projects, skills, and hooks all landed the same week because the spine made each one cheap.&lt;/p>
&lt;p>&lt;strong>W6&lt;/strong> — 1,094M tokens · 5,063 requests&lt;/p>
&lt;p>Tightening week. Two new PreToolUse hooks finally landed: a Slurm-submission validator and a login-node-abuse blocker (promoted from the W3 memory to a skill). Four new diagnostic skills — status dashboards across projects, cluster shortcuts. Eleven new memory rules, most of them workflow tightenings after I ran the built-in &lt;code>/insights&lt;/code> command.&lt;/p>
&lt;p>Each week added something the next week built on. None of it was strategic — each piece came from a specific friction in the prior week that I got tired of.&lt;/p>
&lt;hr>
&lt;h2 id="what-changed">What changed&lt;/h2>
&lt;p>In the order I learned them. Not all stuck the first time.&lt;/p>
&lt;h3 id="1-build-infrastructure-before-features">1. Build infrastructure before features&lt;/h3>
&lt;p>Weeks 1–2 were 80% project work. By week 5 it was the inverse — and that&amp;rsquo;s when output went up. Hooks, memories, skills, scaffolding compound. New projects start at week-5 productivity.&lt;/p>
&lt;h3 id="2-solve-permissions-once">2. Solve permissions once&lt;/h3>
&lt;p>Every &amp;ldquo;do you want to run this?&amp;rdquo; is friction. The project&amp;rsquo;s permissions config ended up with &lt;strong>91 shell allowlist entries&lt;/strong> and &lt;strong>17 file-access entries&lt;/strong>. Plus a deny list covering 8 sibling user directories so I can&amp;rsquo;t edit colleagues&amp;rsquo; code by accident. Most operations now run without a prompt. Sandbox or running in a container is a better option, but both are limited by available resources.&lt;/p>
&lt;h3 id="3-solve-the-boring-plumbing">3. Solve the boring plumbing&lt;/h3>
&lt;p>Set up the cluster submission path so a sandboxed compute environment could submit jobs without a shared filesystem. Remote VS Code pointed at GPU nodes. Job logs streamed back to my laptop without manual &lt;code>rsync&lt;/code>. Each one removes ~5 minutes of friction × dozens of times per day.&lt;/p>
&lt;h3 id="4-ask-the-agent-to-ask-me-questions">4. Ask the agent to ask me questions&lt;/h3>
&lt;blockquote>
&lt;p>&lt;em>&amp;ldquo;Ask me three clarifying questions before you start.&amp;rdquo;&lt;/em>&lt;/p>
&lt;/blockquote>
&lt;p>Highest-impact line I added to my prompts. Half the time the questions made me realize I didn&amp;rsquo;t know what I wanted.&lt;/p>
&lt;h3 id="5-plan-before-execute">5. Plan before execute&lt;/h3>
&lt;p>Plan mode. Reviewable artifact before any code is written. Saves the revert-and-retry cycle.&lt;/p>
&lt;h3 id="6-write-memories-with-reasoning-not-just-rules">6. Write memories with reasoning, not just rules&lt;/h3>
&lt;p>Every memory file has a &lt;code>Why:&lt;/code> line and a &lt;code>How to apply:&lt;/code> line. The agent learns the rule&amp;rsquo;s &lt;em>boundary&lt;/em>, not just the rule. Memories that say &amp;ldquo;do X&amp;rdquo; without saying why decay; memories that say &amp;ldquo;do X &lt;em>because&lt;/em> Y last quarter&amp;rdquo; survive.&lt;/p>
&lt;h3 id="7-promote-memories-to-skills-when-they-keep-firing">7. Promote memories to skills when they keep firing&lt;/h3>
&lt;p>A &amp;ldquo;resume the partial job, don&amp;rsquo;t re-run from scratch&amp;rdquo; memory became a &lt;code>/resume-job&lt;/code> invocable skill after the same procedure ran three times. Memory layer compounds &lt;em>through promotion&lt;/em> — not just by accumulation.&lt;/p>
&lt;h3 id="8-let-projects-talk">8. Let projects talk&lt;/h3>
&lt;p>One project consumes utility tools written in another. A third will feed its outputs back as priors into the first. The portfolio isn&amp;rsquo;t 12 independent projects — it&amp;rsquo;s a graph. Each project&amp;rsquo;s outputs become another&amp;rsquo;s inputs.&lt;/p>
&lt;h3 id="9-multiagent-for-parallel-branches">9. Multiagent for parallel branches&lt;/h3>
&lt;p>Background subagents for independent tasks (search this repo / draft this analysis / find this dataset). Subagent context shields the main session from large outputs. Three branches in flight without context contamination.&lt;/p>
&lt;hr>
&lt;h2 id="unexpected-side-effects">Unexpected side effects&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>&lt;strong>Negative results published in the repo.&lt;/strong> A full fine-tune on a published embedding model lost to a simpler baseline. Logged as &lt;code>Exp X.YZ NEGATIVE&lt;/code>, linked from the project&amp;rsquo;s manuscript. Failed runs that get &lt;em>committed&lt;/em> become next quarter&amp;rsquo;s prior, not buried compute.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Pre-commit quality gates.&lt;/strong> A hook that blocks &lt;code>git commit&lt;/code> when staged changes touch numerical logic, until I articulate the math in the commit body. Came after I caught the agent producing markdown with &lt;em>estimated&lt;/em> numbers that the actual data later contradicted by 50–100% per day. Wrong numbers don&amp;rsquo;t fail tests; they just ship. Now they fail commits instead.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Tracking my own learning.&lt;/strong> This essay exists. Tracking it makes the meta-improvements visible — like load-per-call rising while request count fell. Only see it if you look.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="infrastructure-inventory">Infrastructure inventory&lt;/h2>
&lt;p>&lt;em>As of May 2026:&lt;/em>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>25 memory files&lt;/strong> — autonomous-mode rules, cluster-resource defaults, scoring-API references&lt;/li>
&lt;li>&lt;strong>6 skills&lt;/strong> — domain-specific reasoning, cluster-submit, experiment-run, figure-review, resume-job, PR-description&lt;/li>
&lt;li>&lt;strong>3 hooks&lt;/strong> — numerical-review gate, cluster-job-ID capture, ruff lint&lt;/li>
&lt;li>&lt;strong>119 permission entries&lt;/strong> — 91 shell allowlist, 17 file-access, 11 deny rules (maybe there are smarter ways?)&lt;/li>
&lt;li>&lt;strong>36 documented patterns&lt;/strong> — from &amp;ldquo;Agent vs Pipeline&amp;rdquo; (#1) to &amp;ldquo;Memory→skill promotion&amp;rdquo; (#36)&lt;/li>
&lt;/ul>
&lt;p>
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img src="./active_projects.png" alt="Active project count over the 6 weeks" loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p>The portfolio plateaued at 12 once the infrastructure stopped being the bottleneck. Growth now is depth-per-project — one of the agents going Phase 1 → 6b in three days is what depth growth looks like when the spine is in place.&lt;/p>
&lt;hr>
&lt;h2 id="analogies-from-chemistry">Analogies from chemistry&lt;/h2>
&lt;p>&lt;strong>Reaction rate isn&amp;rsquo;t throughput.&lt;/strong> More turns per hour doesn&amp;rsquo;t help if half are clarifying questions. Spec quality is the rate-limiting step. So I ask the agent to ask me questions instead of letting it guess.&lt;/p>
&lt;p>&lt;strong>Catalysts beat reagents.&lt;/strong> A small piece of well-placed infrastructure accelerates everything downstream. A hook that blocks numerical commits costs nothing and prevents an entire failure mode.&lt;/p>
&lt;hr>
&lt;h2 id="for-a-chemist-starting-today">For a chemist starting today&lt;/h2>
&lt;ol>
&lt;li>One project. One &lt;code>CLAUDE.md&lt;/code>. One &lt;code>AGENTS.md&lt;/code>. Don&amp;rsquo;t scaffold for 12 on day one.&lt;/li>
&lt;li>Wait until you&amp;rsquo;ve corrected the agent on the same thing three times before writing the first memory. Earlier than that and the rules don&amp;rsquo;t generalize.&lt;/li>
&lt;li>Solve permissions early. Twenty allowlist entries on week one removes hundreds of prompts on week three.&lt;/li>
&lt;li>Tell the agent to ask you clarifying questions when you&amp;rsquo;re vague.&lt;/li>
&lt;li>Plan before execute.&lt;/li>
&lt;li>Track your weekly load. Mine grew 12× in five weeks; without a routine pull on usage telemetry I wouldn&amp;rsquo;t have noticed.&lt;/li>
&lt;/ol>
&lt;hr>
&lt;h2 id="whats-next">What&amp;rsquo;s next&lt;/h2>
&lt;p>Now I can easily use up my weekly quota, so I need to think about token efficiency.&lt;/p>
&lt;p>The thing that gets faster isn&amp;rsquo;t the adoption itself. It&amp;rsquo;s the time between &lt;em>seeing other people do it&lt;/em> and &lt;em>deciding to actually try it&lt;/em>.&lt;/p></description></item><item><title>Run a Free Local LLM and Share It with Your Family and Friends in 4 Hours</title><link>https://shunyang.xyz/posts/llm/</link><pubDate>Wed, 29 Jan 2025 00:00:00 +0000</pubDate><guid>https://shunyang.xyz/posts/llm/</guid><description>&lt;h2 id="introduction">Introduction&lt;/h2>
&lt;p>The release of the distilled DeepSeek-R1 model has revolutionized the field. I decided to build one locally, and to my surprise, the process was smoother than I expected. With the knowledge I had, I was able to deploy the model and allow my family to access it through ZeroTier. This tutorial will guide you through setting up a local DeepSeek-R1 model using Open WebUI, ZeroTier, and Docker on Windows with an NVIDIA RTX 3090. (According to my tests, an AMD Ryzen 5900X can also support basic functions, albeit with a response time of several minutes.) By following these steps, you&amp;rsquo;ll be able to run DeepSeek-R1 locally and share it with your family and friends over the network.&lt;/p>
&lt;p>Below is a comparison of DeepSeek-R1&amp;rsquo;s performance against other models in different benchmarks, highlighting its strengths in accuracy and efficiency:&lt;/p>
&lt;p>
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img src="https://ollama.com/assets/library/deepseek-r1/e44d096e-fa46-4cae-b2f2-53991e8c8da0" alt="Performance Comparison" loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p>With 24GB of memory, DeepSeek-R1:32B can achieve 90% of the performance of ChatGPT-O1. This makes it a powerful yet cost-effective alternative for local deployments, especially for users who need high accuracy but want to run models independently without relying on cloud-based solutions.&lt;/p>
&lt;h2 id="prerequisites">Prerequisites&lt;/h2>
&lt;p>Before proceeding, ensure you have the following:&lt;/p>
&lt;ul>
&lt;li>A Windows machine (Windows 10/11 recommended) with an NVIDIA RTX 3090 (You can opt for a smaller model if you have limited GPU memory.)&lt;/li>
&lt;li>Docker installed (&lt;a href="https://www.docker.com/get-started" target="_blank" rel="noopener">Download Docker&lt;/a>)&lt;/li>
&lt;li>NVIDIA GPU drivers and CUDA installed (&lt;a href="https://developer.nvidia.com/cuda-downloads" target="_blank" rel="noopener">Download CUDA&lt;/a>)&lt;/li>
&lt;li>Docker CUDA Container (&lt;a href="https://hub.docker.com/r/nvidia/cuda" target="_blank" rel="noopener">NVIDIA Docker CUDA&lt;/a>)&lt;/li>
&lt;/ul>
&lt;h2 id="step-1-install-and-configure-open-webui-1-hour">Step 1: Install and Configure Open WebUI (1 hour)&lt;/h2>
&lt;p>Open WebUI is a user-friendly interface for interacting with local LLMs.&lt;/p>
&lt;ol>
&lt;li>Run Open WebUI with Docker using GPU support:
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">docker run --user&lt;span class="o">=&lt;/span>0:0 &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span>--env&lt;span class="o">=&lt;/span>&lt;span class="nv">USE_CUDA_DOCKER&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="nb">true&lt;/span> --env&lt;span class="o">=&lt;/span>&lt;span class="nv">USE_CUDA_DOCKER_VER&lt;/span>&lt;span class="o">=&lt;/span>cu121 &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span>--env&lt;span class="o">=&lt;/span>&lt;span class="nv">USE_EMBEDDING_MODEL_DOCKER&lt;/span>&lt;span class="o">=&lt;/span>sentence-transformers/all-MiniLM-L6-v2 &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span>--volume&lt;span class="o">=&lt;/span>open-webui:/app/backend/data --network&lt;span class="o">=&lt;/span>bridge --workdir&lt;span class="o">=&lt;/span>/app/backend &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span>-p 3000:8080 --runtime&lt;span class="o">=&lt;/span>nvidia -d ghcr.io/open-webui/open-webui:cuda
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ol>
&lt;h3 id="explanation-of-main-parameters">Explanation of Main Parameters&lt;/h3>
&lt;ul>
&lt;li>&lt;code>--runtime=nvidia&lt;/code>: Enables GPU acceleration for the container, allowing Open WebUI to leverage CUDA for faster performance.&lt;/li>
&lt;li>&lt;code>-p 3000:8080&lt;/code>: Maps port &lt;code>8080&lt;/code> inside the container to &lt;code>3000&lt;/code> on the host machine, allowing access via &lt;code>http://localhost:3000&lt;/code>.&lt;/li>
&lt;li>&lt;code>--volume=open-webui:/app/backend/data&lt;/code>: Ensures persistent storage for Open WebUI&amp;rsquo;s data, preventing loss after container restarts.&lt;/li>
&lt;li>&lt;code>--env=USE_CUDA_DOCKER=true&lt;/code>: Configures the container to use CUDA, enabling GPU acceleration for AI model execution.&lt;/li>
&lt;li>&lt;code>--env=USE_EMBEDDING_MODEL_DOCKER=sentence-transformers/all-MiniLM-L6-v2&lt;/code>: Specifies the embedding model to be used within the container.&lt;/li>
&lt;li>&lt;code>--network=bridge&lt;/code>: Sets the container to use a bridge network mode, allowing it to communicate with other services inside the same Docker network.&lt;/li>
&lt;li>&lt;code>-d&lt;/code>: Runs the container in detached mode, so it continues running in the background.&lt;/li>
&lt;/ul>
&lt;blockquote>
&lt;p>&lt;strong>Note:&lt;/strong> The &lt;code>--hostname&lt;/code> parameter is optional and generally not required unless you need to set a specific hostname inside the container.&lt;/p>
&lt;/blockquote>
&lt;h2 id="step-2-configure-open-webui-and-download-the-model-1-hour">Step 2: Configure Open WebUI and Download the Model (1 hour)&lt;/h2>
&lt;ol>
&lt;li>Open your browser and access Open WebUI at &lt;a href="http://localhost:3000" target="_blank" rel="noopener">http://localhost:3000&lt;/a>.&lt;/li>
&lt;li>Create and configure your login credentials.&lt;/li>
&lt;li>Pull the DeepSeek-R1:32B model within Open WebUI.
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img src="./webui_model.png" alt="Pull model" loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/li>
&lt;li>Test the model locally and monitor your CPU/GPU usage to ensure optimal performance.&lt;/li>
&lt;/ol>
&lt;h2 id="step-3-enable-remote-access-with-zerotier-40-minutes">Step 3: Enable Remote Access with ZeroTier (40 minutes)&lt;/h2>
&lt;p>ZeroTier enables secure remote access to your local setup, allowing your family and friends to connect. The free version supports up to 50 connected devices, making it ideal for personal and small-scale use.&lt;/p>
&lt;ol>
&lt;li>Download and install ZeroTier from &lt;a href="https://www.zerotier.com/" target="_blank" rel="noopener">ZeroTier’s website&lt;/a>.&lt;/li>
&lt;li>Create a ZeroTier account and set up a new network.&lt;/li>
&lt;li>Join the network from your Windows machine:
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">zerotier-cli join &amp;lt;network_id&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>Or, use the ZeroTier GUI to join the network, for both WebUI server and user computer. You need to repeat this every time having a new user device. (Mac, Windows, Pad, Phone&amp;hellip;)
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img src="./zerotier.png" alt="Join the network" loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/li>
&lt;li>Authorize your device in the ZeroTier web console.&lt;/li>
&lt;li>Retrieve your virtual IP address for remote access and share it with trusted users.&lt;/li>
&lt;li>Configure managed routes to properly map the ports through ZeroTier for external access.&lt;/li>
&lt;/ol>
&lt;h2 id="step-4-configure-windows-firewall-for-external-access-20-minutes">Step 4: Configure Windows Firewall for External Access (20 minutes)&lt;/h2>
&lt;p>To allow external access, configure the Windows firewall:&lt;/p>
&lt;ol>
&lt;li>Open Windows Defender Firewall.&lt;/li>
&lt;li>Navigate to &lt;strong>Advanced Settings&lt;/strong> &amp;gt; &lt;strong>Inbound Rules&lt;/strong>.&lt;/li>
&lt;li>Create a new rule to allow inbound traffic on the required port (e.g., 3000).&lt;/li>
&lt;li>Apply the rule and restart the system if needed.&lt;/li>
&lt;/ol>
&lt;h2 id="step-5-enjoy-your-local-llm-server-30-minutes">Step 5: Enjoy Your Local LLM Server (30 minutes)&lt;/h2>
&lt;p>With Open WebUI set up and ZeroTier configured, your local LLM model is now accessible over the network. Access the server using your ZeroTier-assigned IP and the configured port:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">http://&amp;lt;zerotier_ip&amp;gt;:3000
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Share this link with trusted users to allow them access to your local LLM without exposing it to the public internet. Add them as new users if needed.
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img src="./hello.png" alt="User Interface" loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;h2 id="troubleshooting-and-optimization">Troubleshooting and Optimization&lt;/h2>
&lt;h3 id="common-issues">Common Issues&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Docker not starting&lt;/strong>: Ensure virtualization is enabled in BIOS.&lt;/li>
&lt;li>&lt;strong>ZeroTier not connecting&lt;/strong>: Check firewall settings and authorize the device.&lt;/li>
&lt;li>&lt;strong>Slow performance&lt;/strong>: Ensure CUDA is correctly installed and the GPU is being utilized.&lt;/li>
&lt;/ul>
&lt;h3 id="performance-tuning">Performance Tuning&lt;/h3>
&lt;ul>
&lt;li>Allocate more resources to Docker if needed.&lt;/li>
&lt;li>Use a dedicated GPU like the RTX 3090 for faster inference.&lt;/li>
&lt;/ul>
&lt;h2 id="conclusion">Conclusion&lt;/h2>
&lt;p>You now have a fully functional local DeepSeek-R1 setup with Open WebUI, ZeroTier, and Docker on Windows. You can interact with the model via Open WebUI and even share it with your family and friends over the network using ZeroTier.&lt;/p>
&lt;p>For further improvements, consider integrating additional plugins or experimenting with different model configurations. Happy coding!&lt;/p></description></item></channel></rss>