More from Tiny struggles
How a LinkedIn Post Led Me to a Munich Basement with Millions of Euros Worth of Robotics Equipment My LinkedIn feed has become a stream of robotics content over the past few months. As someone diving deep into AI robotics after years in ML/AI/RL, I’ve been deliberately connecting with people pushing the boundaries of the field. So when Nicolas Keller’s post about Munich being “the world’s best place to build robots” appeared in my feed, it immediately got my attention. A bimanual manipulation hackathon in Munich, organized in just three weeks. How cool is that? Here’s what they promised: Hands-on with dual-cobot humanoid upper-body setups, 2 Franka Emika Pandas, 2 depth cameras, 1 rgb, RTX5090 in each station Teleoperation with Meta Quest VR headsets Contributing to the MINGA research paper (with co-author potential) Collaborating in Munich’s growing robotics ecosystem I had three weeks to apply, get accepted, and arrange travel during what turned out to be Oktoberfest (the Lederhosen on the robot in the picture should have been a hint! It just made the stay extra expensive). I have recently missed the LeRobot’s worldwide hackathon and wanted to jump on the opportunity. The prospect of 30+ dual-arm robot setups, high-end GPUs, industry mentors and meeting other people passionate about robotic manipulation made it a no-brainer decision for me. The hackathon experience Most hackathons are short and they only involve software. Hardware Hackathons are much more rare, especially where hardware is provided and high end. The organizers promised a lot - and I have to say that they over-delivered, even though they operated on a very short timeline! 3 weeks! The hackathon wasn’t perfect; we hit some technical issues with the provided codebase and the robot controllers.The lab space (KI Fabrik in the Deutsches Museum) was full of amazing robots, powerful workstations, and a 3D workshop, but it also had its downsides - it was hot, humid and you could get trapped there due to the limited number of keys! The schedule was focused on building: after one day of setup and tutorials, it was essentially “09:00–open ended — Building time” for six straight days. The main communication happened on Discord. The setup was industrial-grade: 30+ Franka Emika Panda dual-arm configurations for about 40 participants. Each setup came with Meta Quest headsets running custom teleoperation software. There was a full workshop with 3D printing capabilities for custom grippers. The compute power was serious—workstations with the latest hardware that most of us don’t have access to. The initial goal of the organizers was to attract local students (mostly from TUM), but the hackathon was just too attractive. The organizers ran the selection process based on a Typeform where you had to justify your presence (CV, motivation, experience) and the final mix of people contained: PhD researchers, startup founders, industry engineers, and ambitious students. There was a significant number of people who traveled from other countries. Everyone wanted to be there. Industry engagement and realistic use cases The real differentiator was the industry backing. BMW and Siemens provided realistic challenges to be solved, explained the details, provided physical materials and sponsored prizes. Additionally, there were helpful lectures and mentoring from Nvidia, Hugging Face LeRobot and KIT (a big German university). When Sunday’s final presentations came, BMW and Siemens employes showed up to judge the results personally. This wasn’t academic theory - teams were working on problems that companies actually need solved, with the decision-makers accessible throughout and present for the final outcomes. The main organizers were TUM and Poke & Wiggle. I was very impressed with both. TUM showed great support for students and entrepreneurship. Poke&Wiggle people pulled everything together from the technical side. They were staying late and even hosted some participants coming from abroad in their homes! They were testing their own software stack while building what they claimed would become the largest public bimanual manipulation dataset. My strategy & Learning Probably my favorite thing about this hackathon was that it was extremely collaborative. Yes, people tried to win, but I was able to learn both from my team as well as from others. Team formation & collaboration I came to the event without knowing anyone and needed to form a team. It was actually a pretty common experience, many people didn’t know who to pair with. I have been in setups like this before and that experience helped. To form a good team you want the best people, but also it’s really hard to assess people very quickly and people who seem great at the start might not be able to give the best performance. E.g. they might not be fully available, you might not get along very well, etc. So my strategy was to talk to most people, see how they think and how experienced they are. I was selecting for getting along, enthusiasm and general intelligence. It was less important to me that someone was inexperienced as long as they were energetic and open minded. We weren’t the most effective or best organized, but we really enjoyed our time together, made good progress and learned a lot. Our team also shifted a bit during the 7 days (one person got sick and we adopted another one). We used a WhatsApp group to share resources, set up a GitHub repo for shared scripts and shared some notes on a Google doc. Our strategy was as follows: get familiar with the teleoperation trying out all available tasks and assess the task feasibility for the human operators train and deploy the models ASAP to test the pipeline (yes, we detected bugs and further limitations) pursue the most promising tasks, refine the dataset collection and experiment with the models for good performance Learnings We didn’t manage to win any categories. I think that my group was more focused on learning and experimentation, instead of purely competing to win. Some takeaways: If the task can’t be done by the human, the robot won’t be able to do it Training loss during model training is not a good predictor of the real life performance Robot safety mechanisms were critical to avoid breaking the robot Evaluation in real life is risky and some simulation setup would be helpful End-effector control with inverse kinematics was often causing the robots to get stuck due to joint limits; it required special care during teleoperation for the demos so that the actual policy wouldn’t block the robot Two arms are much harder than one Dataset quality matters a lot (recovery examples, non-Markovian states are confusing, noise/operators in the setup) What we tested 3 different task setups with hundred+ demonstrations each variations in model training (steps, parameters, models, action space) and dataset selection (recovery episodes ratio, bad episodes) different control modes (delta and absolute) we could only try actions in the EE space, the joint space controllers weren’t working correctly SMOLVLA and ACT models from Lerobot libraries performed experiments for generalization and resilience (e.g. messing with cameras was making robots much less effective) we also visualized attention maps for the ACT Models Here is an example of an attention map: (Kudos to physical AI Interpretability Repo - the author was there during the event and helped us a bit with the setup). Misc I got a pretty good feel for teleoperation in VR (it’s hard though!) I managed to get the arms to crash with each other and got my robots stuck countless times I spent some time setting up a simulation environment with Panda in MuJoCo and playing with Isaac Sim (approach abandoned in the end) I read several papers recommended by other participants I wasn’t able to try Pi0/Pi0.5 as the ready snapshots are for the same type of robot (Panda), but in a very different action space and we didn’t have time/resources for fine-tuning from scratch (80GB+ GPU memory required) What I wished I could do: try out Groot / Pi0.5 simulation, sim-to-real, and RL fine-tuning for the trained VLA (a simple VLA would be perfect!) Posts describing the experiences of some of my teammates: @Artur and @Andrea. We Need More of This After seven days of intense collaboration in a basement, we didn’t revolutionize the future of robotics, but we all learned a lot and everyone came back home more experienced and inspired. It was a great event! And I want to see more events like this in Europe, because the future of robotics doesn’t have to happen in SFO (or China) Europe has the ingredients for world-class robotics innovation. We have strong engineering talent and strong reasons to invest (aging population)! I live in Poland now, a place that produces some of the world’s best software engineers, but the innovation is lacking. I talked to two universities in Warsaw and they don’t really innovate or even follow the current state of the art yet for embodied intelligence. And it’s a shame, because with libraries such as LeRobot, open hardware, and open-source simulation engines, the space is now much more accessible. I was very impressed with TUM and many of the students. I would like to support the ecosystem in Poland and Europe. Munich proved it’s possible. Let me know if you would like to help! Next steps I left the event pretty drained, but also very excited! JI am still following up on the various threads I started during the hackathon. I also started to look at another exciting challenge that is focused on household tasks in the simulation. Currently I’m especially interested in the approaches combining VLAs with RL, like the ones outlined in the SimpleVLA paper and would love to participate in more hardware hackathons, ideally combining simulation and real world learning.
Part 1 of a series on practical robotics experimentation As part of my journey into robotics, I found myself facing a classic problem: I wanted to experiment with different learning approaches for robotic manipulation, but I needed a flexible playground where I could quickly test ideas without being locked into any single framework or workflow. The result is gym-so100-c, a simulation environment built around the Standard Open Arm SO101 that bridges multiple machine learning libraries—Stable-Baselines3, the imitation library, and Hugging Face’s LeRobot—all in one cohesive environment. The “Sim-First” Decision Even though I had access to physical robots, I chose a sim-first approach for a simple reason: I’m more of a software person who enjoys the comfort of my home office and the flexibility to keep working while traveling, rather than spending long days in a lab. This decision shaped everything about the project. I needed a simulation that was: Physically realistic enough to eventually transfer to hardware Fast enough for thousands of training episodes Flexible enough to work with different learning paradigms Simple enough that I could understand and modify every component Why Build Another Gym Environment? You might wonder: why not just use an existing simulation? I wanted something both flexible and reflecting my hardware platform well in simulation. The robotics world offers many compelling options. The Simulation Landscape I Considered: Isaac Sim was tempting—NVIDIA’s powerhouse with photorealistic rendering and advanced physics. But it requires a proper GPU setup, and I wanted to start experimenting immediately rather than waiting for hardware upgrades. ManiSkill is an exciting newer option with great task diversity and modern ML integration. I’m actually quite excited to try this next—it seems to hit the sweet spot of realism and ease of use. Gazebo/ROS represents the traditional robotics stack: mature, well-supported, with endless plugins. But the learning curve felt steep for someone coming from a pure ML background, and I wanted to focus on learning algorithms rather than robotics middleware. PyBullet similar to MuJoCo. Also popular in RL enviornments. Why I Chose MuJoCo + gym-aloha:The answer came down to immediate productivity. I could adapt gym-aloha and start experimenting within days, not weeks. It’s proven in the papers I was trying to replicate, has excellent contact modeling for manipulation, and enjoys a large ecosystem of compatible tools. The Gym Interface Standard:OpenAI Gym (now Gymnasium) defines a standard interface that every reinforcement learning environment implements: obs, info = env.reset() # Start a new episodeobs, reward, terminated, truncated, info = env.step(action) # Take an action This simple interface is incredibly powerful because it means the same environment can work with: RL libraries like Stable-Baselines3 (SAC, PPO, HER…) Imitation learning libraries like imitation Custom training loops or evaluation pipelines Any future framework that follows the standard The Evolution Plan:This environment is just the beginning. As I move toward more realistic scenarios, I’ll likely migrate to Isaac Sim or ManiSkill. But for rapid prototyping and algorithm comparison, this MuJoCo setup has been perfect. Key insight: There are many good options. If your requirements are not very specific, look for something popular and that has something similar to what you need that you can quickly adapt. This flows naturally from the question and sets up the technical details that follow. Standing on the Shoulders of ALOHA Rather than building from scratch, I adapted the gym-aloha project, which implements the dual-arm ALOHA platform used in several influential imitation learning papers. The ALOHA Foundation:ALOHA (A Low-cost Open Hardware Arm) proved that effective manipulation learning was possible with relatively simple hardware. The gym-aloha implementation provided: MuJoCo physics foundation Well-designed observation and action spaces My Adaptation:I modified gym-aloha for a single SO101 arm (5-DOF + gripper) to match my hardware target: # Simple registration exampleregister( id="gym_so100/SO100CubeToBin-v0", entry_point="gym_so100.env:SO100Env", max_episode_steps=700, nondeterministic=True, kwargs={"obs_type": "so100_pixels_agent_pos", "task": "so100_cube_to_bin"},) Once registered, creating the environment is straightforward: import gym_so100 # triggers env registrationimport gymnasium as gymenv = gym.make("gym_so100/SO100CubeToBin-v0")obs, info = env.reset() The Task: Cube-to-Bin I focused on one fundamental manipulation task: bin-a-cube. A red cube starts at a random position on the table, and the goal is to place it inside a fixed gray bin. This task is deceptively simple but covers the core challenges of manipulation: Perception: Locating the cube and understanding spatial relationships Planning: Approaching the cube from a graspable angle Control: Executing smooth, coordinated motion Manipulation: Grasping, lifting, and precise placement The MuJoCo scene includes: Robot: SO101 single arm with position-controlled actuators Workspace: Table, free-moving cube, and goal bin Sensors: Joint positions, gripper state, and camera views Sites: Tracking points for reward computation and success detection Control Paradigms: Joint vs. End-Effector Space Following gym-aloha’s design, I implemented joint-space control where actions directly specify target joint positions: Aspect Joint-space control Action Target joint positions → data.ctrl Control loop Actuators drive joints toward commanded positions Learning Policy learns in robot’s natural DOF Transfer Direct mapping to real hardware I chose joint-space over end-effector control for cleaner transfer to my target hardware. While end-effector control (where you specify gripper poses and let MuJoCo’s constraints solve for joint angles) can be more intuitive, it adds complexity that I wanted to avoid initially. What’s Inside the Environment As of August 2025, gym-so100-c includes: Simulation Environment & Tasks: MuJoCo-based SO101 simulation environment Cube-to-bin task with configurable reward shaping Training Integration Scripts: Reinforcement learning with Stable-Baselines3 (SAC) Imitation learning with the imitation library Training integration with LeRobot (ACT, Diffusion, VLAs) Control & Data Collection: Teleoperation via keyboard or gamepad Episode recording for demonstration datasets Dataset conversion to LeRobot format Early Design Lessons Physics Engine Choice: MuJoCo was the obvious choice for its speed, stability, and excellent contact modeling. It works well on CPU, it was perfect on MacBook. I am excited about IsaacSIM, but I don’t have a powerful GPU yet. I am open to trying other engines in the future. Observation Space Design: I experimented with different observation combinations: pixels_agent_pos: Camera images + joint positions agent_pos: Joint positions only (for faster training) pixels: Camera images only (for vision-based policies) The mixed approach (pixels_agent_pos) worked best, giving policies both rich visual information and precise proprioceptive feedback.This is also what ACT paper and most SOTA approaches are using. Reward Engineering: In Reinforce Learning an agent collects rewards interacting with the environment and tries to maximize them. The trick is to make such rewards that the agent does what you want from it and also that it can learn pretty well. Shaping the reward structure (designing the incentives) is called Reward Engineering and it’s suprisingly tricky to get right! For example if you reward getting close to the block too much, the agent might chose to hover over it and never grab it. If you don’t give any rewards until the task is complete and if the task is too hard, there is no feedback to learn from. I implemented both sparse rewards (success/failure only) and dense rewards with approach shaping. Dense rewards proved much more reliable for learning, though they required more careful tuning. I also implememented HER (hindsight experience replay) that automates the reward shaping by trying to teach the robot behaviors from previous trajectories, but the results were mixed in my setup. The Integration Challenge The real value of this environment isn’t just the simulation — it’s the integration layer that lets me seamlessly move between different learning approaches. In the next post, I’ll dive into what I learned from training experiments with SAC, behavior cloning, and modern imitation learning methods. But the foundation was crucial: having a single environment that could work with multiple learning paradigms, generate consistent datasets, and provide reliable evaluation metrics. Sometimes the unglamorous infrastructure work is what makes everything else possible. Next up: Training experiments and what I learned about the practical differences between reinforcement learning and imitation learning approaches. What’s your experience with simulation environments for robotics? Have you found certain design decisions that made experimentation much easier or harder? I’d love to hear about it.
A deep dive into building an automated illustration pipeline for storytelling applications Introduction AI image generation has revolutionized creative workflows, but there’s a significant difference between generating a single stunning image and producing hundreds of consistent illustrations for a complete project. When building storylearner.app, we faced the challenge of generating book illustrations that maintained visual consistency while telling compelling stories through imagery. We’ve used powerful Gemini multimodal models, mostly because they are fast and because the experimental ones are available for free. This article explores the technical and creative challenges of large-scale AI illustration generation, showcasing techniques for achieving visual consistency and building robust pipelines that can handle the complexity of full book illustration projects. Below are images created for a chapter of a book adapted for the storylearner platform: The article has a companion colab notebook, so you can play with the examples yourself. The Consistency Challenge Understanding Visual Consistency in AI AI image generation models operate somewhat like a company of talented artists, each with amnesia. Every generation is essentially a fresh start unless you provide explicit context. This creates unique challenges when you need to maintain character consistency, style coherence, and narrative flow across hundreds of images. Consider this simple experiment: generating three images of “the same pig with wings and a top hat flying over a futuristic city” in different weather conditions. Even with identical prompts and seeds, subtle inconsistencies emerge—eye colors change, proportions shift, and the overall character can feel different. The Impact of Seeds and Prompts Seeds act like selecting a specific artist from your AI company. Using the same seed with identical prompts yields consistent results, but even small prompt variations can dramatically alter the output. We discovered that: Same model + same prompt + same seed = identical results Same model + same prompt + different seed = completely different character Same model + slightly altered prompt + same seed = often produces a different character entirely This sensitivity means that scaling up requires careful orchestration of all these variables. Building Consistency Through Reference Images The Reference Image Approach The most reliable method we found for maintaining character consistency involves using reference images. Here’s how it works: Generate an initial character/scene using carefully crafted prompts Upload this image as a reference for subsequent generations Include explicit instructions like “Use the supplied image as a reference for how the pig should look like” This approach significantly improves consistency, though it can also cause new issues in some very specific cases. With the following reference image: You can get this different, but consistent one! Here is an example of triggering a specific case: This specific case can happen when a prompt is pretty similar to the one that generated the initial image and the seed is identical.So, when using the reference image and similar prompt, I would actually recommend to change the seed or not set it. See the reference colab for details. Practical Implementation # Upload reference imagefiles = [client.files.upload(file="reference_character.png")]# Create parts with reference and promptparts = [ types.Part.from_uri( file_uri=files[0].uri, mime_type=files[0].mime_type, ), types.Part.from_text( text=prompt + "\nUse the supplied image as a reference for character appearance" ),]# Generate with referenceresponse = client.models.generate_content( model=IMAGE_MODEL, contents=parts, config=types.GenerateContentConfig( response_modalities=['Text', 'Image'], # No seed set. )) The Storylearner.app Illustration Pipeline High-Level Architecture Our production pipeline consists of three main stages: Idea Generation: Story text + guidelines → 3 illustration concepts per scene Idea Selection: Multiple concepts → best ideas chosen for the complete set Image Generation: Selected ideas + style guidelines + reference images → final illustrations Stage 1: Brainstorming Illustration Ideas Rather than feeding story text directly to image generation (which often produces poor results), we separate conceptualization from execution: class IdeaGenerator: def generate_illustration_ideas(self, text: str, context: str): prompt = """ You are a visual scene designer. Based on the story below, describe 3 different highly detailed and imaginative illustration ideas. Do not include any people or humanoid figures. Focus on setting, atmosphere, lighting, symbolic objects, and environmental storytelling. Story: {text} Context: {context} """ # Returns 3 detailed scene descriptions per text excerpt This approach generates rich, detailed scene descriptions that serve as blueprints for image generation. Stage 2: Intelligent Selection To avoid repetitive illustrations (like “a ship, a ship, a ship” in a sea voyage story), we use an AI selector to choose the best combination of ideas: class IllustrationSelector: def select_illustrations(self, chapter): prompt = """ Choose the best idea for each illustration considering that: - The set should be diverse - Illustrations shouldn't contain people - Prefer illustrations matching the provided titles """ # Returns optimal selection indices Stage 3: Consistent Generation The final generation stage uses: Style guidelines (detailed visual specifications) Reference images for style consistency Persistent chat sessions for maintaining context Retry mechanisms for handling API limitations Visual Guidelines and Style Consistency Crafting Effective Style Guidelines We developed comprehensive style guidelines that go beyond simple style names: Style: watercolorTechnique: Combine soft watercolor washes with fine ink line work for contrast and detail.Brushwork: Embrace visible brush strokes, blooming, and natural texture.Ink Lines: Use varied line weights for depth; apply cross-hatching or stippling for texture.Color Palette: Limit to a few harmonious hues with gentle gradations.Forms: Use simplified, geometric shapes; focus on essence over detail.White Space: Treat negative space as part of the composition.Texture: Highlight watercolor paper's natural texture and color variation.Atmosphere: Create light, airy scenes with openness and subtle contrast.Aesthetic: Preserve a hand-drawn look—embrace imperfections and human touch. Chat-Based Generation for Context Continuity Using persistent chat sessions helps maintain consistency within illustration sets: def generate_set_of_illustrations(ideas_with_file_paths, pass_image=True): chat = client.chats.create( model=IMAGE_MODEL, config=types.GenerateContentConfig(response_modalities=["Text", "Image"]), ) # Initialize with style guidelines and reference image initial_prompt = f""" You are a creative artist helping on an illustration project. Create {len(ideas_with_file_paths)} beautiful illustrations. VISUAL GUIDELINES: {VISUAL_GUIDELINES} """ # Generate each illustration within the same chat context for idea in ideas_with_file_paths: response = chat.send_message(format_illustration_prompt(idea)) # Process and save generated image Avoiding Common Pitfalls Critical Design Decisions Through extensive experimentation, we identified several key strategies: Avoid Human Close-ups: Character face consistency is extremely challenging. Focus on environmental storytelling instead. No Violence or Gore: Keep illustrations family-friendly and avoid content that might trigger safety filters. Diversify Scene Types: The selection stage prevents repetitive imagery across the complete set. Decouple Ideation from Generation: Separating concept creation from image generation improves both quality and debuggability. Real-World Example: Illustrating The Three Musketeers Let’s walk through illustrating a chapter from The Three Musketeers: Context and Settings First, we establish the story context: Setting: France, primarily Meung and Paris, early 17th centuryHistorical Context: Political tensions between French monarchy and Cardinal RichelieuMain Characters: D'Artagnan, Athos, Porthos, Aramis, Cardinal Richelieu, Milady de Winter Generated Ideas For the chapter opening, our system generated these concepts: “The Jolly Miller Inn Chaos”: Exterior scene with a yellow pony, scattered debris, and dramatic lighting hinting at recent altercation “Broken Sword”: Close-up of shattered steel on cobblestones, symbolizing lost honor and broken dreams “Inn Kitchen Aftermath”: Dimly lit interior with earthenware, bandages, and flickering candlelight Selection and Generation The selector chose the most diverse and narratively appropriate ideas, which were then generated using our reference image and style guidelines, producing illustrations that maintain visual consistency while telling the story effectively. Key Insights and Best Practices Consistency vs. Perfection: Perfect consistency isn’t always necessary—visual coherence in style and mood often matters more than exact character matching. The Artist Analogy: Think of AI models as artists with amnesia. You need to provide context, references, and clear instructions for each interaction. Pipeline Modularization: Breaking the process into idea generation, selection, and execution improves quality and maintainability. Style Guidelines Matter: Detailed, specific style descriptions work better than simple style names. Reference Images Are Crucial: Upload and reference style examples for best consistency results. Long Sessions are Fragile: It often works until a point, and at some point it fails poorly, e.g. inserting objects from a previous illustration into the following ones. Conclusion There is still a huge gap between a carefully handcrafted demo on an AI company blog and practical usage of the technology at scale. Things don’t work out well straight out of the box, but you can make these amazing tools work for you with help of systematic thinking about consistency, quality control, and robust engineering practices. While challenges remain, I hope you’ll enjoy the techniques we’ve developed at storylearner.app to power your own projects!
In this post I’ll walk through how I upgraded a set of tangled Python notebooks—responsible for thousands of LLM calls—into a robust content-adaptation studio powered by: an async FastAPI pipeline, a disk-first Next.js frontend, and a small suite of custom CLI tools. Re-engineering the stack was essential for my own sanity: the notebooks were fragile, slow to iterate on, and far too labor-intensive to babysit. I was also facing content quality challenges that were pretty much impossible to address in the old code base, that re-engineering unlocked. My hope is that the story also nudges you to build (or level-up) your own tooling instead of settling for one-off notebooks. We’ll cover: Engineering constraints – huge text volumes, strict meaning preservation, multiple target languages. The original notebook setup – what worked and where it hurt. Pain points – why small hacks no longer cut it. The new architecture – key design choices, novel elements (with screenshots), and how they solve the earlier pain. Outcomes & takeaways – higher quality, less toil, faster experiments, and patterns you can reuse in your own LLM workflows. Shape of the problem Shape of the problem: large quantities of text that need to be processed in a very specific way: retain meaning of the original (no text disappearing or altered significantly) consistent between parts translated & simplified resulting content needs to consistently have good quality automatic quality assessment and quality repair (revisions) A similar challenge would be relevant in translating legal documents, healthcare documents, etc. Story Learner Book Adaptation needs In my project StoryLearner I offer adapted books for language learning at a specific level. For example, “Las Aventuras de Sherlock Holmes, in A2, Spanish”. We use LLMs for both language/level adaptation as well as for illustrations.It’s a lot of LLM calls (easily thousands for a single book), because books are long and there are many elements for a single adaptation. A book has chapters, chapters have parts for easier reading. Each book/chapter/page has an custom illustration. Additionally, there are titles and descriptions to be adapted and transcribed. Books are long and we want the adapted text to retain the meaning, while making the language simple (aligned with the target level), natural sounding and correct. Trouble with a flaky, slow pipeline and hard to assess output The pipeline was was quite a feat! It was a lot of LLM calls, built mostly in colab/jupyter notebooks. RAW BOOK | v[book_stripping] | v[chapter_extraction] | v[chapter_simplification] (English) | v[chapter_partification] (English) | \ | \ | ---> [illustration_generation] | v[adapt] ──▶ [Lang 1] │ [Lang 2] │ [Lang 3] │ [Lang 4] │ [Lang 5] │ [Lang 6] | Illustration generation was on its own a pretty interesting pipeline (more about it in a separate post!). Here is one of the adaptation notebooks: As you can see, it has its own table of contents on the side. It’s easily thousands of lines of code and prompts. And the hundreds of outputs (text and images) could make it very, very, long. To the point that it would have rendering issues. On top of it there was: Separate notebook for book_narration Another notebook for upload to storylearner (via API). The “pipeline” worked. It serialized partial outputs in a way that partial redos/continuations were possible, it offered decent visualization. It was adjustable (just add/tweak a notebook cell!). However it was fragile and assessing quality/redoing content was painful and slow. And it was very frustrating to me, especially since the quality was important to my partners (language schools). Main pain points LLM reliability issues (no resources, surprise safety controls kicking in, running out of quota or LLMs not following instructions) broke downstream steps. The adaptation process was slow, it wasn’t taking advantage of paralellization well The pipeline was already so brittle enough that meaningful experiments were nearly impossible Colab/notebooks encouraged slapping things together instead of proper engineering with encapsulation and tests Python notebooks having rendering bugs because they were so long and had so many outputs (large text/many images) Low confidence in language level, name/format consistency, and preserved meaning without having a strict review/repair process and having some examples of problems with quality. Reviewing 60+ chapters across six languages was slow and manual - was infeasible for me. A copy of an adaptation notebook per book (for visualization/auditability) was duplicating the code and making it harder to maintain New Content Adaptation Tools I haven’t built everything at once. I started with a frontend using the existing disk format of book adaptations, then as it was easier to see what was going on, I progressively built more and more backend migrating specific functionalities. Fast API gives a nice UI out of the bat to call APIs, which was nice for trying things out. But the workflows were simply to long to drive them by hand, so that is how CLI tools came to be. CLIs/Frontend were in big part written by copilot coding agent. I also extensively discussed the component prompts with LLMs 😀. Backend – bookadaptation (FastAPI) all functionality behind endpoints, all async / internally parallel where safe (28 separate endpoints) All IO and LLM calls done async Pipeline stages are classes; 11 adapter subclasses (Gemini Flash, Gemini Pro, GPT-4o, etc.). skip and use_cached flags run a no-op or reuse artefacts while the file tree stays unchanged. STAGE_DEPENDENCIES mapping declares primary & secondary inputs and outputs for every stage. Hierarchical on-disk structure; files get a _{revision_number} suffix for multi-round outputs. Heavy use of controlled generation (using schemas) SQL instrumentation: All prompts, schemas, settings, outputs, latency, and errors logged to SQLite. Frontend – ContentTools (Next.js Server Components) Specialised views: Book language adaptations Illustrate all artefacts of the adaptation pipeline (inputs, outpus) Easy debugging of what happened during the QA Easy comparisons between experimental implementations “Final for publish” view. Illustrations: All book illustrations as grids (chapters, chapter parts) Illustration deep dives - ideas and the best ideas Reads JSON & WebP directly from disk—no extra HTTP hop. CLI tools (all async friendly python) adaptation CLI Adapts and revises every chapter until it’s good enough Drives the pipeline stages implemented in the service (many endpoints right) Gracefully retries LLM driven decisions: Uses output from the overall review to finish the chapter or go for more rounds or partially skip stages narration CLI illustration CLI publishing CLI Everything runs locally, but could as well run on a server. Yes, I ended up building a lightweight custom pipeline orchestration… 💀 Flow of a book adaptation with automatic QA (multiple revisions) RAW BOOK | v[book_stripping] | v[chapter_extraction] | v[chapter_simplification] (English) | v[chapter_partification] (English) | \ | \ | ---> [illustration_generation] | v[adapt] ──▶ [Lang 1] │ [Lang 2] │ [Lang 3] │ [Lang 4] │ [Lang 5] │ [Lang 6] | v[review_chapter] ←──────────────┐ | │ v │[revise_chapter] │ | │ v │[review_consistency] │ | │ v │[revise_consistency] │ | │ v │[review_meaning_cohesion] │ | │ v │[revise_meaning_cohesion] │ | │ v │[review_titles] │ | │ v │[revise_titles] │ | │ v │[review_chapter_title] │ | │ v │[revise_chapter_title] │ | │ v │[review_overall] ──────────────┘ | v [promote_content] | | +--> [book_narration] (from adapted text) | +--> [upload / publish] QA rounds are controlled by the output of the review_overall stage. Examples of frontend enabling fast QA Example of problematic images that can be ’easily spotted’ by a trained eye. Chapter level issues overview for an adaptation workflow: Part level debugging/review of what was suggested/applied in the QA pipeline: Review and Revision—kept deliberately apart One key design choice was to decouple “reviewer” from “reviser”. The reviewer node reads the necessary context and produces a structured list of issues,while the reviser node sees only the affected slice plus those suggestions. Why keep them separate? Audit clarity The reviewer’s JSON lives as its own artefact, so you can diff, grep, or hand-editthe feedback without touching the text itself. It’s also easier to audit automatic revisions and spot ‘additional helpfulness’. Smaller prompts, cheaper calls A reviser that operates on just the target part + suggestions uses far fewer tokensthan one that re-ingests the whole chapter. Less collateral damage Narrow context means the reviser can’t “helpfully” rewrite good paragraphs in other sections or even just completely forget them. True parallelism Parts are context-isolated, so multiple revisions can run concurrently—no giant chapter-wide lock. Targeted rollbacks If a revision introduces a new issue, it’s easy to rollback. What the flow looks like review_meaning_cohesion scans consistency_revised_stories and writes meaning_cohesion_review_1.json: { "issues": [ {{ "part_number": 1, "suggestion": "Change sentence '...sentence...' to '...corrected sentence...' to ensure consistency with previous parts.", "reason": "Inconsistent character name across parts.", "severity": "high" }}, ... ], } During the revise_meaning_cohesion stage, revisions to specific parts are applied concurrently, e.g. reviser for part 8 only sees the text of part 8 and the suggestions for part 8. Other novel elements Stable DAG via no-op nodes – skipping or caching never changes filenames or dependencies, so UI and controller logic stay simple. Declarative STAGE_DEPENDENCIES – each endpoint validates its own inputs and fails fast if artefacts are missing. Pluggable adapter subclasses – swapping models or prompt strategies is a config change, not a refactor. Direct-disk reading Server Side React Components – Suprisingly trivial frontend code. SQLite error forensics – a single query surfaces “prohibited-content” or other LLM failures. Hot-reload mid-run – tweak prompts or error handling while a 60-chapter fan-out is running; retries pick up the change without restart. WebP illustration storage – generated art compresses very well; files are roughly 10× smaller than raw outputs. LLM-driven controller decisions – the CLI uses the review_overall output to decide whether to launch another revision round and which stages to skip. Personal wins The biggest win is defending my personal sanity. I no longer have to babysit a set of fragile notebook based pipelines based on fallible and untrustworthy LLMs. Higher confidence in quality – every chapter passes level, consistency, meaning, and overall reviews—automatic multi-round fixes if needed. Far less toil – no more babysitting fragile notebooks; the pipeline self-checks and fails early. Fast, parallel experimentation – new adapters or prompts run side-by-side with hot-reload; iteration is “super fast and fun.” Cost flexibility – total spend is higher (as there are more LLM calls), but the modular design lets me fall back to cheaper or local models whenever I choose. And the cool thing is that building this tooling was heavily accelerated by a coding assistant/agent, so it was significantly faster and more fun than I would have expected from the scope of the reengineering.
More in technology
Having recently shot a roll of Kodak’s newly rebranded Kodacolor 100 film, I decided to splurge a bit and try the “professional” Ektar 100. It’s about a 40% premium for a roll of 135 Ektar film over Kodacolor so I’m interested to see if it’s worth it to pay more. Now I didn’t shoot 1-for-1, […]
There is a long history to chemical and biological warfare—one that, we at least hope, ended in 1993. The paucity of chemical and biological warfare today is a result of long-standing objections that culminated in the 1993 Chemical Weapons Convention. It is striking that this formal end to most chemical weapons programs came within a year of the last US test of a nuclear weapon: similar sentiments, and a similar 1990s "end of history" context, motivated both. The similarity makes the differences more striking. Nuclear weapons are still part of the pop culture today, the quintessential "weapon of mass destruction" and a symbol of the destructive potential of modern warfare. But what of that term? Why "weapons of mass destruction?" The history of the phrase WMD is complex, and while it does predate nuclear weapons our modern use emerged in response to them. Still, it's a broader category. In today's language, WMD refers to nuclear, biological, or chemical weapons. Some of its most prominent invocations, namely in the Iraq War, referred to chemical rather than nuclear warfare. Still, to most Americans, chemical weapons are out of sight and out of mind. There are a few reasons: chemical weapons have been more or less prohibited in warfare for over one hundred years, so we have little experience with or memory of them. In fact, today, in the United States, there are none. That was the modern chemical war: the safe management, recovery, and destruction of an enormous stockpile of chemical weapons. This effort spanned military reservations across the United States, dismantling and burning chemical and biological munitions as life went on as usual outside of the fence. Well, at least, "as usual" for the Cold War: one of the effects of the stockpile was to maintain a sort of localized Cold War climate in those towns that fell downwind of it. Today, with the discovery of a dangerously poorly managed stockpile of Lead Azide that will require an exceptionally risky emergency measure to destroy, we are all acutely aware of the direction that the wind blows. The upcoming plume of lead over Iowa is far from the first time that dangerous compounds have blown away from military custody. There have been dozens of such incidents, with varying degrees of intentionality and risk to the public. Many were, at the time, classified. Others were simply covered up. While not exactly the future we wanted, it is perhaps a sign of progress that the upcoming detonation has been announced at all. The public notifications seem, to me, to be the result of an attitude shift that happened at the tail end of the era of US chemical warfare. Windblown plume forecasting models, originally developed for the fallout of nuclear war, were reapplied to risk analysis of chemical weapon stockpiles. The news was bad, so bad that civilian towns were hardened against attack: not enemy attack, but an attack of bad luck, an accident upwind. But first, we should consider how we got there. There are accounts of chemical and biological warfare dating to antiquity, although as with most early history it can be hard to tell what was speculative and what was actually done. By the 18th century, there had certainly been multiple uses of poisons and noxious chemicals on the battlefield. Chemical weapons in particular took a revolutionary step forward with the development of a more formal science of chemistry, during the 19th century. Several important advancements in chemistry occurred in the pursuit of poisonous gases, and just about every other advance in chemistry was applied to them. Still, even in this early era, there was more of an appetite for the development of chemical weapons than for their actual use. A particularly memorable incident in this history comes from Lyon Playfair, the very same who popularized the "Playfair Cipher" that makes a standard appearance in cryptography classes. In his role as a key scientific official during the Crimean War of the mid-1850s, he proposed the use of shells that would disperse a very poisonous form of Cyanide. Objections to the plan came not from pacifist do-gooders but from the weapons-builders themselves, who considered the whole thing morally questionable. Playfair's words in response are almost haunting in consideration of what would follow, outcomes of which he was simultaneously prescient and shockingly short-sighted. War is destruction, and the more destructive it can be made with the least suffering the sooner will be ended that barbarous method of protecting national rights. No doubt in time chemistry will be used to lessen the suffering of combatants, and even of criminals condemned to death. One of the reasons for the lackluster popularity of chemical weapons is that this notion of "easing the suffering" of the enemy, even if accepted as something other than madness, never really materialized. Particularly in the 1990s, the ethics of capital punishment in the United States came to be seen as sort of a technical problem. Maybe homicide by the state wasn't so bad if it was "painless," or "quick," or at least clinical in its appearance. The same idea pervaded chemical warfare in the 19th century, and in the 20th century it fell short in the same way that lethal injection has now. Objection to chemical weapons generally preceded their use. The Hague Convention of 1899 prohibited the form of chemical weapon that was then most obvious, the gas shell. That this prohibition applied specifically to artillery shells is significant: one of the complexities of chemical warfare is its interaction with domestic use. Like hollow-point bullets, tear gas, for example, is widely used in many nations' interiors—but it has been prohibited in warfare for many decades. This situation was already apparent with the first large-scale use of chemical weapons, at the onset of the First World War. Tear gas, a broad category of irritants that are not generally fatal but induce painful and disabling effects, was first developed in France. Parisian police struggled with organized criminal groups who would barricade themselves into buildings and successfully repel attempts at arrest. A commission was formed to investigate the matter in 1912, and it recommended the adoption of ethyl bromoacetate. Delivered to a barricaded position, it caused uncontrollable tearing, difficulty breathing, and considerable pain—enough to drive gangsters out of cover. That development in policing might have been controversial in its own right, but it was quickly overshadowed by the outbreak of the Great War. Tear gas was adapted to hand grenades, directed against the Germans at Alsace in 1914. In practice, this early chemical attack proved ineffective, but it opened Pandora's box. The Germans developed their own irritant shells, both sides justifying their use by leaning on the term "asphyxiating gas" in the Hague convention. Tear gases are unpleasant, but they are not asphyxiating as the term is defined. It was a slippery slope, though, and once the gears of war were in motion they would not be stopped. German chemists improved both the chemical agents and the means of delivery, such that during 1915 a drifting cloud of Chlorine gas was used to scatter French soldiers holding a defensive line. As it happened, the reticence of the Germans to march into their own poisonous cloud meant that they gained little advantage, but it proved the concept. Once again, the legality of the measure was questioned, but this time, the Germans emphasized the Hague convention's specific use of the word "shells"—no artillery shells having been involved in this particular weapon. Faced with this new threat, both sides developed countermeasures, and faced with those countermeasures, both developed new weapons. By the end of 1915 Phosgene was in wide use, and in 1917, the Germans introduced Mustard Gas. Mustard is a terrifying weapon, causing severe blistering of any exposed skin and extensive bleeding. Mustard Gas was extensively used by both sides, becoming part of routine infantry strategy, and along the way dooming tens of thousands of soldiers to a torturous ordeal in the overwhelmed military hospitals. Ironically, despite the extreme response it induced, Mustard Has was not particularly fatal. Many of its victims survived, disfigured after a long period of extreme suffering. These were the stories that came to be associated with chemical warfare. Far from Playfair's vision of "the least suffering," Mustard Gas became one of the war's main sources of it. Mustard-exposed soldiers convalescing in rows, their skin covered in blisters, their eyes sealed closed... these were the images that defined chemical warfare for decades to follow. While some use of chemical weapons continued after the First World War, Mustard Gas inspired a level of outrage that hung over the 1925 Geneva Conference. The Hague convention's prohibition on shells with asphyxiating gas was narrow enough that Mustard Gas arguably did not apply, so negotiators at Geneva agreed to stronger language. The Geneva Protocol, entering into force in 1928, broadly prohibited the use of chemical or biological agents in warfare between states. That could have been the end of the story. The Geneva Protocol was not perfectly observed, but it did prevent almost all use of such weapons. Despite significant technological advances made in Germany, including the development of several nerve agents during the 1930s, World War II elapsed with only limited use of chemical or biological weapons in combat. Most chemical attacks were by the Japanese, perhaps less affected by the experience of the First World War, and even then were directed mostly against other combatants in Asia. On the European front, only a handful of chemical attacks took place. Here, we arrive at the strangest contradiction in the history of chemical weapons: the near end of the use of chemical weapons, the Geneva Protocol, came before the peak of their development and manufacturing. Despite the limited chemical attacks during WWII, chemical weapons programs became larger than ever before. One reason was the Geneva Protocol's differentiation between combat use by state actors and other uses. To say that the Nazis made little use of chemical weapons, while correct in a certain technical sense, becomes absurd in the face of the Holocaust. Domestic use of chemical weapons only escalated, a dichotomy that still resonates today. This potential for domestic use or use against non-state adversaries (such as putting down revolutionary movements) justified a decision by most WWI combatants to continue development and manufacturing of chemical weapons. That created an ongoing possibility of their use, despite prohibition, which itself justified even more development. Consider the case of Australia, a nation that did not have a domestic chemical weapons program but still built massive stockpiles of imported chemical munitions during WWII. Why? For defense, of course: Australia was relatively close to Japan, the main chemical combatant, and felt the need to have a credible retaliation capability if Japan did decide to initiate all-out chemical war. This kind of reasoning, foreshadowing the doctrine that would demand nuclear weapons programs to the modern day, echoed around the world. Australia was importing those weapons principally from the US and UK, two countries that committed not to use chemical weapons, indeed never used them, and nevertheless operated major research centers and manufacturing plants throughout the war. The Germans clearly had a chemical inventory, which they so saliently demonstrated against their own population, and what if they decided to cast the treaty aside? Ought we to remain defenseless? The fear was not unfounded; Germany was known to have violated the Geneva Protocol on several occasions and some historians take the view that their use of chemical weapons was limited by technical issues rather than a policy decision. Churchill favored a chemical "first strike," although the suggestion didn't get much traction. In the US, as well, a notional retaliation capability was grounds for extensive R&D on rocket-delivered chemical warheads. Ironically, most of the US casualties to chemical weapons were self-inflicted. During the war the military manufactured stockpiles of Mustard Gas, Hydrogen Cyanide, and Cyanogen Chloride. These compounds were packaged into weapons and, in at least some cases, staged at the front in preparation for use. This program was a closely held secret and little is known of it even today. One major detail could not escape discovery: a German air raid on US Navy ships in Italy, in 1943, struck a ship carrying Mustard Gas. The resulting leakage at least contributed to the deaths of 69 people, and sickened hundreds. Already, perhaps the most dangerous thing about chemical weapons was possessing them. Chemical warfare programs only accelerated after WWII. The newly developed German nerve agents, including Sarin1, made it to the US as spoils of war. The research programs that formed around these new agents are some of the most infamous of the period, including exposure of thousands of soldiers to small doses of poisons to observe the effects, a program that continued at Edgewood Arsenal in Maryland until the public became aware—and the program collapsed in scandal—in 1975. The involvement of LSD in these experiments often sees them lumped together with MKULTRA, but the vast majority of the research was on less exotic substances: VX, Sarin, Mustard Gas, Tear Gas. Edgewood was also the manufacturing center for Mustard and Phosgene. What Edgewood couldn't provide was storage; it didn't have room for the well-separated bunkers required for munitions. The Army built new installations for the stockpile: Redstone Arsenal in Alabama, Rocky Mountain Arsenal in Colorado, Pine Bluff Arsenal in Arkansas, and Tooele Ordnance Depot in Utah. At each of these sites, hundreds of acres of earth-covered concrete sheds stored weapons at a distance that wouldn't set off their neighbors. In the very early years of the Cold War, the US Army weaponized a new chemical agent called BZ. BZ gained notoriety because of its psychological effects, which included hallucinations, and because of various accusations that it was covertly used by the US during the 1960s. These allegations don't generally hold up, but they illustrate the atmosphere of paranoia that chemical weapons created, and in response to which more chemical weapons were developed. BZ was produced at Swannanoa, North Carolina, and assembled into weapons at Pine Bluff Arsenal, where binary (two parts that are mixed together) nerve agents were produced as well. Phosphate was manufactured at Muscle Shoals, Alabama, and VX at Newport, Indiana. The Aberdeen Proving Ground handled Mustard gas manufacturing and filling. The Rocky Mountain Arsenal, though, just outside of Denver, was the center of the post-war program: Sarin, Mustard, and Sulfur Mustard were all produced and stored there. The Vietnam War proved a pivotal conflict for chemical warfare, as with so many other aspects of military history. Defoliants, such as Agent Orange, were not considered to be chemical weapons and saw heavy use in Vietnam. While targeted at plants, they were not safe for humans either, and played a major role in creating a generation of disabled veterans. In the meantime, the accidental dangers became more apparent: in 1968, an accident at Dugway Proving Ground in Utah released the nerve gas VX and killed thousands of sheep. The Army denied involvement, and then later admitted involvement but denied fault, a position it maintained into the '90s. Despite attempts to maintain secrecy, the Dugway sheep incident brought public attention to the chemical weapons program—which had maintained such a low profile that many didn't realize it existed. Press investigations after Dugway revealed further problems: disposal practices that had released large quantities of chemical agents into the ocean, handling accidents in overseas military installations, and of course numerous human experiments that fell far short of the ethical standards of the time. In short, the Dugway incident reminded the public, and Congress, that the US Army Chemical Corps existed. It had thousands of soldiers, dozens of facilities, and maintained an inventory of chemical weapons that spanned a national network of ammunition igloos. Ongoing manufacturing operations in the 1960s included BZ cluster bombs, VX shells, Hydrogen Cyanide, and others. Once the press latched on to the program, though, it was the beginning of the end. In 1969, President Nixon announced a "no first use" policy for chemical weapons and the complete prohibition of biological weapons—a stronger policy than has been adopted for nuclear weapons even to this day. As part of the 1969 declaration, Nixon also ended the biological weapons program entirely. I have not spoken as much of biological weapons here, as the scale of the US effort was always smaller than that for chemical agents, but I shouldn't understate it. A half dozen viral and bacterial infections, including Anthrax and Botulism, were weaponized in research laboratories. In part because of moral and practical concerns in the military, most of these were never manufactured at scale and delivery systems (such as artillery shells or warheads) were rarely developed to maturity. When Nixon ordered the program ended, its small scale made it relatively straightforward to destroy stockpiled material. Much of the laboratory-scale work was retained, anyway, for its value in researching defensive measures. Chemical weapons were a different matter entirely, because of the scale of the stockpiles. Continuing expansion of the chemical weapons program saw new stockpiles at Umatilla, Oregon; Pueblo, Colorado; Hawthorne, Nevada; Anniston, Alabama; and Blue Grass, Kentucky. At the peak, the United States disclosed an inventory of 31,100 metric tons of nerve agents and Mustard, stored across a dozen sites. Nearly half was concentrated in Tooele, Utah. Due to the old age of many chemical munitions, there had already been efforts to dispose of aged-out stockpiles in the 1960s. This program took the crude form of missions like "Operation CHASE," or "Cut Holes and Sink 'Em," in which Liberty ships full of munitions were towed off of the coast of Florida and scuttled. Only some carried chemical weapons, but well-founded concerns over the environmental impacts of such a chemical assault on the ocean led to legislation prohibiting this means of disposal in 1972. Other smaller-scale disposal efforts had taken forms like loading Phosphorus into barrels, rolling them into a lake, and then shooting at them until they sank, but besides the generally crude nature of this approach there were only so many lakes that could be so used. Congress had intervened in other ways, as well. Starting in 1970, the Office of the Surgeon General was tasked with reviewing the way that chemical weapons were handled and destroyed. This responsibility shifted around several agencies, ultimately involving the Centers for Disease Control, and brought a level of visibility into chemical weapons management that forced the Department of Defense to take a far more systematic and cautious approach to the remaining stockpile. During the 1970s, the Army's Chemical Corps took on a new focus: safe handling and disposal. The most concerning—and contentious—part of the stockpile was weapons that had been "forward staged" in Europe and Asia. These were intended to allow a fast retaliation to any chemical attack on Europe, but by this point they had become unpopular with host nations like Germany and Japan. This set up the first wave of chemical demilitarization: a months-long Army/Navy effort moved the chemical inventory from Okinawa, thousands of tons of munitions with nerve agents and Mustard Gas, to Johnston Atoll. While better known for its role in the nuclear weapons program, Johnston also served as a base for satellite programs (both intelligence collection and anti-satellite weapons) and a test site for biological and chemical weapons. Starting in 1971, storage and destruction of chemical weapons was made the installation's main purpose. In reaction to the safety incidents of the late '60s, legislation passed in the early 1970s that prohibited transfer of most chemical weapons from overseas to the United States. Instead, over the following decades, nearly all US chemical weapons that had been stored outside of North America were consolidated to Johnston Atoll. The inventory there in the 1990s included even German-made chemical shells that had been captured by the Allies and stored in Germany for study. In 1972, an Army command was formally established to manage the destruction of chemical weapons. The first priority was made the M34 cluster bomb. Designed in the 1950s, the M34 was the first Cold War-era chemical weapon and already considered obsolete. M34s were among the weapons destroyed by ocean disposal during Operation CHASE, but that method had since been prohibited. The Army had to find another way to handle more than 20,000 M34 bombs still stored by Denver, and because of the location of the weapons that method would have to actually neutralize the agents. For the Sarin-laden M34s, a hole was carefully drilled to drain the Sarin from each of the "bomblets" that made up the cluster munition. That Sarin liquid was then mixed with a neutralizing caustic chemical in a sealed reaction chamber. The resulting salt brine was dried, and the precipitated solids (no longer a nerve agent but still an environmental toxin) were buried in nearly 20,000 steel drums. In the meantime, Rocky Mountain Arsenal burned tens of thousands of tons of Mustard gas projectiles in an on-site incinerator, and began chemical neutralization of outdated VX munitions that had been relocated to the site for storage. These early disposal operations at Rocky Mountain Arsenal took place in part because of its proximity to a major city, and a political factor that had made it the top priority for site closure. That was also a liability: disposal operations added to existing environmental contamination, exacerbating a groundwater plume that killed nearby crops and creating a new set of toxic landfills. The weapons that were destroyed there in the '60s and '70s were the easy cases, intact weapons with chemical agents that had known neutralization techniques or were easily incinerated. The Army realized that many other chemical weapons, including older weapons that were already in poor condition and beginning to leak, would require a more complex approach with greater risk of exposure. To develop these techniques, the Chemical Corps established the Chemical Agent Munitions Disposal System (CAMDS) at the Deseret Chemical Depot, a new purpose-built installation adjacent to the Tooele Army Depot on the south side of the Great Salt Lake. CAMDS became the primary R&D site for disposal, and pioneered techniques that included robotic remote handling, semi-automated processing lines, and high-temperature incineration with extensive filtration and chemical treatment of the exhaust. Over the lifespan of CAMDS, more than 91 tons of chemical agents were treated, but most operations at CAMDS served as pilots for larger-scale facilities at other installations. In 1981, an ambitious construction program started at Johnston Atoll: the Johnston Atoll Chemical Agent Disposal System (JACADS). Based on techniques in use at CAMDS and built over five years, JACADS then went through four years of testing and validation before the first full-scale chemical weapons disposal line started operation in 1990. Nerve gas shells were carefully unloaded from storage pallets and set up on a belt. That carried them through a sort of de-production line, where the shells were opened, drained, and washed. The explosives and chemicals they contained were burned in a high-temperature incinerator, while the metal casings of the shells and other components were treated in a high-temperature kiln to ensure they were safe to handle. Simultaneously, a set of "auxiliary" incinerators and kilns processed packaging materials and handling waste. Monitoring systems continuously sampled emissions for any escaping chemical weapons, and periodically such leaks were discovered. This period of chemical weapons history is an odd one, because the political tide had turned against chemical weapons but the Army's inertia continued in the direction of chemical warfare. As JACADS was under construction, the Army built a set of new manufacturing plants at Pine Bluff Arsenal. This would specifically produce binary chemical weapons, which use two separate agents that are relatively safe until they are mixed to produce a nerve agent. Binary weapons can be much safer to handle, since the mixing doesn't occur until an in-flight "arming" stage. They were also seen as an escalation in chemical warfare, especially in the context of the Cold War. As often happens with controversial weapons systems, the Army's work to productionize binary weapons was also their undoing. Controversy around the new weapon designs, and the facilities for manufacturing them, led to a renewal in negotiations with the Soviet Union for some type of chemical weapons treaty. Domestically, the issue made its way to Washington, where in 1986 legislation passed requiring that all non-binary (and thus less safe to handle) weapons be safely destroyed. Lack of congressional enthusiasm (resulting in limited funding), the intrinsic complexity of safely handling dangerous chemicals and explosives, and standard military acquisition problems meant that the new binary weapons programs were slow in coming. Despite the start of construction on several binary weapons plants in 1982, only one was operational by the 1990s, producing the M20 and M21 cartridges which produced Sarin upon mixing in an artillery shell. Barely after M20/M21 production started, ongoing talks with the Soviet Union led to an early agreement to end chemical weapons production—a somewhat informal memorandum, but one that kickstarted negotiations for a formal treaty, complete with timelines and verification requirements. In 1991, Congress ordered the destruction of all material related to the chemical weapons program. This included binary materials, as well as waste, experimental samples, and chemical weapons waste buried in landfills. The United States had, at that point, officially ended its chemical weapons program—a position that would be reinforced by the 1997 ratification of the Chemical Weapons Convention, a complete demilitarization treaty with nearly every nation of the world, and most critically key opponent Russia, as signatories. In a certain strategic sense, the US was no longer a "chemical power," the entire stockpile considered retired. In a practical sense, there were still thousands of tons of chemical agents, packaged into hundreds of thousands of tons of munitions, stored in concrete bunkers from Alabama to Oregon. Throughout the last decade of that century, every chemical weapon storage site became a disposal operation. Congressional restrictions and political realities meant that chemical weapons could not generally be transported between sites. During the 1980s, Sarin-carrying Mk 116 "Weteye" bombs stored at Rocky Mountain Arsenal were dismantled there until safety concerns forced a decision to discontinue demilitarization operations at the edge of a major city. The remaining stockpile at Denver was small, but still included almost a thousand Weteye bombs, particularly the "difficult cases" that had begun to leak. The decision was made to ship these bombs to Tooele for safer storage and disposal at the planned CAMDS. The move did happen, but not without inspiring one of the largest political battles of the chemical weapons era, a media circus that considerably frayed relations between the Army and the state of Utah. Congress followed up by restricting domestic transportation, and by the time disarmament was fully underway it was clear that it would all need to be done "as is, where is." I put a lot of time into writing this, and I hope that you enjoy reading it. If you can spare a few dollars, consider supporting me on ko-fi. You'll receive an occasional extra, subscribers-only post, and defray the costs of providing artisanal, hand-built world wide web directly from Albuquerque, New Mexico. The US Army Chemical Demilitarization and Remediation Activity built the Tooele Chemical Agent Disposal Facility (scaled up from CAMDS), Anniston CADF, Umatilla CADF, and Newport CADF. Failures of several pilot programs to develop a practical alternative to high-temperature incineration led to the construction of the Aberdeen and Pine Bluff CADFs shortly after. Manufacturing facilities were converted, sometimes hastily, to dismantling facilities. The Chemical Weapons Convention's verification scheme started a comprehensive audit of military stockpiles, with storage sites physically searched for chemical inventory. A dream that seems so remote for nuclear weapons had been achieved: it was now military policy, and a major military objective, to find and destroy every last chemical weapon. At the turn of the millennium, JACADS completed its mission, having incinerated nearly half a million weapons—6% of the total US stockpile—stored at Johnston Atoll. Disposal facilities were operating at nearly every stockpile site, almost exclusively by incineration, although some neutralization operations continued at smaller scale. While most of the chemical inventory took the form of large quantities of finished weapons at depots, there was also a sort of "miscellaneous" category. Smaller supplies of weapons that had been moved for testing or R&D, stored agents that were never assembled into weapons, laboratory samples and waste, and other "etcetera" cases made up the category of "non-stockpile" chemical materials. For example, the military had manufactured over a hundred thousand "chemical agent identification sets," sort of portable laboratories and field guides for soldiers that might encounter chemical weapons in the field. These contained small samples of several chemical weapons, and were stored at several sites. They met their end via the Rapid Response System, a three-semi-trailer portable agent disposal facility that could perform a range of neutralization processes at small scale. After qualification testing at Tooele, the Rapid Response System made a sort of nationwide tour of each facility. A particularly hard case were those weapons that had begun to leak, or where the explosives had become unstable. These were dangerous to handle or transport, even over short distances. In response, Sandia National Laboratories developed the Explosive Destruction System. The EDS was a single semi trailer, but one that traveled with about a dozen supporting trucks. It was typically set up under a tent with a negative pressure air filtration system and an airlock for entry. Chemical munitions were set up in a tray, and shaped explosive charges placed across the top. This nightmare casserole is then loaded into a huge steel chamber, where the explosives are detonated to both "open" the weapons and thermally neutralize some of the contents. The rest of the chemical agent is destroyed by neutralizing chemicals injected into the chamber post-detonation, and the steel vessel is heated and rotated to mix everything up and complete the operation. During the '90s and '00s, multiple EDS units were used to handle small inventories of "discovered" chemical weapons, leaking and damaged weapons, and non-stockpile materials. After the Chemical Weapons Convention, the EDS convoy included a "treaty trailer" where staff from the international treaty enforcement body Organization for the Prohibition of Chemical Weapons (OPCW) independently observed the work. Major storage sites required industrial-scale facilities. At Umatilla, 1,000 concrete bunkers held artillery shells, rockets, bombs, landmines, sprayers, and storage containers. These weapons contained nerve agents Sarin and VX, as well as Mustard Gas and blister agents. 1980s upgrades to the facility included better sealing the igloos, fitting them with drains that would contain water from the bunkers for sampling, and adding air filtration on the bunker vents. These reduced the risk from leaking weapons, but as the stockpile aged, leakage was a more and more serious problem. Starting in 1998 the Army carefully recorded each leak; prior to that year most went unnoticed. Environmental personnel interviewed former employees and found multiple stories of leaks, cracks, and other incidents. In at least one case, a leaking munition described by a former worker was found, still stored, right in the bunker where he said it had sprayed its contents across the wall. Contracted to Raytheon, construction of the Umatilla Chemical Agent Disposal Facility (UMCDF) began in 1997. The plant went in to operation in 2004. With 819 miles of wire, 25,000 cubic yards of concrete, and 2,655 tons of steel, the Army boasted that it was "among the most advanced industrial facilities in the world." Destroying the full inventory at Umatilla would take years. A risk-prioritized approach was used in which large-quantity nerve agent weapons were destroyed first, and the relatively less dangerous munitions (such as those with only Mustard Gas or those with very small quantities of nerve agent) were left for later. Operated by contractor URS, the UMCDF consisted of a Container Handling Building where airtight, double-walled steel containers that had been packed and sealed in the bunkers were inspected and transferred to conveyors. From that point, they moved into the Munitions Demilitarization Building where the containers were opened, munitions were disassembled and drained, and the chemical agents and components were delivered to various incinerators. While a few workers with extensive protective equipment performed the most complex disassembly tasks, most operations within the Demilitarization Building were performed by a system of conveyors, hoists, and robots under remote control. Different components went into different incinerators. Liquid from washing weapons and containers went to the Liquid Incinerators, where it was mixed with air and natural gas and fed into a two-stage vortex burner system operating between 2,500 and 2,700 degrees Fahrenheit (1,370-1,480 C). Explosives and propellants, usually contaminated by residual chemical agents, went to the Deactivation Furnace System. A 32 foot long rotating drum kiln treated the waste at a minimum of 1,100 degrees Fahrenheit (590 C) for 7-10 minutes, followed by a discharge conveyor that kept them nearly as hot for another 15 minutes. Most of the material burned during this process, leaving ash (packaged for disposal in a chemical landfill) and flue gas that passed through a final stage of incineration in an afterburner chamber. Just about everything else, mostly the metal casings and components of weapons, went to the Metal Parts Furnace (MPF). The MPF was a three-stage incinerator, with a system of belts and airlocks to move material through it in an almost continuous stream. The three stages held materials for various time periods (depending on the type of waste) at temperatures from 1,450 F to 1,800 F (790 C to 980 C), until the materials arrive in the out-feed airlock where they are cooled. The air blown in for cooling was sampled on the way out and tested to ensure that it was free of chemical agents. All gases from the MPF were processed by a multi-stage afterburner incinerator. The UMCDF required an array of support facilities, like the Pollution Abatement System that received the exhaust gases from all of the incinerators. This exhaust, clean of chemical agents but still bearing a variety of interesting and toxic chemicals, was cooled in a quench tower and then put through a series of chemical scrubbers and filters before a final incinerator stage for good measure. Liquid brines, collected from the scrubber towers and parts of the Demilitarization Building process, went to a treatment plant where the water was evaporated off (and the vapors scrubbed) to leave dry crystallized salts. These were packaged for disposal at a hazardous waste landfill. Laboratory, utility, and office buildings made up the rest of the complex. Congressional scrutiny of chemical weapons also led to the Chemical Stockpile Emergency Preparedness Program. This legislation responded to accidents that had occurred at storage and demilitarization sites by requiring that the Army and FEMA take measures to protect nearby communities. The highest population concentration around a major depot, after the relatively early end of operations at Rocky Mountain Arsenal, was found in Oregon and Washington towns around Umatilla. In that region, FEMA funded the construction of a new emergency operations center, installation of sirens, and positive-pressure chemical filtration systems on schools. It was projected that residents of Umatilla would have to move into sealed shelter in less than an hour, were there to be an accident at the depot. A FEMA-funded computer modeling system, at the Emergency Operations Center, would project plume travel to inform evacuation and shelter decisions. The counties stockpiled protective suits and other equipment, and arranged military training on surviving chemical attack for firefighters. By 2000, residents of the area were provided with "tone alert" radios to sound an alarm in their home. Counties distributed "shelter in place kits," with tape and plastic sheeting, to offer residents something to do if the radios ever did sound. The East Oregonian described a county official saying that the kits wouldn't really seal a room, but "may buy more time for a family inside." Pressurization systems were made standard in new schools in the area, and added to the hospital and a nursing home in Umatilla. Working with the CDC, the State of Oregon trained medical personnel on chemical weapons response and distributed the nerve agent antidote Atropine to hospitals. FEMA funds were directed to school districts to buy more buses—a local transportation capability that could be conscripted for an evacuation. In 2008, the last nerve gas weapon, a VX land mine, passed through the plant. The last Mustard Gas weapon was processed in 2011, and evacuation sirens sounded their last Tuesday test. In 2013, the Army published a plan to remediate contamination at Umatilla, demolish the plant, and return the land to other use. Even this process was complex: many of the bunkers were contaminated and had to be carefully cleaned. Much of the demolition debris from the incinerator plant had to be handled as hazardous waste. Each and every bunker was swabbed for testing, soil samples were taken, buildings were knocked over and covered. At the building where workers changed into their protective equipment, septic leachate and dryer lint were collected as chemical waste. In 2023, the Army transferred the 9,511 acres that made up the installation to a coalition of local governments. Much of it will be used by the Oregon National Guard as a training site, other areas are slated to become industrial parks, and the tribal government of the Cayuse, Umatilla, and Walla Walla peoples will operate a large area as an environmental preserve—some of which will require an ongoing program of monitoring and institutional controls. The last chemical weapons in the US stockpile were located at Blue Grass Army Depot, where the Blue Grass Chemical Agent Disposal Facility processed the final Sarin-filled M55 rocket on July 7th, 2023—just ahead of the September 30th deadline set by the Chemical Weapons Convention. Measured from Congress's 1986 legislative mandate, the complete destruction of the US inventory of chemical and biological weapons took 37 years. Closure of the later disposal facilities is still ongoing, and the small-scale portable disposal systems will be retained for use on any chemical or biological weapons that might turn up in the future. An Assistant Secretary of Defense, Deborah Rosenblum, said that "this achievement demonstrates our credibility to the international community and has helped move the US government toward closing this particular chapter of US military history." There are few chapters of military history that ever close. The arc of the chemical weapons program, developed under wartime pressures but accelerated during the curious pressure of the Cold War, largely rejected by both the military and the public, and then wrapped up under international agreement at great expense... it is impossible not to compare it to that of the nuclear weapons program. Negotiations with the Soviet Union leading to a bilateral agreement, followed by an international convention, to completely disarm: the dream of generations of nuclear weapons protestors. It seems so far away, so impossible, for nuclear weapons that it's hard to remember that we've done it once before. So why can't we do it again? Well, the comparison isn't entirely fair. For one, the strategic significance of chemical weapons has never been on par with that of their nuclear peers. The story of World War I shows that chemical weapons are hard to use effectively outside of a few very specific situations, and that never really changed. They have a small area of effect, making them useful mostly to clear the way to advance, but they poison the land such that they can prevent that advance actually happening. Chemical disarmament was achieved, in good part, because the chemical weapons just weren't that important to begin with. One also wonders if the history of use is a factor: chemical weapons were widely used in the First World War, which both spread awareness of their horrific effects and made them more approachable, more understandable, as a part of combat. Nuclear weapons have seen such limited use that they remain more of a symbol than a real weapon, surrounded by such a mystique that their power seems both unlimited and unlikely to actually matter. During the 1899 Hague Convention, which banned the use of "shells containing asphyxiating gas," there was a sole vote against. That vote came from the United States, through its representative, Captain Alfred Mahan of the Navy. He explained his vote thus: The inventiveness of Americans should not be restricted in the development of new weapons. We do consider ourselves to be a powerful culture. The development and manufacturing of chemical weapons was a massive program, involving tens of thousands of workers across the military and private industry. The dismantling of those same weapons happened on the same scale, and often faced even more formidable technical challenges. Perhaps our inventiveness could be less restricted in the destruction of weapons, as well. German researchers gave nerve agents names such as Sarin and Tabun, while the US and NATO used two-letter codes like GB and GA. In fact, these are the same: Sarin is GB and Tabun is GA. I find the acronyms difficult to remember, and the German names are generally the ones used in popular media, so I use the German names when applicable. The problem is that nerve agents developed within NATO countries, such as VX, have no such names. The result will unfortunately be a mix of both conventions.↩
Between Microsoft's two-day outage and the FAA ground stop yesterday, there's plenty of ink spilled about who's responsible, why these things happened, etc. But it made me think back to some of the infrastructure and ops teams I've worked on, and similar (though much smaller scale) outages we encountered. Having an ops mindset is fundamentally different from a development or project management mindset. And it took me over a decade of software development to understand why.
I’ve been getting back into the politics fandom this past month.