Posts in Go (20 found)
Unsung Today

My Golden Gate welcoming committee

The first thing that welcomed me after my jump from macOS Sequoia to Golden Gate was a cavalcade of scary notifications on the right from various apps that worked before, but suddenly required new permissions. There was no welcome screen, no cute animation , no onboarding, no announcement of a new-in-this-context Liquid Glass. Instead, a wall of notifications taller than my display, thrown onscreen all at once as if I just entered a busy subway station in a dystopian movie. Second thing? My folders in Finder were now ugly: = 2x) and (width >= 700px)" srcset="https://unsung.aresluna.org/_media/my-golden-gate-welcoming-committee/1.2096w.avif" type="image/avif"> = 3x) or (width >= 700px)" srcset="https://unsung.aresluna.org/_media/my-golden-gate-welcoming-committee/1.1600w.avif" type="image/avif"> Finder’s new design started tinting the colors of each folder depending on its label – not a bad idea in and of itself – but that had a few side effects. One of those was that my folders were no longer blue, but graphite-tinted (graphite is my go-to system theme), feeling sad and inactive. Okay, “ugly” is sometimes in the eye of the beholder, and I heard before that there was a new option to customize the folder color. I found it quickly in System Settings: None of these default colors looked good to me, alas, feeling garish and clashing with the tinting coming from my beloved labels. Luckily, there was an overflow leading to a new interface: Little did I know I’d spend half of the following hour fighting with it. Spoiler alert: This is bad UI, both in its design and its execution. It is wild to me how bad it is, especially for a just-added feature. I want to show you some of the moments I experienced then, and how I tried to wrap my head around it all in real time. First moment: Why is the icon refreshing so janky? Then: Why does it offer grabbing a color from elsewhere, but then seemingly samples a wrong color? Why does it often feel the second slider does nothing at all? Or why is it sometimes completely white? How am I supposed to understand this situation? Why isn’t this reusing the default color panel, or allow me to fall back to it? = 2x) and (width >= 700px)" srcset="https://unsung.aresluna.org/_media/my-golden-gate-welcoming-committee/9.2096w.avif" type="image/avif"> = 3x) or (width >= 700px)" srcset="https://unsung.aresluna.org/_media/my-golden-gate-welcoming-committee/9.1600w.avif" type="image/avif"> Why do the two sliders look different than system sliders (just compare with the ones above), and don’t behave like real sliders – for example, ignoring dragging from the elevator that has been supported for decades? Why was this designed as a strange combination of two pop-ups replacing each other in the same place – a pretty bad IA pattern – rather than, for example, an extensible pane? Why does one say “Automatic” and the other “Use Theme Colour”? Why is it sometimes wide and sometimes narrow? And why does it crash – spectacularly, animating itself into oblivion, then taking the entire System Settings pane with it – whenever I touch it in the wrong place? In a .2 release? Eventually, with a lot of struggle and frustration, I found a passable color. = 2x) and (width >= 700px)" srcset="https://unsung.aresluna.org/_media/my-golden-gate-welcoming-committee/14.2096w.avif" type="image/avif"> = 3x) or (width >= 700px)" srcset="https://unsung.aresluna.org/_media/my-golden-gate-welcoming-committee/14.1600w.avif" type="image/avif"> It’s a color. I understand colors. But I no longer know how I got to it, and I am afraid to touch the whole thing again. I know I’m fixating on this UI component, but it is macOS that forced me to get to know it so well. In a good and just world, this should be the fun part of settings! It should be delightful – making the new operating system feel like yours , having it match your identity, or offer an opportunity to entertain a new one. This should feel like putting a sticker at the back of your laptop’s lid or choosing a case for the phone. Colors are fun . It’s okay to spend an hour twiddling with color sliders, trying to find one that will make you happy. But not like that. Even without any clicking, this whole pane, just look at it: = 2x) and (width >= 700px)" srcset="https://unsung.aresluna.org/_media/my-golden-gate-welcoming-committee/15.2096w.avif" type="image/avif"> = 3x) or (width >= 700px)" srcset="https://unsung.aresluna.org/_media/my-golden-gate-welcoming-committee/15.1600w.avif" type="image/avif"> It’s bad overall, with scant visual rhythm or hierarchy, and multiple mismatched types of previews. Things seemed to have just been piled on every year without paying off any design debt, thrown into a framework ill-equipped to hold them starting from day one. I have now spent a few weeks with Golden Gate, and I wish I could say this is an exception. I still see many bugs from Sequoia, and I see some new ones, too. Both Finder and System Settings feel positively cobwebbed. Siri has been crowbarred into places, creating new patterns not consistently applied elsewhere. Shortcuts continues to work half of the time. Apple’s promise was that Golden Gate was a Snow Leopard- or Mountain Lion-like release that focused on bug fixing. The word on the street was that the damage from Tahoe – which I personally skipped on my primary machine – was fixed, with things back to normal. This was what motivated me to switch. But now I feel we all graded macOS on a curve. It’s entirely possible that bug fixing was the focus of this release. But it wasn’t successful. It seems the slide from WWDC was less of a tip of the iceberg and more just the whole iceberg. Maybe not enough people were assigned to the project. Maybe not enough time given. Maybe the bug prioritization was off. I do not know. I don’t understand the near abandonment of settings . I don’t get how Apple can be so passive-aggressively angry at the web and React, and then ship a color picker that feels like a cargo-culted, shitty web interface. I don’t agree with macOS being held to very different visual and interaction standards than iOS. In the end, this is how Golden Gate welcomed me: no gentle onboarding, no “what’s new in this version of macOS”, no “we changed how your folders look, but here’s a new fun option for you to take ownership of it.” No. Only a torrent of notifications that stressed me out so much I forgot to screenshot them – and then a janky, inconsistent, seemingly vibe-coded interface put together as an afterthought. Welcome to Jank City, population: you. I keep souring on Apple’s software in recent weeks . There are some good moments , of course. And I love the Duo animation as much as the next person. I think it hits all the rare trifecta: it’s helpful, beautiful, and technically impressive. But a good design culture is where attention and care aren’t just reserved for marquee keynote and advertisement moments. It’s a place where you practice a healthy diet, where you pay attention to other things, where you don’t allow “unsexy” moments to be forgotten or taken for granted, where you reward hard work with the right incentives. The problem with interfaces that are an afterthought is that they make your user feel like an afterthought, too. (PS I eventually rebooted the system a week after its first run, and only then I got a welcome screen. It felt sad, perfunctory, and confusing; it admonished me for choosing not to sign into Apple ID, even though I’ve been signed in for years. The only interactive part was Liquid Glass’s slider I already adjusted. It made the whole macOS feel old and tired . I wonder now: Is this what Mac OS 8 felt like, before the whole thing imploded and needed to be rebuilt from scratch?)

0 views
Anton Zhiyanov 1 weeks ago

Probabilistic data structures in Go, part 2

Probabilistic data structures give you approximate answers to questions about the data they handle. Does the set contain a certain item? How many unique items are in the collection? What is the 99th percentile in a stream of numbers? How similar are two sets? Unlike deterministic structures, the answers might not be exact, but in return, you can save a lot of memory. Previously, we reviewed the following data structures : Bloom filter (for checking if an item is in a set), Count-min sketch (for counting items), HyperLogLog (for counting unique items), T-digest (for finding quantiles), and Top-k (for finding the most frequent items). In this post, we'll talk about other probabilistic structures and compare them to the ones we've already covered. We'll look at how they work and what kinds of guarantees they provide. All examples use unsure — a package that implements these structures in Go. Binary fuse filter • UltraLogLog • Log-linear histogram • MinHash A binary fuse filter is a set that trades certainty for space, like a Bloom filter 1 . It can tell you that an item is definitely not in the set, or that it probably is (which might be a false positive). The filter doesn't store the items, so it's much more compact than a regular set. Unlike a Bloom filter, a binary fuse filter is static: you build it once from all the items, and you can't add more later. In exchange, it uses less memory than a Bloom filter with the same false positive rate. For example, a fuse filter for 1,000,000 items with a 0.39% false positive rate takes 1.13 MB (9 bits per item), while a Bloom filter takes 1.51 MB (12 bits per item). This makes binary fuse filters a good fit for data that is written once and read many times, like the key set of an immutable file in a database (to skip files that don't have the key), or a list of known bad items, such as leaked passwords or malicious URLs. The fingerprint type ( in ) determines the false positive rate and the memory use: The constructor takes an iterator of items to add to the filter and the expected number of items (0 if unknown). The number is only used to preallocate memory, so a good estimate makes the build faster. You can check if an item is in the filter, but you cannot add or delete an item, count the number of items, or iterate over them. The filter 2 is an array of b -bit fingerprints (for example, b = 8 for ). Each item is hashed to a 64-bit value h , which gives the item's fingerprint f (b bits computed from h) and three positions in the array (cells). The array is filled so that for every item, the XOR of its cells equals f. To check an item, you compute h, look up its three cells, and compare their XOR with f. For an item in the set, they always match. For any other item, the XOR is a random b-bit value, which matches f with probability 2^-b. Each check reads three cells, so for large filters it's three cache misses, against one for a blocked Bloom filter. However, since the reads are independent, the CPU can do them concurrently, so the checks are about as fast as with a Bloom filter. The filter uses the local wyhash 3 implementation for hashing. It performs roughly the same as xxh3 4 but has a much simpler implementation, without SIMD or assembly. Here's an excerpt from the full benchmarks 5 , comparing unsure to xorfilter 6 (binary fuse by the authors of the paper) and bloom ( unsure 's own Bloom filter) with 8-bit fingerprints (ns/op, lower is better): Memory, bits per item (lower is better): Unsure is the same size as xorfilter (same layout) with up to 25% faster checks. Compared to the Bloom filter, it uses up to 36% less memory, with checks as fast or faster, but up to 2.5× slower builds. Bloom filter overview and how it works.  ↩︎ Binary Fuse Filters paper by Thomas Mueller Graf and Daniel Lemire, 2022.  ↩︎ Reference wyhash implementation by Wang Yi.  ↩︎ Reference xxHash implementation by Yann Collet.  ↩︎ Binary fuse filter benchmarks .  ↩︎ FastFilter/xorfilter by Daniel Lemire.  ↩︎ UltraLogLog is a unique items counter that trades accuracy for space, like HyperLogLog 7 . It tells you approximately how many distinct items it has seen, no matter how many times each one appeared. UltraLogLog doesn't store the items, so it's much more compact than a regular set. UltraLogLog is a newer design (Otmar Ertl, 2024) that uses the space more efficiently: for the same error, it needs about 43% less memory than HyperLogLog. For example, a HyperLogLog sketch with 0.81% standard error takes 16 KB, while an UltraLogLog sketch with 0.86% error takes 8 KB. However, adding, counting, and merging are slower than with HyperLogLog. UltraLogLog is useful in the same places as HyperLogLog: counting unique visitors, unique search queries, or distinct values in a database column, possibly across many machines or segments. You can merge sketches to get the total number of unique items from all of them, without counting shared items twice. The sketch has one setting: the precision p , which gives a relative standard error of 0.782/√(2^p). The default is p=13 with 0.86% error in 8 KB, close to the common HyperLogLog default (0.81% in 16 KB). You can add items to a sketch, get the estimated count, and merge sketches. You cannot check if a specific item was added, remove items, or list them. HyperLogLog hashes each item and uses the first p bits of the hash to pick one of m = 2^p registers . It calculates the rank (the number of leading zeros in the rest of the hash, plus one) and keeps the highest rank it has seen in the register. Seeing a rank of k suggests there were about 2^k items in the register. The count is estimated from all the registers together. A HyperLogLog register loses some information: it only keeps track of the highest value, not whether any slightly lower values were seen. These lower values show up at least as often as the highest one, so they can tell a lot about the count. UltraLogLog 8 uses the registers more efficiently. Each register is still one byte, but it stores the highest rank k in the upper 6 bits, and whether k−1 and k−2 were seen in the lower 2 bits: The count estimate uses the FGRA estimator from the UltraLogLog paper. Each register adds a weight based on its value, and the count is calculated as a power of the sum of the weights. Nearly empty and nearly full sketches get special handling, so the estimate stays accurate from zero to billions of items, without bias tables or a separate formula for small counts. Unsure keeps a histogram of register values (256 four-byte counters, 1 KB) updated as the registers change. This way, reads the histogram instead of scanning all the registers. checks 8 registers at a time using a few bitwise operations to find which ones the other sketch would change, and only updates those. The item is hashed once with wyhash , and the 64-bit hash is split into the register index and the rank. Here's an excerpt from the full benchmarks 9 , comparing UltraLogLog to unsure 's own HyperLogLog and axiom 10 (HyperLogLog with LogLog-Beta estimator and sparse mode) (ns/op, lower is better): Accuracy and memory, relative RMSE over 1,000 sketches (lower is better): UltraLogLog provides the same accuracy as HyperLogLog with almost half the memory. However, adding, counting, and merging are noticeably slower. HyperLogLog overview and how it works.  ↩︎ UltraLogLog paper by Otmar Ertl, 2024.  ↩︎ UltraLogLog benchmarks .  ↩︎ axiomhq/hyperloglog by Axiom.  ↩︎ A log-linear histogram is a summary of a stream of numbers that trades accuracy for space. It can give you an approximate median, 99th percentile, or any other quantile of the data. It can also estimate what fraction of the numbers are below a certain value (the CDF). The histogram doesn't store the numbers, so it's much more compact than a sorted list. For example, to find the exact 99th percentile of 1,000,000 response times, you'd have to keep all of them. With 64-bit floats, that takes 8 MB. A log-linear histogram estimates the same percentile within 0.39% of its true value using about 14 KB — almost 600 times less. The error is relative to the value: if the true 99th percentile is 200 ms, the histogram returns a value between 199.2 and 200.8 ms. This guarantee applies to every quantile, from the median to the most extreme outliers. The size of the histogram doesn't depend on the number of values, only on the accuracy you choose and on how wide the range of the values is. A log-linear histogram is useful when you need percentiles for positive values that cover a wide range, like latencies, file sizes, or prices. You can merge histograms to gather data from multiple machines or segments (like by hour, endpoint, or region). Merging is exact: a merged histogram is the same as if it had received all the values directly. The histogram has two settings: relative error and value range. By default, the error is 0.0039 (0.39%) and the range is from 1e-9 to 1e18. Lowering the error or increasing the range uses more memory. You can add numbers to a histogram, estimate quantiles and the CDF, and merge histograms. You cannot remove numbers or list them. A histogram splits the range of values into buckets and counts how many values are in each one. To estimate a quantile, it adds up the counts starting from the lowest bucket until it reaches the requested rank, then returns a value from that bucket. The accuracy of the estimate depends on how wide the bucket is. With buckets that have equal widths, like 0–10, 10–20, and so on, every estimate has the same absolute error of ±5 around the bucket's midpoint. So the relative error is very large for small values and unnecessarily small for large values: A logarithmic histogram solves this by making each bucket's width proportional to its value. For example, if the bucket boundaries are powers of 1.02 (1, 1.02, 1.0404, ...), the end of each bucket is 2% larger than its start, so any value in the bucket is within about 1% of the bucket's midpoint. DDSketch 11 uses this method. The downside is that finding the right bucket for a value means you have to calculate a logarithm, which is relatively slow. A log-linear histogram gets almost the same result with cheaper math. First, it splits the values into ranges between powers of two: 1–2, 2–4, 4–8, and so on (these are called octaves ). Then it splits every octave into the same number of equal-width buckets. For example, here are three octaves with 4 buckets each: Each octave is twice as long as the previous one, so its buckets are twice as wide, and the bucket width grows with the values, as in a logarithmic histogram. Finding the right bucket only takes a few bit operations instead of calculating a logarithm. HdrHistogram 12 is the best-known log-linear histogram. It records integers: the position of the highest 1 bit of a number determines its octave, and the next few bits determine the bucket within the octave. Unsure works with float64 numbers and finds the bucket in a similar way to HdrHistogram. IEEE 754 double-precision format A float64 in Go (and most other languages) is made up of three parts: The number's value is 1.f × 2^e, where 1.f is a binary fraction between 1 and 2. The exponent determines the octave, from 2^e to 2^(e+1). The top m bits of the mantissa determine one of the 2^m equal buckets within the octave. For example, here's the number 5.25 with m=3 (8 buckets per octave). In binary, 5.25 = 1.0101₂ × 2², so the exponent is 2 (stored as 1025), and the mantissa starts with 0101: finds the bucket for the given number and increases the count. adds the counts bucket by bucket. adds up the counts from the closer end (the leftmost bucket for q ≤ 0.5, the rightmost bucket otherwise) until it reaches the rank. The number of mantissa bits m comes from the requested error: the constructor picks the smallest m for which the maximum error doesn't exceed the requested one. The default is m=7: 128 buckets per octave and an error of 0.39%. A t-digest 13 also estimates quantiles, but it limits the error in ranks : returns a value whose rank is close to 99%. A log-linear histogram limits the error in values : returns a value close to the true 99th percentile. In the middle of the data, the two are pretty similar. But in a long tail, values at nearby ranks can be very different, so even a small error in rank can lead to a big difference in value. Here is the mean relative error of an 8.5 KB t-digest (δ=100) on 1M values from three distributions: lognormal (as in the benchmarks), Pareto with α=1.5 (a longer tail), and uniform between 1,000,000 and 2,000,000 (no tail): A log-linear histogram of about the same size (1% error, 8 KB) has an error below 0.78% for all these cases. So a log-linear histogram is better for latencies, sizes, and other positive measurements with long tails. A t-digest is better when you need a fixed size no matter what the values are, or when the values can be arbitrarily close to zero. Here's an excerpt from the full benchmarks 14 , comparing unsure to hdr 15 (log-linear, integers only, fixed range) and dd 16 (DDSketch, logarithmic buckets) with a lognormal distribution (ns/op, lower is better): Mean relative error at the requested 0.1%, over 1M values (lower is better): Memory after adding 1M values (lower is better): Unsure adds values as fast as hdr and 5× faster than dd , queries 5–19× faster than hdr and about 35× faster than dd , and merges about as fast as dd and 35–175× faster than hdr . It's slightly less accurate than hdr (using 5× less memory), and more accurate than dd (using 1.4× more memory). DDSketch paper by Charles Masson et al., 2019.  ↩︎ HdrHistogram by Gil Tene.  ↩︎ T-digest overview and how it works.  ↩︎ Log-linear histogram benchmarks .  ↩︎ HdrHistogram/hdrhistogram-go by Coda Hale.  ↩︎ DataDog/sketches-go by Datadog.  ↩︎ MinHash estimates how similar two sets are. It summarizes each set in a short fixed-size signature (for example, 256 numbers). Comparing two signatures gives the approximate Jaccard similarity of the sets: |A∩B| / |A∪B|, the proportion of unique items that both sets share. The size of a signature doesn't depend on the size of the set, so you can compare two sets of a million items each just by comparing 256 pairs of numbers instead of checking every item. Plus, each set's signature is only calculated once, so comparing lots of sets to each other is relatively cheap. MinHash is useful for finding near-duplicate documents, like web pages or essays (represented as sets of words or 3-word phrases). It's also useful for finding similar user profiles (as sets of liked items) or overlapping datasets (as sets of keys). The MinHash sketch has one setting: the signature size k , which gives a standard error of √(J(1−J)/k) for true similarity J. For example, with k=256 and J=0.5: You can add items to a sketch, merge sketches, and get and compare signatures. You cannot check if a specific item was added, count the items, remove them, or list them. Classic MinHash 17 hashes every item with k different hash functions. Here are two sets, A = {fox, cat, dog, owl} and B = {fox, dog, emu}, and their item hashes for k=4: For each hash function, the set keeps only the smallest hash value among its items. These k minimums are the set's signature . To estimate the similarity of two sets, compare their signatures position by position, count the number of equal values, and divide by k: The estimated similarity (0.5) is different from the actual value (2 shared items / 5 distinct items = 0.4). To get a more accurate estimate, k is usually much larger than in this example. One permutation hashing 18 hashes every item once, with a single hash function, and splits the range of hash values into k equal buckets. Each bucket keeps the smallest hash value among its items. Here are the same sets with k=4, using h1 from above: Each bucket works like a separate MinHash over the items in its range. So the bucket minimums form a signature, and comparing two signatures works the same way. But there is a catch: when a set isn't much larger than k, some buckets end up empty (shown as · above), so there's nothing to compare in them. Optimal densification 19 solves this by filling each empty bucket with the value from another bucket in the same set. Each empty bucket tries other buckets in a pseudo-random order and copies the value of the first non-empty one: This order depends only on the empty bucket's position, so two similar sets tend to fill empty spots with the same values. This makes the estimate work for sets of any size, with about the same error as classic MinHash. Unsure keeps the k bucket minimums in the sketch. and use the original buckets. Densification only happens in , and it makes a copy of the buckets without modifying the sketch. Each item is hashed once with 64-bit wyhash . Multiplying the hash by k once gives both the bucket and the value to store: Densification fills empty buckets in a coordinated way, spreading the copies evenly across the non-empty buckets. This keeps the error close to classic MinHash, and makes densification fast even for small sets. Here's an excerpt from the full benchmarks 20 , comparing unsure to dgryski 21 (classic MinHash) (ns/op, lower is better): RMSE of the similarity estimate at k=256 and J=0.5 (lower is better): Unsure adds items 6–70× faster than dgryski , compares signatures at the same speed, has roughly the same accuracy, and uses half the memory. Classic MinHash paper by Andrei Broder, 1997.  ↩︎ One permutation hashing by Ping Li et al., 2012.  ↩︎ Optimal densification paper by Anshumali Shrivastava, 2017.  ↩︎ MinHash benchmarks .  ↩︎ dgryski/go-minhash by Damian Gryski.  ↩︎ Bloom filter and HyperLogLog are everyone's favorites, but they're not the only useful probabilistic data structures out there. In some situations, you might find these helpful: To use them in Go, try the nalgeon/unsure package: Bloom filter overview and how it works.  ↩︎ Binary Fuse Filters paper by Thomas Mueller Graf and Daniel Lemire, 2022.  ↩︎ Reference wyhash implementation by Wang Yi.  ↩︎ Reference xxHash implementation by Yann Collet.  ↩︎ Binary fuse filter benchmarks .  ↩︎ FastFilter/xorfilter by Daniel Lemire.  ↩︎ HyperLogLog overview and how it works.  ↩︎ UltraLogLog paper by Otmar Ertl, 2024.  ↩︎ UltraLogLog benchmarks .  ↩︎ axiomhq/hyperloglog by Axiom.  ↩︎ a sign bit, an 11-bit exponent e (stored as 1023 + e to avoid negative values), and a 52-bit mantissa f . DDSketch paper by Charles Masson et al., 2019.  ↩︎ HdrHistogram by Gil Tene.  ↩︎ T-digest overview and how it works.  ↩︎ Log-linear histogram benchmarks .  ↩︎ HdrHistogram/hdrhistogram-go by Coda Hale.  ↩︎ DataDog/sketches-go by Datadog.  ↩︎ 68% of estimates are within ±3.1 pp of J (0.47–0.53), 95% within ±6.2 pp (2·stdErr), 99.7% within ±9.4 pp (3·stdErr). Classic MinHash paper by Andrei Broder, 1997.  ↩︎ One permutation hashing by Ping Li et al., 2012.  ↩︎ Optimal densification paper by Anshumali Shrivastava, 2017.  ↩︎ MinHash benchmarks .  ↩︎ dgryski/go-minhash by Damian Gryski.  ↩︎ Binary fuse filter is a more compact alternative to a Bloom filter when you know all the items in advance. UltraLogLog is a more compact (but slower) alternative to HyperLogLog. Log-linear histogram is a much more accurate alternative to t-digest (with a variable size). MinHash compares large sets for similarity using a tiny fixed-size signature.

0 views
Lea Verou 1 weeks ago

Nudeps: bundler-like imports, none of the baggage

You a package (e.g. ), you write , and it works — as long as there is a bundler in between. Without one, the browser has no idea what is: it only understands URLs, and was never meant to be deployed. So even the simplest project ends up needing a bundler, only so it can use dependencies instead of reinventing the wheel. But bundlers add a significant tax. They process every single file, introduce several layers of abstraction between source and deployment, and these abstractions often leak : things that work fine in the browser can break in the build. Earlier this year, I published Web dependencies are broken: Can we fix them? that discusses this from a platform architecture perspective. Besides the architectural concerns, the complexity is an active developer pain point: in State of JS 2025 , “Managing Dependencies” was the 3rd biggest pain point , and “Build tools” were 6th. However, getting rid of build tools is not the goal. Some use cases should not be handled by the browser, so bundlers and build tools will always have a role to play. The goal is making them lighter, composable, and less essential . In that vein… Nudeps 1 is a new kind of lightweight build tool that lets you continue using to manage dependencies, vendor them locally, and import them via bare specifiers (package names like or instead of URLs), without the bundler. You set it up once, and then you can forget about it: you keep ing packages and importing them by name, and they work in the browser. And it only ever touches your dependencies, never your own code . Since my apprentice Dmitry and I prototyped the initial MVP in February, we and others have tested it on a variety of projects, and at this point I’m confident that — while not perfect — it’s ready for prime time. A core architectural difference between Nudeps and bundlers is that your own code remains untouched . In fact, it doesn’t even need a watcher that runs whenever you make edits! It only touches dependency files, and doesn’t rewrite anything, making it extremely lightweight in terms of complexity it adds. This means it can complement any other tooling — or none. You write raw HTML, CSS, JS? This is for you. You use a templating engine, a CSS preprocessor, and TypeScript? This is also for you (though understandably you may have less use for it). This also makes it complement static site generators and island architectures particularly well. Does it replace your build process? If all you needed it for was getting imports to work, it could. If you also compile your code (JSX, TypeScript, single-file components), you still need a tool for that, but it can be a much smaller one. Bundlers make complex things possible. Nudeps is hoping to occupy the space on the left of the curve and make simple things easy . Assuming you don’t need to customize anything (e.g. using for the map, for the dependencies, all default settings) it goes like this: That’s it. You’re done. You can now and to your heart’s content, and start using packages right away in your code. Things Just Work™. We have been so trained to expect friction and complexity, that some testers thought they were doing it wrong: I ran the npx command and added the import map to my app, but I assumed that there was still a lot more work to do. I was shocked to realize I was done. — Sam Littlefair Most of the pieces were already there, and were just waiting for someone to put the puzzle together. Import maps allow us to import bare specifiers (package names like ) instead of URLs in the browser and are Baseline Widely Available. JSPM is a library that traces a dependency graph and generates an import map. It focuses on CDN use cases, but its engine is exposed as a separate library that can be repurposed, which is what Nudeps uses under the hood (with a lot of tweaks). Import maps currently have to be inline in the HTML of every page, which would require templating, but external import maps can be easily emulated via a small script that injects the map. Package managers like npm already give you the file structure and let you manage versioning, that structure just can’t be deployed as-is to the web . When you install Nudeps via , it does two things: Using as a hook means there is no Nudeps watcher or command to run when you start working on a project! In that sense, Nudeps actually gets you better DX than a bundler 2 . Then, whenever runs, it… Here’s an example of what that script may look like. In production, you can prune to only the specifiers actually used (via the option), and including them all in development means the import map only needs to change when your dependencies do, not whenever you write an import. Yes! Obviously some frameworks are compile-only (e.g. Svelte), but many have runtime-only imports. Even React can be used, though without JSX the ergonomics are poor. My personal go-to is Vue . Most libraries also work fine, including D3 , gsap , Lit , Three.js , Floating UI , interact.js , and Underscore . Beyond common cases, Nudeps supports quite a few edge cases too: Many CJS-only packages like lodash work too, via a tiny shim (that Nudeps handles), and the jQuery demo even loads two different jQuery versions side by side through npm aliases. Yes! In fact the demos include two such dependencies: Open Props and Bootstrap Icons . The catch is that since browsers currently have no way to include CSS stylesheets via specifiers , you need to use actual URLs ( this is changing ). This also means these packages cannot use other dependencies (unless they bundle them). Thankfully, that’s the case for most. To make this easier, Nudeps creates symlinks (or redirects, where symlinks are not supported) so you can import versionless URLs like . From the very beginning of our testing (back in February), Claude understood it just fine, making only minor mistakes that were unnecessary, but ultimately harmless (Nudeps still worked fine), such as: And the package now includes a file, which makes them go away entirely once the agent is instructed to actually use it. Most packages work. Also, since Nudeps doesn’t bundle, packages with a lot of tiny modules pulled together by ESM imports may be slower to load initially. If you’re a package author that wants to provide a Nudeps-friendly bundle, generating a bundle that consolidates them somewhat can improve performance. But there is a tradeoff to all bundling: the more files are bundled, the less granularly they can be loaded. There is typically a sweet spot, and that varies depending on the structure and usage patterns of your package. But please do not bundle your package’s dependencies in there as well — these need to remain separate, so they can be shared with other packages that use the same version of the same dependency. Nudeps does one job, so there are things it doesn’t do, and things it doesn’t do yet : Nudeps is just the beginning, and is far from perfect. There are certainly plenty of unknown unknowns, and many things we simply haven’t gotten around to. Besides bugfixes and closing the gaps above, at the top of the roadmap is testing more packages to ensure compatibility and uncover edge cases. If you want to give Nudeps a try, the easiest way is to head to your terminal and run in your project directory — or just let your agent do it. Get Nudeps Demos Nudeps on npm I’m hoping that Nudeps is the first step towards a future of lighter, composable build tools . Try it and let us know how it went! Thanks to the beta testers: @g12n , @jak2k , @lgarron , @beejunk . Thanks to Jordan Harband for his early feedback around package subsetting. And as always to my apprentice Dmitry for his help working out the kinks and making this a reality. Which you can choose to read as either nude deps or nu (new) deps ↩︎ Of course if you need to start a server for development, that doesn’t make a ton of difference. But localhost is cheap. Your editor can start one. Your agent can start one. Heck, I even have one running at the root of all my cloned repos. ↩︎ You run and it will set everything up for you. You add to your HTML through whatever mechanism you want, before any other scripts that import dependencies: Adds Nudeps to your Adds two scripts that run : , so Nudeps re-runs itself every time you or , and , so a fresh clone is ready too. copies the necessary files from into a directory, which is meant to be deployed, but not committed: it is regenerated on every , and comes with its own flattens the directory structure by including the version number in the directory name (e.g. becomes ) which gives you better deduplication and granular cache busting, generates an import map injection script with all specifiers in your direct dependencies and the specifiers they actually use, using JSPM under the hood. Local packages ( ) npm aliases ( ) git dependencies ( ) npm workspaces (experimental) Adding entries to (the generated files already ignore themselves) Running manually, adding it as an script, or even running manually because it thought it was a custom script. It wasn’t aware of the hook (and would in fact insist it doesn’t exist 😅) Adding config file overrides that weren’t necessary Nudeps works much better with ESM packages. CJS support is very experimental. Some packages unfortunately assume that they are running in a Node.js environment and rely on Node.js-specific APIs like . For the most common ones, you can just stub them, but if it starts getting out of hand, you’re better off using a bundle for that particular package (you can add overrides via Nudeps’ config). It doesn’t transform your code. Anything that needs compiling (JSX, TypeScript, Svelte) still needs its own tool, which Nudeps happily works alongside. npm only, for now. Supporting other package managers (pnpm, yarn, etc) is at the top of the roadmap, since many people today have moved away from npm. Non-JS dependencies need actual URLs, not specifiers. Workers also don’t do specifiers, see No benchmarks yet. Depending on the package structure and type of usage, bundlers may be significantly faster or even slightly slower. It would be nice to get some data on this. Which you can choose to read as either nude deps or nu (new) deps ↩︎ Of course if you need to start a server for development, that doesn’t make a ton of difference. But localhost is cheap. Your editor can start one. Your agent can start one. Heck, I even have one running at the root of all my cloned repos. ↩︎

0 views
Anton Zhiyanov 2 weeks ago

Probabilistic data structures in Go

Probabilistic data structures give you approximate answers to questions about the data they handle. Does the set contain a certain item? How many unique items are in the collection? Which items appear most often? Unlike deterministic structures like sets and frequency tables, the answers might not be exact, but in return, you can drastically reduce memory usage. In this post, we'll talk about what probabilistic structures are, how they work, and what kinds of guarantees they provide. I'll also introduce unsure — a package that implements these structures in Go. It's simple (the core logic for each data structure is 100–300 LOC), fast (usually several times faster than other implementations), and has no dependencies except for the standard library. Bloom filter • Count-min sketch • HyperLogLog • T-digest • Top-k A Bloom filter is a set that trades certainty for space. It can tell you that an item is definitely not in the set, or that it probably is (which might be a false positive). The filter doesn't actually store the items, so it's much more compact than a regular set. For example, a regular set with 1,000,000 distinct 8-byte strings takes about 64 MB. A Bloom filter for the same strings, with a 1% false positive rate, uses only 1.24 MB (about 10 bits per item) — that's 50 times smaller. The size of the filter doesn't depend on the item size, so the difference gets even bigger with longer strings. A Bloom filter often resides in memory and helps minimize expensive I/O operations such as disk reads or network calls. You check if an item is in the filter, and if the answer is "no", you skip the costly lookup. If the answer is "yes", you still have to perform the lookup because it might be a false positive. The filter is sized for the given number of items with a given false positive rate. You can add more, but the false positive rate will go up. You can add an item to a Bloom filter and check if an item is in the filter, but you cannot delete an item, count the number of items, or iterate over them. Bloom filter 1 is a large array of m bits, all set to zero at first. To add an item, you compute k hash values for it and set the k bits at those positions: To check if an item is in the filter, you compute the same k hashes and check if all k bits are set: The k bits are randomly distributed throughout the entire array. When the filter is larger than the CPU cache, each bit access could result in a cache miss, so a lookup may wait on memory k times. Unsure uses a blocked Bloom filter 2 . The bit array is divided into 512-bit blocks, each matching the size of a CPU cache line. When you add or check an item, it is hashed once: part of the hash selects a block, and the rest selects k bits within that block. Each add or check only accesses one cache line, so the filter stays fast even when it's very large. In a blocked Bloom filter, some blocks end up with more items than others, which increases the false positive rate. To make up for this, the filter needs to be a bit larger. Compared to a standard Bloom filter, it uses about 3% more memory at a 1% false positive rate, 8% more at 0.1%, and 15% more at 0.01%. The filter uses the local wyhash 3 implementation for hashing. It performs roughly the same as xxh3 4 but has a much simpler implementation, without SIMD or assembly. Here's an excerpt from the full benchmarks 5 , comparing unsure to bits-and-blooms 6 (a classic Bloom filter) and gloom 7 (a blocked one) (ns/op, lower is better): Memory, bits per item at 10M items (lower is better): Unsure is about 4× faster than bits-and-blooms and 2× faster than gloom , using 1–8% more memory than bits-and-blooms and 4–10% less than gloom . A count-min sketch is a frequency table that trades accuracy for space. It tells you approximately how many times each item has appeared. The estimate is never less than the actual count, but it can be higher . The sketch doesn't actually store the items, so it's much more compact than a regular map of per-item counts. For example, a regular map counting 1,000,000 distinct 8-byte strings takes about 64 MB. A count-min sketch for the same strings, with estimates within 0.01% of the total count (with 99% probability), uses only 0.55 MB — that's 116 times smaller. The size of the sketch doesn't depend on the number of distinct items or their size, only on the accuracy you choose. So the difference gets even bigger with more or longer strings. A count-min sketch is useful when you want to track how many times an item shows up in a large stream of events. It's often used to check if something has happened a certain number of times, like rate-limiting an IP after X requests or sending an alert after an error happens Y times. A sketch can also help decide if a key is worth keeping in the cache given how often it was requested. The sketch uses two settings: epsilon ε and delta δ . If the actual count for any given item is X and the total of all counts is N, then the estimated count for this item will usually be between X and X+ε·N. However, rarely (with a probability of δ) the estimate could be even higher. For example, if ε is 0.001, δ is 0.01, and N is 1 million, then the estimate could be off by up to 1,000 (ε·N) with at least 99% probability (1−δ), and by more than 1,000 with at most 1% probability (δ). The counting error in a sketch depends on the total of all counts, not on each individual item. Therefore, frequent items are estimated more or less accurately relative to their count, but rare items are not — the absolute error is too high for them. You can increase the per-item counter in a sketch and get the estimated count for an item, but you cannot decrease a counter or iterate over the items. Count-min sketch 8 is a table of counters with d rows and w columns, all starting at zero. Each row uses its own hash function that maps an item to one of the w counters. To add an item, you increment its counter in each row: To estimate an item's count, you take the smallest value from its d counters: With w = e/ε columns, each counter's error is at most ε·N, with probability at least 1 − 1/e. If you use d = ln(1/δ) rows, the chance that all d of the item's counters exceed its true count by more than ε·N is ≤ δ. Unsure uses a conservative update . When you add n to an item, it first finds the current estimate E (the smallest counter), then increases only the counters that are below E+n, leaving the larger ones unchanged. This keeps the same accuracy guarantee, but the actual error is about 2× lower. The tradeoff is that counts can't be decreased. Counters are 32-bit instead of the usual 64-bit, so the sketch uses 2× less memory. The item is hashed once, and each row gets its own position from that hash by salting it (multiplying by a random per-row constant). The sketch uses wyhash for hashing. Here's an excerpt from the full benchmarks 9 , comparing unsure to BoomFilters 10 (a classic count-min sketch with 64-bit counters) (ns/op, lower is better): Accuracy at ε=0.0001, N=10M additions over 1M distinct items, mean overestimate (lower is better): Unsure is about 1.5× faster for Add and 4× faster for Count, using 2× less memory with 2–2.7× lower error. HyperLogLog is a unique items counter that trades accuracy for space. It tells you approximately how many distinct items it has seen, no matter how many times each one appeared. HyperLogLog (also called a sketch from here on) doesn't actually store the items, so it's much more compact than a regular set. For example, a regular set of 1,000,000 distinct 8-byte strings takes about 64 MB. A HyperLogLog sketch counting the same strings with about 0.8% error uses only 16 KB — that's almost 4,000 times smaller. The size of the sketch doesn't depend on the number of items or their size, only on the accuracy you choose. A 16 KB sketch counts a billion items as accurately as a thousand. HyperLogLog is useful when you need to count unique things in a large stream: unique visitors to a website, unique search queries per day, or distinct values in a database column. You can merge sketches to gather data from multiple machines or segments (like by hour, page, or region). When you merge two sketches, you get the total number of unique items from both, without counting shared items twice. The sketch has one setting: the precision p , which gives a relative standard error (stdErr) of 1.04/√(2^p). A common default is p=14, which gives 0.81% error. With p=14 and 1 million distinct items: The error is relative to the count, so the standard error is the same 0.81% for a thousand items or a billion. You can add items to a sketch, get the estimated count, and merge sketches. You cannot check if a specific item was added, remove items, or list them. HyperLogLog 11 is based on a simple observation. If you hash items to random bit strings, about half of them start with 1, a quarter with 01, an eighth with 001, and so on. Seeing a hash with k leading zeros suggests there were about 2^(k+1) distinct items. Duplicates hash to the same value, so they don't affect the result. A single observation is unreliable, so the sketch divides the items into m = 2^p groups, where p is the selected precision. The first p bits of the hash pick a group (a register ), and the register keeps the highest rank (leading zeros plus one) it has seen in the rest of the hash: The count is estimated from all the registers together, using a harmonic mean of 2^register. The standard error is about 1.04/√m. Merging two sketches is just taking the maximum value from each pair of registers. The original estimator is biased when dealing with small counts (up to a few times m), so in these cases it uses a different formula called linear counting . This switch creates a sudden change in error, and some implementations (like HyperLogLog++ 12 ) address it by using large tables of bias corrections based on real data. Unsure uses the improved estimator by Otmar Ertl 13 . Instead of a harmonic mean of the registers, it works from a histogram : how many registers have value 0, value 1, and so on. A formula applied to the histogram gives an accurate estimate for any number of items, from zero to billions, so there's no need for a separate formula for small counts or for correction tables. The sketch updates the histogram whenever registers change. Most adds don't change any registers, so this is almost free. Counting always takes the same amount of time, no matter how big the sketch is. Other implementations scan all the registers on every count, which takes from microseconds to milliseconds. Registers are one byte each, and the histogram has 64 four-byte counters (256 bytes). The item is hashed once with wyhash , and the 64-bit hash is split into the register index and the rank. Here's an excerpt from the full benchmarks 14 , comparing unsure to axiom 15 (HyperLogLog with LogLog-Beta estimator and sparse mode) (ns/op, lower is better): Accuracy at p=14 (0.81% standard error), relative RMSE over 100 sketches (lower is better): Memory at p=14 after adding the given number of distinct items (lower is better): Unsure adds about as fast as axiom , counts 270–83,000× faster, and merges 2.3–2.9× faster, with the same accuracy and memory for counts above the number of registers. When there are fewer items than registers, axiom 's sparse mode makes it more accurate and compact. A t-digest is a summary of a stream of numbers that trades accuracy for space. It can give you an approximate median, 99th percentile, or any other quantile of the data. It can also estimate what fraction of the numbers are below a certain value (the CDF). The digest doesn't actually store the numbers, so it's much more compact than a sorted list. For example, to find the exact 99th percentile of 1,000,000 numbers, you'd have to keep all of them. With 64-bit floats, that takes 8 MB. A t-digest estimates the same percentile within about 0.03% of the rank (between the 98.97th and the 99.03rd percentile) using only 8 KB — 1,000 times smaller. The size of the digest doesn't depend on the number of values, only on the accuracy you choose. An 8 KB digest summarizes a billion values as well as a million. A t-digest is useful when you need quantiles over a large stream: latency percentiles for a service, the distribution of request sizes or prices, or the outlier thresholds in sensor data. You can merge digests to gather data from multiple machines or segments (like by hour, endpoint, or region). A merged digest estimates the percentiles of all values, but with less accuracy than individual digests do. The digest has one setting: the compression δ , which limits the number of centroids (see How it works below) to δ+2. A common default is δ=100, which takes 8 KB. Increasing δ uses more memory but reduces estimation error. The error is measured in ranks: a rank error of 0.03% at quantile q=0.99 means the value returned by is somewhere between the 98.97th and the 99.03rd percentile of the actual values. Tail estimates, such as q=0.99 or q=0.999, are more accurate than the median (q=0.5). You can add numbers to a digest, estimate quantiles and the CDF, and merge digests. You cannot remove numbers or list them. T-digest 16 summarizes the numbers as a sorted list of centroids . Each centroid has a mean and a weight — the number of values it represents. To estimate a quantile, the digest finds the centroids around the requested rank and interpolates between their means. The trick is in how big the centroids are allowed to grow. A scale function k(q) maps a quantile q to a number from -δ/4 to δ/4, and each centroid may only span 1 unit of k: if a centroid covers the quantiles from q₁ to q₂, then k(q₂) − k(q₁) ≤ 1. The arcsine scale function, k(q) = δ/(2π)·asin(2q-1), is steep near q=0 and q=1 and flat near the median. This means the centroids it produces are larger in the center and smaller at the ends: With 1M values and δ=100, the centroids around the median hold about 27,000 values each, those around the 99th percentile about 5,000, and the outermost ones about 500. This keeps the error near the tails small. Unsure is the merging t-digest from the Dunning and Ertl paper. New values go to a buffer of 5·δ numbers. When the buffer is full, the digest sorts it and merges it with the centroids (already sorted) in a single pass, building new centroids from left to right as long as each one fits within its span of k. Every other pass goes right to left, so that neither tail ends up with fuller centroids. , and flush the buffer first. The centroids are kept in two fixed arrays of δ+2 entries (the current list and the next one being built), along with the cumulative weights for a binary search in and . With δ=100, that's 16·102·2 + 8·103 bytes for the centroids, and 8·500 bytes for the buffer, about 8 KB in total. Centroids with weight 1 are treated as exact values rather than spread around their mean, and the exact minimum and maximum are used at the ends. So digests with few values give exact results, and and are always exact. Here's an excerpt from the full benchmarks 17 , comparing unsure to influxdata 18 (merging t-digest with the same scale function) (ns/op, lower is better): Accuracy at δ=100, mean rank error over 1M normal values (lower is better): Memory at δ=100 (lower is better): unsure 8.5 KB, influxdata 14.4 KB. Unsure adds values about 1.8× faster than influxdata , queries at the same speed, merges 7–9× faster, and uses 40% less memory at about the same accuracy. A Top-k sketch finds the k most frequent items in a stream (the "heavy hitters"), along with their approximate counts. It uses a fixed amount of memory based only on k, no matter how many different items are in the stream. To find the exact top items, you'd have to count every unique item, for example with a map of per-item counts. With millions of distinct items, that takes tens or hundreds of megabytes. A Top-k sketch for the top 1000 items takes about 360 KB, and it usually finds all of them. A Top-k sketch is useful when you want to identify the "hottest" data: the most requested URLs, the most active users, or the most common search queries. Unlike a count-min sketch, it keeps the actual items, so it can list them. returns up to k items, from the most frequent to the least frequent. Counts are estimates: they're usually exact for the most frequent items, but may be slightly lower than the actual count for less common items. The sketch works best when the stream is skewed, meaning a few items appear much more often than the others. This is common in real situations. If all items are about equally frequent, there is no clear top k, and the results become less accurate. You can add items to the sketch and get the top items with their counts, but you can't decrease counts or check items that aren't in the top k. HeavyKeeper 19 is a table of buckets that estimates item counts. It has d rows and w columns, and each item maps to one bucket in each row. Each bucket holds a fingerprint of the item and a count. To add an item, you update its bucket in each row: The item's estimated count is the largest count among its buckets. Frequent items quickly reach counts that make decay very unlikely, so they keep their buckets. Rare items keep replacing each other without affecting the frequent ones. An item that becomes frequent later in the stream can still outnumber a less frequent owner and take over its bucket. Next to the table, the sketch keeps a min-heap with the k items that have the largest estimates so far. After an item's buckets are updated, if its estimate is larger than the smallest count in the heap, the item is added to the heap, and the smallest item is removed. If the item is already in the heap, its count is increased. Unsure uses d = 2 rows of max(16k, 256) buckets, and a decay base of b = 0.8. The probabilities b^count are precomputed as 64-bit thresholds, so decay is cheap: the count c decreases if a random number is below the c-th threshold. The original HeavyKeeper uses b = 1.08⁻¹ ≈ 0.93, and more rows. A smaller b lets frequent items lock their buckets faster, which makes the sketch more precise on flat streams. However, if b is too small (like 0.5), the first items to claim buckets keep them permanently, so items that become frequent later are never counted, even if they end up being the most frequent. Using b = 0.8 keeps most of the precision and still catches most late-arriving frequent items. As for the rows, two are enough to protect frequent items from collisions in a single row, and adding more rows only makes the sketch slower. The item is hashed once. The hash is mapped to a position in each row by salting it (multiplying by a random per-row constant). The fingerprint is the top 32 bits of the hash. The heap uses the 64-bit hash to identify items, so it doesn't compare the actual item bytes. Each bucket is 8 bytes (a 32-bit fingerprint and a 32-bit count), so the table takes 256·k bytes. The heap takes about 100 bytes per item plus the item itself. The sketch uses wyhash for hashing and wyrand for random numbers. Here's an excerpt from the full benchmarks 20 , comparing unsure to keiler 21 (HeavyKeeper with b = 0.9 and d = ln k) and dgryski 22 (Filtered Space-Saving 23 ) on the Zipf s=0.8 stream (time/op, lower is better): Precision is the fraction of the reported top k that is in the true top k (higher is better): Count error is the mean of |estimate − true| / true over the reported items (lower is better): Unsure is 2–4× faster than the others for Add and 1.8–4× faster for Top. On flat streams (s=0.6), it finds the true top k with 90–97% precision, while keiler drops to 38–70% precision with a count error of 62–94%, and dgryski to 19–52% with counts 18× or more too high. On skewed streams (s=1.0), all three are about equally accurate. As engineers, we usually want exact answers from our data. But sometimes, allowing a bit of uncertainty can cut memory usage by tens, hundreds, or even thousands of times. That's where probabilistic data structures come in: To use them in Go, try the nalgeon/unsure package: Space/time trade-offs in hash coding with allowable errors by Burton H. Bloom, 1970.  ↩︎ Cache-, hash-, and space-efficient Bloom filters by Felix Putze et al., 2009.  ↩︎ Reference wyhash implementation by Wang Yi.  ↩︎ Reference xxHash implementation by Yann Collet.  ↩︎ Bloom filter benchmarks .  ↩︎ bits-and-blooms/bloom by Daniel Lemire.  ↩︎ jcalabro/gloom by Jim Calabro.  ↩︎ An improved data stream summary: the count-min sketch and its applications by Graham Cormode and S. Muthukrishnan, 2005.  ↩︎ Count-min sketch benchmarks .  ↩︎ tylertreat/BoomFilters by Tyler Treat.  ↩︎ HyperLogLog: the analysis of a near-optimal cardinality estimation algorithm by Philippe Flajolet et al., 2007.  ↩︎ HyperLogLog in practice by Stefan Heuleet et al., 2013.  ↩︎ New cardinality estimation algorithms for HyperLogLog sketches by Otmar Ertl, 2017.  ↩︎ HyperLogLog benchmarks .  ↩︎ axiomhq/hyperloglog by Axiom.  ↩︎ Computing extremely accurate quantiles using t-digests by Ted Dunning and Otmar Ertl, 2019.  ↩︎ T-digest benchmarks .  ↩︎ influxdata/tdigest by InfluxData.  ↩︎ HeavyKeeper: An Accurate Algorithm for Finding Top-k Elephant Flows by Junzhi Gong et al., 2018.  ↩︎ Top-k benchmarks .  ↩︎ keilerkonzept/topk by KEILERKONZEPT.  ↩︎ dgryski/go-topk by Damian Gryski.  ↩︎ Efficient Computation of Frequent and Top-k Elements in Data Streams by Ahmed Metwally et al., 2005.  ↩︎ If any of the bits is not set, the item definitely was never added. If all the bits are set, the item was probably added, but it's not guaranteed (the bits could have been set by other items). Other items might hash to the same counter, so each counter value is ≥ true count. The smallest counter is the one with the fewest collisions, so it's the best estimate. 68% of the time the estimate is within 0.81% (8,100) of the true count, 95% within 1.6% (2·stdErr), 99.7% within 2.4% (3·stdErr). If the bucket is empty or owned by the item, increase its count. If the bucket is owned by another item, decay it: decrease its count by 1 with probability b^count (b < 1). When the count reaches 0, the new item takes over the bucket with a count of 1. Bloom filter checks if an item might be in a set. Count-min sketch estimates how many times each item has occurred. HyperLogLog estimates the number of distinct items. T-digest estimates quantiles of a stream of numbers. Top-k sketch identifies the most frequent items in a stream. Space/time trade-offs in hash coding with allowable errors by Burton H. Bloom, 1970.  ↩︎ Cache-, hash-, and space-efficient Bloom filters by Felix Putze et al., 2009.  ↩︎ Reference wyhash implementation by Wang Yi.  ↩︎ Reference xxHash implementation by Yann Collet.  ↩︎ Bloom filter benchmarks .  ↩︎ bits-and-blooms/bloom by Daniel Lemire.  ↩︎ jcalabro/gloom by Jim Calabro.  ↩︎ An improved data stream summary: the count-min sketch and its applications by Graham Cormode and S. Muthukrishnan, 2005.  ↩︎ Count-min sketch benchmarks .  ↩︎ tylertreat/BoomFilters by Tyler Treat.  ↩︎ HyperLogLog: the analysis of a near-optimal cardinality estimation algorithm by Philippe Flajolet et al., 2007.  ↩︎ HyperLogLog in practice by Stefan Heuleet et al., 2013.  ↩︎ New cardinality estimation algorithms for HyperLogLog sketches by Otmar Ertl, 2017.  ↩︎ HyperLogLog benchmarks .  ↩︎ axiomhq/hyperloglog by Axiom.  ↩︎ Computing extremely accurate quantiles using t-digests by Ted Dunning and Otmar Ertl, 2019.  ↩︎ T-digest benchmarks .  ↩︎ influxdata/tdigest by InfluxData.  ↩︎ HeavyKeeper: An Accurate Algorithm for Finding Top-k Elephant Flows by Junzhi Gong et al., 2018.  ↩︎ Top-k benchmarks .  ↩︎ keilerkonzept/topk by KEILERKONZEPT.  ↩︎ dgryski/go-topk by Damian Gryski.  ↩︎ Efficient Computation of Frequent and Top-k Elements in Data Streams by Ahmed Metwally et al., 2005.  ↩︎

0 views
matduggan.com 2 weeks ago

So all software is free as in money now?

A few weeks ago I was up late in my kitchen. I've always been a bad sleeper, starting from when I was 10 and would spend whole nights reading books and watching the clock slowly wind it way to when I had to get up and go to school. Like most things, I hoped it would go away when I was older and instead has now become something I've just gotten used to. My friends all know this about me, so I'm typically who you call if you also can't sleep or have a sick baby and want to speak to another adult. It's whatever the opposite of a superpower is. It was during this period I got a text message from a friend with the line "someone has made the Adobe Suite with AI and it's free". Without any additional thought I proclaimed to my empty kitchen with its too-small European refrigerator "that's the stupidest fucking thing I've ever heard". There is frankly nothing worse than the endless cycle in tech of "we've cracked a hard problem in an easy low effort way". Every single time there is always a giant asterisks, something it doesn't do, something where the illusion falls away. Obviously I hadn't yet actually tried the software before I uttered this confident proclamation to my picture of a corgi as a dictator that I keep hanging on my kitchen wall. There was no way you could recreate what Adobe had made, right? When I graduated from college in 2008 and I watched in horror as my friends all moved back in with their parents, I decided I'd rather freeze to death in Chicago than suffer that fate. So I got a job that my childhood spent in local PC repair stores and college IT department helpdesks didn't really prepare me for by basically acting confidently. I was a corporate Mac IT contractor who wandered from skyscraper to skyscraper with my Manhattan Portage Messenger bag that had cost way too much money and hurt my shoulder with all the tools and spare 3.5 in hard drives I had to carry. The primary market for Macs at that time was college students and creative departments. Frankly, nobody else wanted them or had the budget for them. Creative departments inside of large corporations are a strange place to work. Often I would get escorted by security past rows and rows of cubicles (god remember when we thought cubicles were dehumanizing? We hadn't seen the unending horror of the open office plan yet). The creative department was usually the only place where even an attempt had been made to make the place less depressing. They often had like real books on shelves, art on the walls and the only employees in the entire place you would describe as "fashionable". The spaces were dominated by giant printers that would produce the full-size examples of "wraps" for buses or other large-scale advertisements. There were often a bank of color-calibrated monitors with hoods on them in a special area, which was always a thankless job. Color calibration was me attempting to prove with my little device that we were exactly on target with the Pantone colors on these specific monitors while the creative director would wander by, dressed like a college professor and confidently explain to me that "it's closer to Classic Green not Poison Green". They'd go get the Pantone color cards out of their office. From my perspective it seemed like a lot of people arguing a lot over whether to move rectangles in InDesign. There was no question that the tools they were using were Adobe tools. Nobody ever even asked if they really needed Adobe, in the same way that nobody ever asks "is water pressure actually important". The most reliable work I got was from a design studio in River North run by a woman named Donna. Donna was a life-long Chicagoan who seemed to liked me as an employee exclusively based on my willingness to walk and talk with her as she endlessly patrolled the upper level walkway. The pit area were all the designers and the upper ring was the senior staff. They did a lot of print advertisements and campaigns, which meant fonts. Fonts, for those unaware, need to be licensed to be used. Default fonts, at least for Donna, were basically trash not to be trusted as even placeholders. She was the keeper of the font licenses and the font license software, ensuring everything was paid for and allocated correctly. She liked to issue threats and then pretend they were a joke. "If a campaign ships with an unlicensed font, it'll be your ass! Anyway have a great day." She used to smoke in the alleyway behind the building in her pantsuits and a folded Wall Street Journal. I spent almost the rest of my time that wasn't spent on fonts troubleshooting problems with Adobe software. Teams would get legitimately nervous before updates to their core applications. Any changes to a shortcut would be met with a chorus of boos from the pit. The workflow was mostly ensuring that the local network share was up, backed up and performant. A lot of my day was ensuring the tape backups were working, shipping one set of backups to Iron Mountain for offsite storage which sounds cooler than it was. I was invited out to the temple of Adobe out in San Jose to chat with the folks there once. I don't remember the exact chain of events, but it was basically a large Adobe customer who wanted to ensure that they got some face time and I tagged along. I was horrified when you walked up to the building because at the time (around 2011) it basically looked like a bank. The lobby smelled like sorta old fabric and the offices were surprisingly run-down. Like as it turns out the nerve center for Photoshop was not quite as lux as that price tag would lead you to believe. It also didn't help that I never know how to dress for California weather. It's always colder than you think it would be? So after I tried and failed to find their parking garage, I ended up finding cheap(ish) parking like 5 blocks away and showed up to their office sweaty and flustered. But after spending the day with the folks there it was hard not to walk away with the impression that they cared deeply and truly about the sorts of creative problems their customers were trying to solve. They looked like the designers I was working with back in Chicago, with the same earrings and cool rolled up shirts. The demo stuff they were showing, I didn't really care about the software but I did care a lot about "is there maybe a way to shim a cheaper alternative to Adobe in there?" In short the people I met were very impressive and the answer was no. They had answers to every question I could imagine and every question my users had come up with. The software looked amazing and had just endless seas of options nested under options. I walked away with the complete confidence that regardless of what happened, unless they made a series of just catastrophic mistakes, they were entrenched forever in the creative space. Then they made a bunch of catastrophic mistakes. Originally creative software worked like....buying anything else expensive. It was a shrink-wrapped box that cost like an eye-watering amount, I think I remember $649 for Photoshop at some point. Then that turned into the Suite where it made sense to buy a license for the suite. This was kind of Adobe at the height of their powers, where it was cheaper to buy the whole rather than get the two parts you needed so then their file formats and patterns became just the default. Everyone needed one part of the suite so it was hard to kinda wedge yourself in there. If an upstart showed up they were typically acquired and then rolled into the Suite. Then Adobe watered down the value argument. I was still like vaguely involved with the entire ecosystem when the switch happened to Creative Cloud. It's kind of hard to...overstate how angry this made people. I don't think anyone has truly really measured the pure fucking fury that Adobe generated with this move. The combination of "there is no such thing as a perpetual license", the aggressive dark patterns for signup and the cancellation fees fundamentally changed the relationship Adobe had with its customers. Basically when Adobe retired perpetual license like a jersey, the vibes changed and the party was over. The best way I can describe it: some companies rely on the perception by their user that they have their best interest at heart. Apple is sorta like this. Adobe, I'd argue, was like this. The Microsoft Office team is maybe a bit like this as well. If Amazon screws you over well that's just them being their natural selves. Some greed is tolerated because they're cool and its understood to be a premium product. But if you cross sort of an invisible line of greed, the product is ruined in the minds of the consumers. For a lot of people, the butterfly keyboard Mac with no ports that broke a lot destroyed the entire concept of the Mac laptop for them. It was a shitty product that didn't work well that Apple didn't care enough to fix. There wasn't really a "coming back" for those users, because the illusion was shattered. Apple wasn't a cool group of creative California people they were assholes who were telling them to pound sand. Part of the mystique was killed and then you are left with a broken laptop and a trip to a dying strip mall. Microsoft Office was never the cheapest way to do a spreadsheet, word processing or slides, but it was pretty cheap and the file formats became the defacto standard. Then suddenly everyone collectively decided to cross the greed line at the same time. So I downloaded LightCraft as the primary Adobe software I use now is Lightroom. I've paid a subscription for...many moons for it. It works quite well, does exactly what I need. I had downloaded it expecting to hate it. Most LLM stuff looks nice and runs like shit, ending up being a giant waste of time. I also eye-rolled at "rewritten in Rust" which has become this new slang for "I didn't write any of it myself". At this rate nobody on earth will have ever hand-written Rust. The first sign something was good was how quickly it started. Adobe stuff opens slow, I assume to ensure that my paperwork is in order back at HQ. It also sipped RAM and CPU. As I went through my "workflow" which is a fancy way of saying "I take phone photos that suck very much and then try to make them slightly better", I was really impressed. The things weren't all in the same place, but more or less it worked as I expected it to. To be clear, I'm not suggesting these things are bulletproof. For instance, the Artcraft launcher is constantly telling me the launcher has an update. I'll hit update and it'll throw an error message. I'll quit the app and then it....seems to have applied the update? I also spent a few hours with DesignCraft which is their Adobe InDesign alternative and like we're still pretty far from that replacing InDesign as of right now. Great if you have some straight-forward needs for InDesign, but I think the Adobe moat is pretty strong there. InDesign people live or die by impossibly hard to detect errors. All that said, I was surprised how close a lot of the features got . Especially considering this is an LLM written clean-room implementation. Now to be clear I'm not a lawyer and that explanation makes no sense to me. I don't know why a "clean-room rewrite by an LLM" would be better than you making a Lightroom knockoff by hand. Feels like the clean-room part is making this sound a lot more scientific than it is. But as I spent hours clicking around and trying things out, I started to get a pit in my stomach. The best and worst thing about tech is that everything is constantly changing all the time. We've now gone from the moat being the price, distribution and shelf space to file formats, enterprise sales team to now the last remaining trickle of water being muscle memory and intellectual property. I was reading the interview in Ars with the folks behind this and the quote that popped out to me was "I one-shotted Photoshop. The whole thing". https://arstechnica.com/ai/2026/10/software-is-over-bold-ai-developer-takes-aim-at-adobe-with-open-source-clones/ That is a crazy sentence. If you aren't a developer, let me put it like this. Imagine if you read about the construction of Notre-Dame de Paris. Generations of workers, precise and hard to learn techniques, the whole thing. Some design elements we still don't fully understand today how they work. Then someone in Texas made a giant 3D printer that shot out a one to one copy in six months. Also there's a gift shop. I increasingly think the way we think about moats and barriers in software was always wrong. I think the actual moat was the goodwill built up over decades, the trust that these were professional tools and the people behind them wanted the best for you. Plus the 15+ years of muscle memory and just comfort in this ecosystem. You can 3D print software but you cannot really clean-room generate trust. But right now you don't need to, because every incumbent keeps giving their trust away, one dark pattern at a time. So what does this mean for software, if Adobe and Microsoft cannot keep the moat going? What if CADCraft does get good enough to threaten AutoCAD, a product with muscle memory older than some nations? Are we ever going to sell desktop software again, or is the future just an endless series of clones, produced by LLMs, with what specific features you want? I don't know. Meanwhile, the launcher has told me there's another update to the LLM Lightroom somehow. Right now the race feels weirdly inevitably, like watching a horse beat a car once and knowing in your heart that the car is gonna win in the end.

0 views
Lea Verou 2 weeks ago

Candidate Statement for the 2026 W3C TAG Election

Group photo of the W3C TAG in July 2022 with me to the left of Sir Tim Berners-Lee (inventor of the Web and TAG chair emeritus). Photo credit: Dan Appelquist I had the great honor of being elected to the TAG by the W3C membership in 2020 and again in 2022 , serving two terms from 2021 to 2025. After a two-year break, this year I’m running to return, thanks to Google, Microsoft, and OpenJS Foundation pooling resources to make it possible. 💙 The W3C Technical Architecture Group (TAG) is the Working Group that ensures that Web Platform technologies are usable and follow consistent design principles, whether they are created inside or outside W3C. It advocates for the needs of everyone who uses the Web and everyone who works on the Web. If you work for a company that is a  W3C Member , please consider encouraging your AC rep to vote for me ! (Ask me if you don’t know who that is) My candidate statement follows. I’m Lea , and I’m running to return to the TAG, where I served two terms from 2021 to 2025. It was some of the most fulfilling work of my career. The only reason I did not run in 2024 is that the job takes hundreds of hours a year, which as an independent I could not sustain pro bono. This year, in recognition of my service, Google, Microsoft, and the OpenJS Foundation have pooled resources to fully fund my participation , so I can finally commit the time the job deserves while remaining independent . My work spans the entire web platform : 14 years in the CSS Working Group, active participation in TC39 and WHATWG, two decades of building for the web, and open source running on millions of websites. In 2025 the OpenJS Foundation recognized my overall impact on the web platform with its Pathfinder for Standards Award . That breadth is exactly what the TAG requires. With a PhD in Human-Computer Interaction from MIT and a 20+ year career that includes entrepreneurship and product leadership, I combine academic rigor and big-picture perspective with pragmatism , an eye for hard tradeoffs , and a deep commitment to user needs . And as a bilingual Greek woman, I bring a Mediterranean and European perspective and firsthand appreciation of the Web’s internationalization needs. For more on my background, see my 2020 and 2022 candidate statements. In my four years on the TAG, I worked to direct the group’s limited time towards maximizing impact: I co-led the Web Platform Design Principles , turning previously implicit design knowledge into published guidance that improves consistency across the platform and helps reviews scale, started the Web Platform Gaps initiative to find what the platform is missing, served as liaison to TC39 to keep JavaScript and Web APIs consistent, and participated in hundreds of design reviews, becoming the TAG’s go-to reviewer for API design. But I believe the TAG can, and should , do more. The Web is changing rapidly, and reactive review is no longer enough. The TAG is uniquely positioned to see the platform as a whole, yet it mostly encounters features after their architecture has taken shape, sometimes even after they ship. By then, consequential decisions are difficult to change. Who identifies gaps that span multiple working groups? Who sketches the big cross-cutting solutions, or decides which layer a problem belongs in when that is non-obvious? Individual groups see their own slice, and the sum of several low-level views is not the big picture. The result is architectural debt . I want the TAG to help shape the architecture of the Web, not just review it. To proactively identify gaps, sketch coherent, composable solutions, and then bring the relevant working groups into the conversation to develop and standardize the pieces within their scope. Not to take over their work, but to provide the cross-cutting architectural perspective that no individual group is positioned to offer. Expanding the gap analysis work I began last term is the first step, and my work since then has given me a much richer evidence base to draw from. I am one of the people leading Modern Web Guidance , a multi-vendor project teaching AI coding agents to use the modern web platform effectively and follow best practices. This work involves reviewing implementation instructions for a broad range of use cases, ensuring they reflect the best the modern Web has to offer. This makes the many ways the web platform still falls short incredibly salient, revealing systemic gaps that are easy to miss when looking at web features in isolation. The biggest change since my last term is that a growing share of the code targeting the web platform is written by AI agents , and a growing share of the Web is consumed by them. The TAG should treat this as an architecture question and answer it with principles and evidence, not enthusiasm or alarm. Many of the principles that make APIs robust and usable for humans also benefit agents, but the differences expose new tradeoffs that deserve careful architectural attention. And none of this changes what the Web is for: user agency, privacy, accessibility, and interoperability apply no matter who, or what, writes the code, and defending them is the TAG’s job. I am not employed by a browser vendor or a big tech company, and my funders do not direct, approve, or veto my positions. I remain free to disagree with any of them, in public, on any proposal. My only agenda is a web platform that lives up to its potential and remains owned by no one . I’ve spent four years helping the TAG improve the Web. I want to help it shape the Web’s future, and for the first time, I have the resources to see it through. I would like to thank the OpenJS Foundation, Google, and Microsoft for fully funding my TAG participation in the event that I am elected, and OpenJS Foundation and Bocoup for partly funding it during my previous terms.

0 views
Stratechery 3 weeks ago

An Interview With Intuit CEO Sasan Goodarzi About Accounting and AI

Listen to this post: Good morning, This week’s Stratechery Interview is with Intuit CEO Sasan Goodarzi . Goodarzi took a very non-traditional path to Silicon Valley, joining Intuit in 2004 after working at Siemens and Honeywell. After managing business units across the company he became CEO in 2019, and is taking on the challenge of figuring out how one of tech’s oldest software companies manages the AI paradigm shift. In this interview we discuss Goodarzi’s background and the what it takes to be an effective generalist, and get his take on how Intuit has thrived for 44 years. We discuss the shift from Quicken to Quickbooks, the TurboTax business, and how Goodarzi thinks about the consumer space today. Then we talk about accountants, Intuit’s most important customer acquisition channel, and how the company wants to change the profession from partners to customers via AI. I present the case to Goodarzi that Intuit seems like its being disrupted, and he makes the case why they are well positioned to actual grow their market. We also touch on acquisitions like Credit Karma and Mailchimp, and how Intuit has managed business model changes in the past, and what needs to change in the future. As a reminder, all Stratechery content, including interviews, is available as a podcast; click the link at the top of this email to add Stratechery to your podcast player. On to the Interview: This interview is lightly edited for clarity. Sasan Goodarzi, welcome to Stratechery. Sasan Goodarzi: Thank you for having me, I’m a big fan of all the work that you do. It’s great to be a part of it. Well, we’ll get to my relationship with Intuit, which I’ve had for many years. Big fan? I’m going to have to think about that one. We are here to talk about Intuit, a company that you have been at, with a brief break, for over 20 years. Before we get to that, however, tell me about your background, which is a very interesting one. Let’s start with where you were born. SG: Yes, I was born in Tehran, in Iran, and I am the youngest of three — 13 years younger than the other two brothers. I was told I was special, I think I was an accident, so there you go. And back then, you’d ship your kids to the U.S. because everybody wanted to come to the U.S. to study and so my brothers were in the U.S. already studying, and my parents decided to do an experiment with me and shipped me to the U.S. at the age of nine and I was very fortunate, because the revolution actually happened. Got it. So you had already left before then, I wasn’t quite sure on that timing. SG: Yeah, yeah. I was very fortunate, I left before the revolution, about eight to nine months before the revolution, and have been in the U.S. ever since. Where did you end up in the U.S.? SG: I came to Orlando, Florida of all places, because my brothers were going to the University of Central Florida. And, by the way, back then we used to say, “U Can’t Finish”, that’s what we called it, but it’s a great university. But anyways, for that reason, I was in Orlando until my early 20s, until I started being moved by Honeywell. Every couple of years, I was going to a different state, which was a lot of fun, and eventually ended up in California. You studied electrical engineering, right? And then you were at Honeywell and Invensys. What were you doing there? I mean, it doesn’t seem quite the obvious path to being CEO of Intuit, to say the least. SG: Not at all. In fact, it’s advice I give, career advice I give to folks. I actually started at Siemens, I was a technical marketing person, which really — I don’t know why they called it marketing, it was all a technical role that supported our field sales folks. I was in the power generation business unit at Siemens so I used to go pitch why our power generation was better than anybody else’s. I don’t think they need much marketing these days in the Siemens Power Generation Unit. SG: (laughing) Yeah that’s right, they don’t. I did that for four years and frankly, I didn’t know what I wanted to do with my life, because in the meantime, I was doing startups on the side. In fact, before I even started at Siemens, I did a startup called Lazer Cables — with, at that time, a very good friend that was actually the genius behind the idea of fiber optics for the music industry, so I was dabbling in a lot of different stuff. When I was at Siemens, I love the company, but I was wondering, “Is the corporate world cut out for me?”, and I got recruited to Honeywell. And at Honeywell, they put me — it was like business development. In essence, they put me in charge of something they were experimenting with, which was just down my alley, because it was, in essence, a startup as part of Honeywell and I fell in love with the company because of that. I was there, I think like eight years. So is this — was this going to different states? Was that because Honeywell, being a defense contractor, they just have to source from everywhere? Is that the connection? SG: Yeah, but I was in the industrial home automation division. So if you look at my background, I’ve been in power generation, I’ve been in home and buildings automation, I’ve been in industrial, which means I was selling software and hardware at the time to oil companies that need to manage all of their oil and gas in the fields. I’ve been in all of those different industries and then, to your point, I got a call from Honeywell, so my whole background is enterprise and oil and gas and all those different industries. So my forte was getting into something and diagnosing quickly what was going on and what should we do about it, my expertise wasn’t in any one industry. And then, when at the time Intuit called me, I didn’t even know what the company was. Right. It’s a very non-obvious connection, so what did they see? How did they find you? SG: I think the reason they found me is, at the time, the CEO had come from GE Capital, Steve Bennett . And I think at the time, they were looking for folks that knew how to run businesses, not — these are their words, not mine — not a typical Silicon Valley grown-up leader, and that’s what attracted them to me. And I was trying to figure out what Intuit was, because, one, I had never served consumers, businesses — it was always enterprise. But I really fell in love with, at that time, the culture of the company and the leaders of the company. And when I joined, I’ve been here sort of ever since — 20-some-odd years. Well, you did leave briefly to be CEO of energy company Nexant. What advantages do you think you gained from not having at all a traditional Silicon Valley CEO background? And also, on the flip side, what challenges has that presented? SG: The biggest learning I had, which had to come innate because I was in a new job almost every three years, is curiosity — is going in and really diagnosing, really trying to get to the root cause of if something is going well, “Why?”, if it’s not going well, “Why?”. How do you assess the industry, the talent, the priorities? And so I became, only because I had to, a master of how to be curious and diagnose. Does this require a very systemic sort of thinking about the problem? What makes a good generalist? Because you, I mean, clearly you’re a generalist. So what makes that effective? SG: It is, in fact, what you just said. One, you have to be a systems thinker. You have to ask a lot of questions end-to-end, because, one, it’s not from one particular craft, and you don’t know the industry that well and so you have to ask a lot of questions. You have to understand what the customer problems are. Structurally, are you advantaged or disadvantaged? What kind of talent do you have? It requires a systems thinker. But I think the second is you learn how to hire great, great people. Why? Because you don’t know anything about the industry. Once you know what you got to go do, you need great people that know how to go do it, I think those are the advantages. The disadvantages can be that you don’t innately — like when I went from power generation business unit to serving oil and gas, they don’t have too many things in common, and so the disadvantage is intuitively, right off the bat, you wouldn’t know what to do. I think that’s the disadvantage. I would tell you, from what I have learned, I would take those disadvantages any day over a leader that’s curious, that can diagnose really, really well. Because it naturally — one of the things I love about Amazon is the Day 1 mentality. Every day is Day 1, and Day 1 truly is when you’re curious, and you’re trying to understand what’s going on, and what kind of impact can you have. Well, when you don’t know an industry, it is truly Day 1. If you know an industry very, very well, you actually have to work hard to ensure that you’re diagnosing versus, “I have the answers to everything”. I think people would generally think oil and gas, energy, tech, totally different. Is there, though, a commonality in terms of where the investment takes place and the marginal cost of serving customers over time? Is that similar, or are there still really important differences there? SG: There are a lot of similarities I have learned over time in terms of just how do you run a business. So it’s just general management is the commonality? SG: And, by the way, I actually think it applies in this environment more than ever, frankly, because structural advantages — are there any in this environment? What is your structural advantage? Making sure that you’re curious about how you really reinvent experiences because of what’s possible with AI. I think there’s a lot of commonalities, inclusive of — this is probably the biggest thing I would say when I came, and I have a lot of respect, by the way, for all the companies and all the leaders in the Valley because, frankly, we are the ecosystem that drives global innovation, period, end of story. With that said, I think one of the things I’ve learned over my career is we can end up being sloppy in the Valley in terms of how we think about expenses, how we think about cost, how we think about allocation of capital. Those are things you just — when you come from oil, gas, power generation, where margins are thin, room for error is zero because, trust me, you do one thing wrong in oil and gas, you can blow up oil tanks. And so those things carry forward in terms of how do you build quality software, where do you put your money. But then there are things that don’t carry over, which is oil and gas has nothing to do with how consumers consume stuff. Right. Can generalists — could it be a sort of weakness of generalists — you said sloppy. And I think about the generalist angle and systems thinking and it’s easy to skim over the details, “Not that important”. Is that a challenge that you sometimes think about? SG: First of all, I think every leader, no matter what industry, has to have helicopter skills. I think you have to — one, I don’t think you can set clear vision of where you need to go and then move fast to get there if you’re not grounded in details. What does that mean? I mean, for me, details are, are you meeting with customers? Are you in your KPIs? Are you using products? Are you looking around corners in terms of what has to happen in your experiences? I think you have to be detail-oriented, and not just in this environment, I think every senior leader at every level has to have detailed orientation. Systems thinking doesn’t mean you lack detail orientation, it just means that you’re thinking about a problem end-to-end and because one of the biggest things I learned at Honeywell is — think about building a plane, just as an illustrative example, end-to-end, from the moment you say, “Build the plane”, to the moment that plane is on a runway — and thinking about it wing-to-wing. So you can end up building the engine much, much faster, but if you don’t actually think about wing-to-wing — what it takes to build the plane and how to reduce the cycle time of building the plane — then you don’t ship better and faster planes in a shorter period of time. So this notion of wing-to-wing is similar to end-to-end systems thinking. You have to really figure out how to draw the box because when you redraw the box, you redraw your TAM, you redraw what’s possible and that doesn’t mean lacking detail, it just means both become very important. If AI is very good at details, is AI the biggest gift to generalists ever ? SG: I think — by the way, I was on the record, you can go back and look, eight years ago, we went in on data and AI. And the stuff that exists today, of course, did not exist eight years ago and I was on the record saying — and many laughed at me — on the record saying that, next to electricity and the Internet, it would spark the largest global innovation that we could have ever imagined. I think it’s, for many, while it has a lot of risks, it’s going to level the playing field in terms of what’s possible, what you can do, what I can do, what many can do. It’s commoditizing a lot of stuff — and not just information, but insights and helping you make decisions, what it can potentially do to healthcare, what it can do to robotics, what it can do to space. I just think it’s freaking fascinating what’s possible. Is AI a systems thinker or is it a details thinker? SG: Oh, I think, in my view, it’s all about how you design it, that’s the biggest thing we’ve learned in all the agentic work that we’re doing — is it’s only as good as the context you give it, it’s only as good as the data that you give it. The biggest mistake in learning we had in the last couple of years is we, to answer your question, we launched a bunch of AI agents , a payments AI agent, a payroll AI agent, an accounting AI agent, and while they did everything in slices very well, they didn’t actually deliver a great experience end-to-end for customers. That’s because of what the capabilities were about a year ago, but also just how we had designed it, we didn’t design it as a systems thinker. I think it can be both and of course the capabilities are just growing day by day. But it comes down to the context and how you design it, in my view. I did want to do a little bit of a historical tour. It’s interesting to talk to you about Intuit. You’ve been there for 20 years and yet only been there for half of Intuit’s history, this is one of the granddaddies of Silicon Valley. So your first product — Intuit’s, not yours personally, but Intuit’s first product — was Quicken , founded way back in 1983. The company started QuickBooks in 1992, which underpins your largest business today, of which I am a longtime customer. Was Intuit one of the first examples of productivity software companies realizing there’s a lot more money selling to businesses than selling to consumers? SG: First of all, none of us would be here but for Scott Cook , our founder, that was watching his wife, Signe, try to balance the checkbook. I’m old enough, I remember I was taught how to balance the checkbook, I remember doing it way back in the day. SG: We still have that table here, right outside of this building that I’m in, that signifies why Intuit was born. But to answer your question, it was first really the company was invented based on, there’s a better way just to manage your budget, your checkbook, and your financials, which gave birth to Quicken. But really the biggest next “aha” was that businesses were trying to use Quicken to actually manage their business and that’s really the “aha” that Scott Cook and the team had at the time, which is, “Wait a minute, rather than making Quicken better, there is this thing that we can actually invent that helps businesses, manage and be organized and manage their books”. That’s what gave birth to QuickBooks and the QuickBooks franchise, which over time became something incredibly special. Right. Your customers were misusing the product and sort of pulled the new one out of you. SG: That’s right. And Quicken, by the way, ended up only being like a $100 million business, but the brand was so much bigger than $100 million, but it really gave birth to QuickBooks. And then over time — this is a company, by the way, it’s made up of acquisitions. Many don’t know the TurboTax of today was an acquisition of Chipsoft . I have a question about that. On this point to the QuickBooks transition — well, I mean, QuickBooks Online launched in 2000. Again, very, very early to serve something online. The actual transition of your business to the cloud took a lot longer. I’m just curious — you joined, in retrospect, it was the beginning of that transition, but still four or five years after it was online. What do you remember about that transition? What was the challenge there? Was it technological? Was it consumer education? Was it internal, your business model — going from package software to a SaaS model? What was hard about that? SG: I love your question, because it actually starts with where you started, which is, this is a 40-year-old-plus company, and there aren’t too many that have survived. Because remember, we were a company that was born in the era of desktop, right? Yep, package software. SG: We were shipping CDs. No, because we use the word “package software” today, but no one realized — no, it actually used to be packaged. It was a box you went to the store to buy, with — not a CD — with discs inside of it. SG: Thank you! Yes. By the way, that’s actually why I use the words “we used to ship stuff”, we used to ship disks and CDs because many in today’s environment, when you say that, they’re not sure what you mean by “packaged.” I joined right at the beginning of that. And the challenge — I tell you, I give the company and all the leadership prior to me a lot of credit, because there aren’t too many companies that were born in the era of DOS and had to go to the cloud, to mobile, and then the transition to AI. And the hardest part is both cultural — you’ve got a bunch of talent that is building what ends up on a disk, and then you ship the disk. It’s cultural, it’s technology, all of your code is siloed, all of your code is in a bunch of different cans called disks, none of them talk to each other. Yep, and it has to be finished. There’s no updates. SG: And there’s no updates! That’s right. And so it’s cultural, it’s technological, it’s talent, and then there is the dilemma of, “Wait a minute, so you want me to, in TurboTax, build a cloud version, but we’re going to get disrupted, we’re going to disrupt our own desktop business that’s a great business and it’s highly profitable?, so then there is the Innovator’s Dilemma . SG: If you make this shift, how do you make it? So cultural, technological, talent, and then there’s the disruption of your revenue stream. Those are all massive challenges — which, by the way, that’s why we were late to the cloud, because we still have, I think, I’m going to go off of memory, several billion dollars of business that’s desktop. Now, we’re not shipping CDs and disks anymore, it’s sort of still in the cloud. But there are a lot of customers that love the desktop versions, and that’s the biggest challenge, the last one is the customer doesn’t want to change. Yep. Yeah. You mentioned TurboTax earlier, an acquisition, you’ve done a lot of acquisitions over time. I can’t remember — did you acquire TurboTax? I guess it was before you eventually sold Quicken. SG: That’s right, long before I joined. Right, eventually Quicken you sold off ages ago , TurboTax is your consumer play. To my question before — about generally it’s easier to sell productivity software to businesses than to consumers — should there be an asterisk that the way to sell to consumers is if you have the monopoly of violence on your side? Pay your taxes or else! SG: Compliance businesses are great, and that’s really what TurboTax is. That’s the ultimate compliance business. SG: It’s the ultimate compliance business, because it’s all based on the system of taxes in the U.S. and Canada, and you have to do your taxes or you pay a penalty. Now you have to keep inventing, and there’s a lot of competitors in this space, but there’s nothing like compliance businesses, they’re great businesses. Why shouldn’t the government just do the taxes for you? Especially for W-2 workers that are very basic. SG: You have to change the whole system. The government has tried. Right. Intuit has been consistently opposed to it, I think, for understandable reasons. SG: Well, we have been, because, by the way, it’s not free. When the government creates software, you’re paying for it as a taxpayer. Plus, a lot of these W-2 workers, they already have free available to them, whether it’s through us or H&R Block or many other tax prep companies. Unless we change the entire tax system, at the end of the day, free is already available to almost all Americans. By the way, including yourself — if you really want to go do your taxes for free, you could, it’s available to you today. Here’s the question about that — who is the constituency for not changing? Because you guys get cast as the bad guys, “The reason why this isn’t easy is because Intuit lobbies, blah, blah, blah”, which either one, you have the most effective lobbying operation in the history, I mean, you do lobby, I’m not going to deny that’s a fact — but at the end of the day, a lot of people complain about taxes every year and yet it’s still this way. So what are the constituencies that are standing shoulder-to-shoulder with you, as it were, in the system being as it is? SG: There’s two things we’re huge proponents of and, by the way, have been — in my 20 years in the company — when I joined, and wasn’t even running the tax business, these two things were true, and they’re still true today. One, we’re always advocating for simplifying the tax system, because the tax system is way too complicated and the more you simplify, the better it is for the consumer and the business. The other thing that we’ve advocated for is the government shouldn’t invest to build software for taxes, because it already exists and for the majority of Americans, if not all, free already exists. The government spending taxpayers’ money to create software that already exists doesn’t make any sense so those are the two big things that we have advocated for. And the reality is, every year, in some way, shape, or form, with additives of legislation, we unintentionally make the tax system a little bit more complicated. Right. That’s the constituent answer, isn’t it? Everyone is a constituency for their pet part of the tax code, and so it just never changes. SG: That’s right, that’s exactly right. From the consumer perspective, where does Credit Karma fit in this? Which, also by the way, has its own tax product. Is this just a realization, “TurboTax is a very high-margin business”, but at the end of the day, what’s the link? Are you cannibalizing yourself? To what end? SG: Let me maybe just step back and give you the strategic context very, very briefly. So I’ve run all parts of the company before I stepped into this role almost eight years ago in January. And when we declared our strategy, which was, in essence, an AI-driven expert platform with three big bets — which I can briefly get into in a moment — there was a couple of big from-tos. One, I wanted to shift the company from just being a tax and accounting platform to a company that was a platform company that helped businesses from lead to cash and helped consumers from credit building to wealth building, because I felt that, over time, one, just being tax and accounting was too small of an addressable market. And two, every business that I ran — both tax and our business group — the biggest thing I would hear from customers, our TurboTax customers would be, “Why can’t you help me grow my refund?”, “Why can’t you help me, with all the data that you have, connect me to financial products that are right for me?”, “How come you can’t give me immediate access to my refund?”, I would hear a lot of that, and nothing about, “Make your tax product better”. And when I went to the business group, all I would hear is, “I don’t really care about books and accounting, I have to do it”, and my accountant tells me, “I have to do it”, but, what about getting customers? What about managing my cash? What about helping me with whether or not I should buy inventory? So that’s the learning that I had that informed, we got to shift from just tax and accounting to an end-to-end platform company. We invested a lot in building out the platform, but I felt like there were a couple of acquisitions we needed to make and so now, to answer your question around Credit Karma — Credit Karma has like 45 million monthly active users that engage more than five times a month — taxes, once a year. So what I wanted to do is buy the platform and then integrate them to have one consumer platform where you can manage your money, do your taxes, and get access to financial products that are personalized based on your data that are right for you. That was the reason behind Credit Karma, to really create a consumer platform because the hope was, and we’re executing against that, that the more I can engage you throughout the year, the more you’re also compelled, based on everything that I know about you, to get you the biggest refund and for you to do your taxes with us and that was the reason behind the Credit Karma acquisition. Credit Karma’s ace in the hole is, it’s credit, right? People want to know what their credit score is, monitor their credit. Has that always been its biggest benefit, is customer acquisition ? SG: Yeah, that’s the biggest job that it solved, is, “What’s your credit score?”, but then really, when I bought Credit Karma, it was a data and AI platform. We have over 60,000 data points per consumer and based on all the data points, I can connect you — when you need a credit card, to a credit card that’s specifically right for you, versus just sell you a credit card. I’m agnostic, same thing with personal loans, insurance. So now it’s much more than credit score, it’s actually how we connect you to financial products that are right for you, that are personalized, how we help you with getting early access to your refund. It’s credit cards, personal loans, insurance, etc, so it’s now truly — we pretty much do everything for you, except we don’t help you trade stocks. What happens when people just start asking AI for this? Is there an aspect where you finally got to the right consumer business model — it needs to be free, you can get all these affiliate fees by connecting those different services — and then as soon as you finally get that cracked, people are like, “I’ll just ask ChatGPT”. SG: That’s right, this is where we started the conversation — where curiosity and always diagnosing matters so much, so we don’t fall in love with what we’re doing today. Let me answer your question with a perspective and a point of view about the very near future that, listen, may or may not change, but I think it’s important to start there before I answer your question. I believe that we will live in a world where, in some way, shape, or form, agents are doing a lot of the work with you and for you, with your approval and it will make life a lot easier for you. And so whether it’s booking your travel, whether it’s what is the right credit card for you, where you should do your taxes — I believe in a world where agents will do a lot of that work for you and that’s really why we have set out to build a platform where we want to be the financial intelligence layer for consumers, businesses, and accountants. What that means is I want to automate as much of the work for you, and give you intelligence, and carry out the action for you. Because if you think about what we do, we move people’s money, we help them with payroll, we help them with books, we help them with taxes and in the case of our consumer platform, it’s money, taxes, and financial products. That’s why we’ve integrated into a bunch of them — Muse , ChatGPT , Anthropic — because you can ask about, “What credit cards are right for me?”, but ultimately, when you go act on which one is the best one for me, that’s where AI agents, as we do our job right, will call on Credit Karma, will call on TurboTax, to not just give you information. But that’s a tougher spot to be, right? As opposed to most people starting with Credit Karma — where you’re actually the front door, you’re owning the customer relationship — now you’re downstream, you’ve been disintermediated. By the way, I think you’ve had executives say that channel maybe hasn’t been performing as well as you would like, is this a more aspirational goal than a reality? SG: It’s the reality we’re executing. First of all, out of the couple of acquisitions that I’ve done, Credit Karma has really worked out well. Right. I have questions about another one that is also close to me. But we can continue. SG: I am vocal about what works and what doesn’t work, so we can talk about it. But I start there because the whole essence of Credit Karma is really — we’ve executed on the platform strategy, which is create one consumer platform and really own the customer relationship and engagement. That’s the question — you build up this whole platform, and then the whole key component, the acquisition part, what happened? SG: But if you think about the brand that we have, and if you think about the capabilities that we have, we actually have better-intent customers that engage with us now through the LLMs than we did before. Right. So you get fewer customers maybe, but better customers. SG: Better quality and, by the way, not only do they still come to Credit Karma — because Credit Karma is not search-driven, it’s authenticated, it’s an app where we engage the customer. We help you with, “Hey, here’s what’s changing your credit score, here’s a card that’s right for you based on your situation”, so we’re proactively engaging the customer. And if a new customer also wants to ask, “Hey, what’s the best credit card for me”, and this is some of my information, one of the things that we’re getting LLMs to do, first and foremost, is, hey, connect to Credit Karma. Is this the new SEO? Like you need to be the service that the LLM recommends? SG: Yeah, and I think it will be even better. The reality is people now do search in LLMs versus just in Google, but I think one of the things that we’re doing is we’ve built out our experiences and continue to build out our experiences. And this is why, by the way, the OpenAI’s and the Anthropic’s come to us and we have a deep partnership — because we’re executing financial decisions, it’s not just information, it’s people’s money, it’s people’s taxes, and getting it right matters. And so for us, using the word “headless” — being within these LLMs where we get called on as the financial intelligence platform to do the work — is ultimately the way we’re building out our experiences and we think over time, it actually builds out the top of our funnel it actually expands the TAM that we have. Now, that’s yet to be proven over time, but that’s the way we built out our experiences. Presented by I spend a lot of time trying to figure out what is happening to businesses on the internet. What I often find I’m missing is a view across the economy itself. With more than 1.7% of global GDP running on Stripe, working with them means I can bring some of what they’re seeing to Stratechery. They are, in a sense, a barometer of the economy. Take the “SaaSpocalypse”. Earlier this year, nearly a trillion dollars in enterprise software value disappeared amid fears of AI eating its lunch. Stock prices only tell us what investors think will happen, and not necessarily what is happening. In this case, Stripe recently built a SaaS Index using payments data from 72,000 non-AI SaaS businesses. Looking at their actual performance, we can see that while SaaS stocks were selling off, revenue growth was actually accelerating. Year-over-year growth is now over 30%, with some of the fastest growth coming from the youngest SaaS companies. I suspect there are a lot more interesting things hiding in Stripe’s data, and I’m excited about having an excuse to go look for them. We’re going to circle back to a few of those points, but I want to get on the accountant angle. As I mentioned, I’m a longtime QuickBooks customer, the most obvious reason is that is what my accountant wanted me to use. You have a referral program, or you have had one, for accountants. How many of your customers are basically locked in via this channel? I’ve just never really considered anything else, because at the end of the day, I don’t really want to deal with it, and that’s what my accountant wants, is that just the reality for a lot of businesses? SG: By the way, I love where you started the question, because if I could — one minute on what we just rolled out at our Intuit Connect , which is a massive conference for just accountants. And then I’ll answer your question, if I may. Yep, I think it’s very interesting, I was leading to it, so please give me the pitch that you gave just a couple days ago. SG: For sure and we just rolled this out at Intuit Connect with our top accountants there. So, in essence, what we’ve been investing in is a unified financial intelligence platform that serves both sides of the network. One side of the network is accountants, the other side of the network is businesses, and the key is that it’s one unified platform. What does that mean? In shorthand, all the data, all the data models, data ingestion models, all the AI models are all one platform. But the way it shows up for an accountant suite is that the accountant suite helps the accountant manage their firm, manage their work, manage their clients, all in one place and it’s agnostic. If you have QuickBooks customers, other general ledger customers, you can plug it into Intuit Accountant Suite . That’s one side of the network. That’s a pretty significant change, isn’t it, that you’re going to support other ledgers? SG: Significant change, now we’re treating the accountant as a customer, not just as a partner, as a channel. Because in the era of AI, we — and I — had to change our approach to how we innovate for accountants. The other is the business, where not only do we serve the startups and the mid-sized businesses, which is with QuickBooks, but we now have Intuit Enterprise Suite , which is a mid-market suite that helps businesses of several hundred million in size. It’s an AI-native ERP solution that helps a mid-market construction company, wealth management company, architect company, whatever it may be, manage their business. And what we just rolled out at Intuit Connect — I’ll call out three big things. One is Intuit Intelligence , which is, in essence, think Claude or ChatGPT. You can just engage with a chat box if you wish, and you can ask it, if you’re an accountant, you can ask it, “Show me all of my customers and how they compare across profitability and margins for all of my construction businesses, and tell me which ones have their cost out of whack, and how does it compare to their peers”. That’s an example, an illustrative example of our engine doing all the work, but we’re automating the work so we can give you intelligence, which saves accountants. Right now, it’s shifting 30% of their work to advisory versus manual work, because we’re automating a lot of the work. That same capability is available to businesses, where they can just, rather than doing the work across the workflows, automate creating invoices, automate invoice reminders to get paid so a lot of our work around Intuit Intelligence has been around automation and for providing intelligence and insights. The second is we rolled out an enterprise-ready, industry-specific ERP for construction, manufacturing, not-for-profit, which is very disruptive for businesses that outgrow QuickBooks — but now they don’t have to outgrow us, because they’re on Enterprise Suite. Where did they use to go when they outgrew QuickBooks? SG: Typically, they would be either our highest-paying customers and the most pissed off, because they’d outgrow QuickBooks, but they didn’t want to go to the next solution. Right. What would they go to? Like Oracle, or what sort of level? SG: They would go to a NetSuite , as one illustrative example. And for most of these businesses NetSuite is just overkill. And that’s where Intuit Enterprise Suite now really serves an incredibly important sweet spot. And then the last thing we talked about is what I led with, which is Intuit Accountant Suite — now a platform where you can manage your firm, your work, your clients, all in one place and back to your original question of, “I’m using QuickBooks because of my accountant”, well, 65% plus of our customers are “attached” to an accountant, and based on what we’re rolling out, we want that to be 100%, because we see in our numbers the retention of a customer is much higher when they’re using an accountant, because accountants drive success and power their prosperity. Do accountants need you, or do you need accountants? And has that changed? SG: Both, both. I spend 40% of my time with firms — small, medium to large-size firms. And it’s a two-way relationship. And by firms, you mean accounting firms or business firms? SG: Accounting firms. They need us, they need someone — I don’t want to be overconfident — they need someone to help them reinvent themselves in the era of AI. That’s us, that’s what we just rolled out at Intuit Connect, because all of them, if they’re PE-backed, they’re getting a lot of pressure, if they’re not PE-backed, they’re having to compete with firms that are PE-backed. So automation, intelligence, advisory services matters. That’s what we just rolled out. And I need them because it creates a network effect and that really, in the era of AI, is a great place to be when you have a network effect. That’s an actual moat. So is it fair to say your pitch to accountants is basically, “Look, we’re all under the gun here — we’re better off banding together and figuring this out”? SG: Well, if you were to listen to my 25-minute keynote , where I revealed a lot of this product innovation, and you synthesized it and put it in Claude, it would probably tell you exactly what you just said — which is, “You need me, I need you, here’s what the innovation is we’ve done for you and here’s why it’s important”. But does that lead to innovation that actually — is just the reality someone like me is trapped, I’m going to go on with whatever happens and they’re going to figure it out? Or what is the actual threat here, that people just start using AI, the AI companies offer their own services? What are you banding together against? SG: It’s a great question. First of all, if you start with the jobs to be done, and jobs to be solved by businesses — they’re trying to get customers, they’re trying to grow with their customers, they’re trying to understand where their profitability is, they’re trying to get paid, they’re trying to manage their employees. And they’ve got to make sure their accounting and taxes are done right, because clean books. Right. Monopoly on violence — always good to have in your business model. SG: Yes, that’s exactly right. If you start with the jobs to be done, and what’s the role of an accountant? Oh good, that’s one of my questions — what is an accountant’s job? SG: The accountant’s job is to ensure that, one, advisory services — how should you grow your construction company? How should you grow your nonprofit? — making sure their books are clean. Wait, would you have ever said that was an accountant’s job five years ago? SG: No, it’s more important today. And why wouldn’t I have said that? Let’s talk about that. Because I used to run the accounting business at Intuit years ago, this is our pro-tax business, the reality is everything was manual, and all of the time, accountants were spending manually entering data to make sure your books are done right. Now, one of the things we rolled out at Intuit Connect is our agentic books close, where you can upload now your standard operating procedures and processes by firm, because every firm does books differently, and we automate a lot of that. That allows them to spend time on real value-added, “Hey, Sasan, here’s how you should think about growing your business”, “Here’s how many employees you should think about hiring”, “Here’s what inventory you can buy”. Is that a little bit like the mafia helping you? “We’re going to help you close your books”, your books are going to get closed, whether you want them to or not. SG: The reality is, businesses, we see this in our data, and remember, we have 100 million customers, 10 million of them are businesses. Businesses that are connected to accountants, our retention rates and profitability are generally higher. And so this is like real value that accountants provide, and back to your question of what’s different, I think what we’re now doing is making sure that they can run their firm far more effectively by automating and delivering intelligence, so they don’t have to do manual work, so that they can actually do a better job serving the business. And on the other side, we have a platform that the business uses to grow and run their business and it just creates this network effect in ways that I think is beyond, “I need to do manual work and I need to work in the workflow”, to an era of intelligence and insights and how can we grow faster with expected outcomes, where efficiency and profitability must improve because of what’s possible with AI. Are there more or fewer accountants in five years? SG: Fewer, many fewer. And are those accountants actually different people than the accountants today? SG: Well, I think by design, two things in life are true. You die, and you have to do taxes. Right. Is an accountant actually just selling a signature? Is that what they’re actually providing in the future? SG: No, they do a lot more than that, there’s only so much technology can do. Even tomorrow and the day after, as AI advances— SG: First of all, judgment. Closing books — that is really hard. Yeah. By the way, to my listeners, I love accounting. So you’re speaking to the choir here, but you still have to convince me. SG: I didn’t know that, but it’s good that at least this lands with someone that knows accounting. Categorization of all the financial data, making sure that you reconcile everything from a balance sheet to a GL [general ledger], making sure that all the revenues are recognized correctly and in the right categories. There’s a lot we’re doing to automate, but at the end, the judgment of, “Are the books right?”, “Are they clean?”, and then what choices and decisions can you make — that judgment and that intelligence will always, always be important. But I think if you think about a continuum where before it was 90% manual work and 10% judgment and intelligence to eventually, I don’t know when, a year from now, two years from now, it’ll be 90% intelligence and judgment and 10% manual work. I think about it just on a personal level. I had a longtime accountant, who unfortunately retired a couple years ago, and she loved me, she dealt with much larger companies and things. But at the time I was living abroad, I had this very high-cash-flow business. She’s like, “This is so interesting, you present so many weird edge cases and challenges that I’m not used to”, and I almost feel bad for her, because in a world of AI, she would crush it, because she’s exactly the accountant you’re talking about. The question I have, though, is this goes back to you being a generalist. I see someone like you — AI is incredible. I’d be curious to know what, if any, personal AI projects you might be working on because if you’re anything like me, it’s like, this is just so fun — you can do basically anything. That’s not your typical accountant, an accountant is like, there’s the beauty in the numbers, everything has to balance, credits versus debits, and also just a lot of drudgery, actually filling in the forms and making the files correctly, very conscientious, very careful, very high values — all of which seem pretty threatened. That’s why I’m wondering, not just how many accountants will there be, but what does an accountant look like? SG: First of all, there’ll be a lot fewer accountants because of what’s happening structurally, which is PE firms are gobbling them up . Was that happening before AI, or is that a post-AI phenomenon? SG: It was happening beforehand, because there’s just a lot of inefficiency, and PE firms look at that and say, “There’s a lot we can do”, and it’s just accelerating now with what’s possible with AI. I think that’s one reason. I think the other is I believe there will be accountants that are all-in on AI and accountants that are not and those that are not all-in on AI are the ones that are going to be disrupted and won’t be around two to three years from now. So that’s why, in general, I feel like there’s going to be fewer and fewer accountants. But here’s what I would tell you — and listen, you’re an accountant, I spend 40% of my time with them. I’m not an accountant, I just appreciate it. SG: The biggest thing I hear from them is they don’t really like doing debits and credits, they don’t like doing the manual work, and it’s the biggest cultural change they are focused on driving. And a big part of that, that we’re helping them with, is either training their folks, and/or for them to upgrade. I do think there’s going to be a massive change and upgrade of talent, either those that love the manual work are going to realize, “I have to love automation”, not doing manual work, or they’re just going to go get somebody else that will love that work — particularly these folks that are coming right out of college and want to be accountants and want to be CPAs, they’re much more tech-savvy, and they will want to drive automation. I think that’s the change you’re going to ultimately see, and we’re seeing it right now, because the top partners are driving it. If you look at your recent financial results, you’ve been growing revenue amongst your core customers, but barely growing total customers. Now you’re talking about going up-market, like into the accounting workstream, for example. You mentioned with businesses, your recent focus on ERP services. Again, going up-market, between that gap between NetSuite and yourself. All that makes sense. At the same time, you’ve brought up disruption, jobs to be done, you’re a student of this theory. A company going up-market, increasing average revenue per user, even as there’s a technological shift at the bottom that is gobbling up the business there — that sounds like a company that’s being disrupted ? SG: I love your question, I’m glad you’re asking it now versus four years ago. So we declared, in essence, these three bets that I’m talking about eight years ago. And what are those bets? If I were to simplify them, one is to disrupt assisted tax — out of the total tax TAM of $40 billion, $35 billion is assisted taxes — when you go have somebody else do your taxes for you, a human doing it. And it’s the signature that matters. Is the goal there that customers no longer need to hire accountants? SG: I’ll come back to that. So that’s one space. The second big space was shift from tax and accounting only to money, our money benefits and money portfolio being the core of our platform. What does that mean? It means bill pay, it means payments, it means instant deposit. And then the third is go to mid-market. When I declared this nearly seven-and-a-half, eight years ago, investors were very skeptical of me, because what they said was, “These are markets you don’t play in, you could screw up your margins, I’m very skeptical”. If you now fast-forward to where we are — to answer your question — it’s now 30% of the company, so it’s like $7 billion-plus, growing at 30%, we’ve already proven these. So is the answer to the old business is, we’re just going to outrun it with the new business? SG: That’s right. So AI is a huge tailwind for us, because we’ve been investing in it in these areas. The core business is — if you go back to Investor Day and what I just shared, I said, hey, we’re growing 30% of the company, my core business has slowed. I need to increase my market share, so I’m changing my lineup. Right, because isn’t the problem that your core business — maybe it’s not very sexy — but that’s the foundation of your new businesses? SG: That’s exactly right. And so that’s why we, in essence, what we’re doing is reinventing our product, but also being disruptive on price to take market share, while at the same time scaling my big bets because I want to make sure five years from now, we’re a healthy and growing company. Because here’s what I believe will happen with AI in our industry and in the spaces that I play in, AI is a tailwind for me with these big bets — disrupting mid-market, disrupting assisted [tax] — Just because you can develop software more quickly, or what? SG: My biggest differentiation in assisted tax is I have scaled the one thing that matters most, which is the human signature, virtually, at scale and I have a disruptive price. So I can do anybody’s taxes for them at a disruptive price with an amazing virtual experience, where you never have to leave your place of work or home and it’s an amazing experience. The differentiation is I have scaled the human signature because of AI. So that’s an example of — and my competitors are a lot of mom-and-pop shops and so scaling that for the next 10 years. You were saying “the signature”, are you talking about actual accountant signatures, or are you talking about, like, the TurboTax product where you’re actually— SG: We have about 18,000 experts that are CPAs, accountants, on our platform and those are the ones that are virtually doing people’s taxes for them. Got it, got it. So that’s a separate pool than your accountant business, I was conflating them in my head. SG: That’s right. I mean, the accountants that we’ve been talking about for the last 45 minutes are accountants that, they don’t even want to mess with somebody’s tax return unless it’s greater than $6,000, we don’t compete with them, we’re helping them grow their business. These are much more the normal Americans and the taxes that they pay. The reason I think we got on this topic is, for me, that’s a huge tailwind, AI is a tailwind to disrupt those industries. But I think for the lower end of the market, AI can help you reinvent experiences but if you’re not priced right, you’re going to get disrupted and that’s really what I’ve done. In the low end of the market, I’m reinventing experiences, but I’m adjusting my price-to-value ratio, so I can win these customers when they first come into the market, and then I can grow with them over time. I do have to ask you, because I hinted at it before — you acquired Mailchimp for $12 billion in 2021, a company that I originally worked with and left in part because I feel they send email people don’t want, and I send email people do want. The idea was extending QuickBooks from accounting into customer acquisition, that platform stopped growing, you’re segmenting it off , is that an acquisition that didn’t work out? SG: First of all, legendary brand, legendary product, legendary employees — full stop. I’ll come back to that in a moment. What we want to do hasn’t changed, the customer problem of helping customers grow has not changed, and so now we’ve built that AI natively within QuickBooks. Right, but you said before you’re building a money platform. Is the issue that Mailchimp doesn’t have anything to do with money, at least directly? It’s a secondary input. SG: Growing customers has everything to do with money, because eventually, they have to pay. So when I say “money”, it is, in fact, owning the right to the workflows that lead to money — which is why solving the problem of getting customers, which is what Mailchimp does, is something we’ve built out AI-natively within QuickBooks. But to your point, we have carved out — I don’t think we’ve executed well on Mailchimp, so we’ve carved it out separately to really focus on getting the business right and making sure it’s transparent how we’re performing externally and as I’ve said to investors and our employees, all options are on the table to make sure that it has the right future. All right, I want to get back to the more interesting question, because we’re almost at time here. To go back, to put this together historically — you went through one big business model change, from package software to subscriptions. What does the business model look like in 10 years? People talk about usage-based, outcome-based pricing — you’re not necessarily seat-based , so that’s a big advantage for you, you also have the affiliate marketing angle on your consumer side. What’s the core way that Intuit makes money in the long run, and is that going to be fundamentally different? SG: Three things I will say. One, first of all, you’re absolutely right — we’re not seat-based, so let’s get that foundation confirmed by me, that we’re not seat-based. I’ll say three things. The way we’re set up today is, we’re beyond user-paid, so the entire Credit Karma platform — everything for the user is free, but we get paid based on all of our partners on our platform, so that’s one business model. The other business model is subscription-based, which is our business platform is subscription-based — about 80%, 90% of it. The third is we’re transaction-based. Right. You file your taxes, you pay a certain amount of money. SG: That’s right. Or you invoice, and we get paid, a customer gets paid, that’s transactional. So those are the three models in which we operate today. If I were to answer your question five years from now, three years from now, not just 10 years from now, I think what will get added to that is consumption-based. SG: For instance, a lot of what we just rolled out at Intuit Connect is, if an accountant uses certain agentic capabilities, like creating specific tailored experiences for a construction company, and that construction company pays the accountant more for those services, which they will — we have the opportunity to monetize that consumption. Is that monetization — is that usage-based, or do you envision outcome-based pricing ? I mean, you are dealing with money. SG: No, no, it’ll be usage-based. Is there room for an outcome-based pricing model in any of this? SG: You know, there could be — I don’t want to fixate on “yes or no”, we test a lot of this with customers. What I would tell you — customers today, doesn’t mean tomorrow won’t change — generally, customers aren’t that interested in outcome-based pricing. They’re generally not interested in token-based pricing, because then they can’t control what they’re going to end up paying, so they still want an element of fixation of what I’m going to pay. Predictability, yeah. SG: That’s right. I think three years from now, the value of what they’re willing to pay for in certain markets will go up. In certain markets, it could go down. But I believe in three years, we’ll still have beyond user-paid, we’ll still have transactional, we’ll still have subscription, and I think there’s going to be a smaller element — and growing — that will be consumption-based. Do you feel like you’re on offense or defense? SG: Every day, we’re focused on playing offense and every day, I open my email to see what was launched yesterday, to figure out where we need to play defense. Very good. Sasan Goodarzi, thanks for coming on to Stratechery. SG: All right. Thank you for having me. This Daily Update Interview is also available as a podcast. To receive it in your podcast player, visit Stratechery . The Daily Update is intended for a single recipient, but occasional forwarding is totally fine! If you would like to order multiple subscriptions for your team with a group discount (minimum 5), please contact me directly. Thanks for being a supporter, and have a great day!

0 views
The Coder Cafe 3 weeks ago

Building Barista—Part 1

☕ Welcome to The Coder Cafe! A few weeks ago, I built Barista : describe what you like to read in your own words, and every day it emails you a few posts worth your time, picked from hundreds of engineering blogs, Hacker News, Lobsters, and arXiv. This is the first part of a series on how it works: not a tutorial, but the decisions behind a real system I built and run in production. This week, we explore its architecture. You’ll see how embeddings turn meaning into geometry, how a decision model judges what’s actually worth your time, and how a single Postgres can be a queue, a scheduler, and a vector database, with no message broker in sight. Get cozy, grab a coffee, and let’s begin! Problem When I started as a software engineer (10+ years ago), my daily routine was to go through Twitter and read every single post from the people I followed since the day before. I could also consistently read every post in my small RSS feed. I was happy with my tech watch, and I was consistent. Fast forward to today: there’s been an absolute explosion of information . Twitter now defaults to “For you”, so my feed is infinite. Meanwhile, my RSS reader currently shows 1,457 unread posts. There’s just too much, all the time. I created The Coder Cafe to solve this exact problem. My initial idea was to write one post a day, so that readers could learn one thing every day. The original newsletter’s description said it all: Feeling overwhelmed by the endless stream of tech content? At The Coder Cafe, we serve timeless concepts with your coffee, every day. Then things changed (👶), and I couldn’t keep up with one post a day anymore, so I switched to a more sustainable pace. In doing so, I lost the initial premise: helping people read less while still reading quality content. I’d given up on that idea until… recently. A few weeks ago, I started looking for ways to improve my tech watch (yet again). One of the tools I found was devdigest.io . However, its sign-up page looked like this, asking me which topic I wanted to subscribe to: I don’t know about you, but for me it doesn’t work. What if, instead of “Software engineering”, I want to be more specific and say I love this or that language? Or that I love posts about testing? There was no way to do that. I kept looking, but never found what I wanted. So I started building it . I originally built Barista for myself. The initial idea was simple: let it fetch lots of content from the web. Then I would just give it a prompt describing my interests, in my own words. For example: I’m a senior SRE and Go engineer. Show me deep, technical content on: Programming: programming concepts, unit tests, etc. Go: performance, profiling, latency, runtime internals Systems fundamentals: Linux internals (processes, memory, I/O), databases, Postgres, etc. Kubernetes internals: controllers/operators, reconciliation, kube-apiserver, edge and fleet-scale rollouts Reliability & SRE: safe rollouts, disruption management, resiliency, incident analysis, etc. Prefer: first-principles explanations, architecture write-ups, benchmarks with data, lessons from production. Skip: beginner tutorials, listicles, framework hype, marketing posts, generic AI news. From there, the system filters out everything outside my interests, plus spam, low-quality content, etc. Then, it sends me one email a day with a few posts. After using it for a while, I thought: if I enjoy it this much, why not turn it into a product and see if others like it too? Want to see what it picks for you? Write your own brief , and your first email lands in seconds, no account needed. In this first part, let’s look at how it works under the hood and at the main decisions I made along the way. At a high level, Barista is built as a pipeline: It has two halves, and they work very differently. The left half is about posts . Ingest, fetch, classify, and embed run all day long, and each post goes through them exactly once, no matter who ends up reading it. A post is downloaded once, classified once, and embedded once, whether it ends up in zero inboxes or a hundred. Each stage hands posts to the next through a queue. The right half is about users . Match, rank, and send run once a day per user, and there’s no queue here: what drives them is the clock. Each user picks a send hour, and the system works back from it. Match runs two hours before, rank one hour before, and send right on time. The stages are the following: Ingest: Polls the sources and records each new post’s URL. A URL it has already seen is skipped, so each post enters Barista only once. Fetch: Downloads each post’s page and extracts its title, author, date, and text. A post is dropped if the page can’t be read, isn’t in English, or is too short, for example. It also respects and never hits the same site more than once every couple of seconds. Classify: Asks an LLM what the post is: its topic, how deep and how good it is, and whether it’s spam or a paywall teaser. Anything off-topic, spammy, or low quality is dropped here. Embed: Turns the post into a vector, a list of numbers capturing what it’s about (more on that below). From here, the post becomes a candidate for every user. Match: Two hours before a user’s send time, it takes the user’s interests (embedded into the same space when they saved them) and finds the recent posts whose vectors are closest. The closest ones become that user’s backlog. Rank: An hour before send time, an LLM grades how well each new post in the backlog fits the user’s interests, taking their recent votes into account. The best-graded posts are picked for the day. Send: At the user’s chosen hour, sends the email with the day’s picks, each with “More like this” and “Less like this” buttons. That feedback flows back into future rank runs. So how do these stages talk to each other? Through Postgres. When we hear “a pipeline of stages”, the reflex might be to reach for a message broker: Kafka, RabbitMQ, maybe Redis streams. That was my reflex too. Yet going against my instincts, Barista doesn’t have one: every arrow in the diagram is Postgres. Queues are tables. In the per-post half, each stage drains a table filled by the previous one. Ingest writes new URLs into , fetch drains it and writes into , and so on down the line. Several workers process a stage in parallel, and each claims its next row like this: locks the row so no other worker can take it. means the other workers don’t wait on it; they move on to the next free row. That’s a work queue in one SQL clause. Retries and dead letters are just data too. A row that fails gets a timestamp and is retried later, with a backoff that starts at 5 minutes and doubles up to 6 hours. After 10 failures, about a day in, it’s moved into a table with the reason, so one broken page never blocks the posts behind it. Schedules are columns. The per-user half keeps its schedule on the user row, in three timestamps: , and . Each stage picks up the users whose timestamp is due, does its work, and moves its timestamp to the next day. Each stage also waits for the previous one: rank only handles a user once match has moved that user’s into the future, meaning “match is done for today”. So there’s no scheduler service or workflow engine to run. Each stage just queries for the users who are due. Each stage is a short-lived job. A stage is a small program started on a cron. It wakes up, processes whatever is due, and exits. Nothing runs, and nothing costs anything, between runs. So why not Kafka? In the end, running a personal project is also about being pragmatic, and three reasons won me over. First, scale. Barista processes a few hundred posts a day, not millions of events per second. Kafka shines at throughput I simply don’t have, and it would be one more system to run, monitor, and pay for, next to a database I need anyway. Second, and that’s the reason I care about most: the queue and the data live in the same transaction. When fetch processes a post, claiming the row, saving the extracted text, and queuing the post for the next stage all happen in one transaction. Either everything commits, or nothing does. If the job crashes halfway, the transaction rolls back, the row is unlocked, and the next run picks it up as if nothing happened. With a broker, that’s much harder. We write to the database, and we acknowledge a message (or publish one), two systems that can’t commit together. Crash between the two, and we either lose work or do it twice. Solving that properly is a whole topic on its own (the transactional outbox pattern exists precisely for this). With everything in Postgres, the problem just doesn’t exist (or barely). Third, everything is queryable. A post’s whole journey, from the URL ingest found to the email it ended up in, is a set of rows. For example, “Why didn’t this post reach anyone?” becomes an SQL query. All of this runs on a single Cloud SQL , Google’s smallest tier: a shared CPU and 614 MB of memory, for about $8 a month. Will it be enough forever? Probably not. But when it isn’t anymore, I’ll have a good problem, and I’ll know exactly which part to move out first. Choosing Postgres is not entirely free, though. In some stages, that transaction stays open during the network call (downloading a page, asking the LLM), which holds a lock and a database connection the whole time. It’s a tradeoff I’ll come back to in a future post, because it bit me once. Postgres has one more role I haven’t mentioned yet: it’s also my vector database. Postgres has one more job, and it’s the one that makes Barista work: finding the posts that fit what a user wrote in plain English. Here’s the problem. On one side, thousands of posts. On the other, a user who wrote a paragraph about what they like. How do we match the two? The naive answer is keyword search: look for posts containing “Go”, “Kubernetes”, “Postgres”. It breaks quickly. A great post about MVCC might never write “Postgres” in its title. A post that mentions “Go” five times might be about the board game. Keywords capture words, not meaning. That’s what embeddings solve. An embedding is a list of numbers representing a piece of text. In Barista, each post becomes a list of 1,024 numbers, computed by an embedding model from the post’s title and text. On their own, those numbers mean nothing to a human. There’s no “number 42 means Postgres”. What matters is where the list sits compared to the others. Think of each list as the coordinates of a point, not on a 2D map but in a space with 1,024 dimensions. The model was trained on huge amounts of text with one goal: texts that mean similar things should end up close to each other in that space, and unrelated texts far apart. So a post on how Postgres implements MVCC and a post on transaction isolation levels land near each other, even if they barely share a word. And the post about Go the board game lands far from the one about goroutines, even though both say “Go” all the time. “Close” is measured with cosine distance. Roughly, it’s the angle between two vectors: a small angle means similar meaning, a large one means unrelated. Now here’s the trick: your interests are embedded too, into the same space. When you write “I love posts about Go performance, profiling and runtime internals”, that sentence becomes a point, just like the posts. Finding posts for you becomes a geometry problem: which posts are the closest points to your interests? Two details make it work well in practice: Posts and interests aren’t embedded the same way. A post is embedded as a document ; the interests as a query . A two-line description of what you want doesn’t look like the long article that answers it, and embedding models handle this asymmetric case explicitly. A prompt with several interests is split. My own prompt covers Go, Linux internals, Kubernetes, and reliability. As a single vector, it would land somewhere in the middle of all of them, close to none. So Barista has an LLM split the prompt into separate interests, embeds each one, and looks for posts close to any of them. This is where pgvector comes in. It’s a Postgres extension that adds a column type and distance operators. Embeddings are stored in a plain table, next to everything else, and finding the closest posts is a SQL query. Simplified: is pgvector’s cosine distance operator. And that query is why I didn’t reach for a dedicated vector database. The search also has to filter. I want the closest vectors among posts from the last 30 days, never offered to this user before, not from a site they blocked, and preferably one per site. Every one of those filters is regular data that already lives in Postgres. With a separate vector store, I would have to copy that data there and keep it in sync, or search broadly and filter afterwards. With pgvector, it’s one clause. Embeddings tell Barista what a post is roughly about. They can’t tell whether it’s any good, whether it’s spam, or whether it’s actually what you want to read today. For that, Barista uses a decision model: Jev by TypeSafe . It reads natural language, but it doesn’t write any. It only answers questions. So instead of a prompt and some free-form text back, we send it two things: A state: The data to judge, as JSON Questions: Each with a type that defines the shape of the answer There are three question types: Choice: Pick one option from a list we provide Score: Pick a level on a scale we describe (2 to 10 ordered levels) Noul: A yes/no question, answered as a probability And the answers come back typed too. So I can skip the “ please answer in valid JSON ”, the regex on the output, and the retry when the model decides to add a friendly sentence first. Another detail I love: a score answer is probability-weighted, so instead of 2, we get something like 2.37. That’s a lot more useful when we need to compare and threshold things. Barista asks Jev questions in two places. Every post that gets through fetch is sent to Jev once, with multiple questions: Domain ( choice ): What is the primary domain of this post? Depth ( score ): How technically deep is this post? Quality ( score ): How well-written and substantive is this post? Paywall teaser ( noul ): Is this a paywall teaser? Spam ( noul ): Is this spam? The rules are implemented in plain Go. For example, spam probability above 0.7? Dropped. The point is to filter as early as possible. A post dropped here costs a fraction of a cent once, and then never costs anything again: no embedding, no grading, for any user. And the answers are stored, so the topic, depth and quality feed the later stages. This is where Jev does the real work. Match gave each user a short list of candidates, found cheaply with embeddings. Now Jev grades each one with a single question, “How well does this post fit the user’s interests?”, on four levels: Poor fit: largely unrelated to the user’s stated interest Weak fit: tangentially related but not a strong match Good fit: clearly matches the user’s stated interest Excellent fit: a standout match, exactly what the user is looking for The state holds the user’s prompt, the candidate (title, description, the opening of its text, plus classify’s topic, depth, and quality), and the user’s last five days of 👍/👎 votes, with comments if they left any. So “fewer AI posts, please” really does change what gets picked. A design decision I didn’t expect to make: I grade each candidate in its own request. My first version sent the whole backlog in one request and asked Jev to grade everything at once. It was cheaper in calls, but the grades were unstable. Jev judges each question against the whole state, so the other candidates in the request acted as distractors and shifted each other’s grades. The same post could be “Good” on Monday and “Weak” on Tuesday, just because of its neighbors. Graded alone, a post’s grade only depends on the post and on you. That makes it stable, and since it’s stable, it’s worth keeping. Each grade is stored and reused for as long as the post stays in your backlog. A post is only graded again if you leave new feedback, since your votes might change the verdict. Then picking is simple: the best-graded posts win. For a small email, a post needs at least “Good” to be picked. The one exception is the day’s best candidate, so you always get at least one post. Barista would rather send you two great posts than pad the email with a third mediocre one. If we step back, the split looks like this: Match (embeddings): from thousands of posts to a short list. Cheap, fast, approximate Rank (Jev): from that short list to the few posts in your email. Slower, costs money per call, precise To summarize: Embeddings answer “what is this roughly about?” Jev answers “is this actually good for you ?” So far, this sounds like a reasonable little system. Here’s what I left out. Barista also has: About 23,000 lines of Go, and 31,000 more lines of tests (yes, more test code than code). 22 alerts and nearly 50 custom metrics. An AI on-caller to triage alerts. A TLA+ spec, model-checked, to make sure nobody gets two emails a day. A randomized simulation that replays days of pipeline life on a fake clock. A chaos test that throws 1,000 simultaneous users at a database the size of a Raspberry Pi. All of that for… currently 5 users . Over-engineered? Probably 😁. But it makes for good material for a series. Each item on that list comes with a story, and some of them surprised me. Starting next week with the first one: how I tried to prove that nobody gets two emails a day, and my test failed on its very first run. In the meantime, if you want to see what this pipeline picks for you, give Barista a try. Describe what you like to read, and your first email lands in your inbox in seconds. It’s free (one post a day), and every new account gets 7 days of the paid plan to try more. Problem When I started as a software engineer (10+ years ago), my daily routine was to go through Twitter and read every single post from the people I followed since the day before. I could also consistently read every post in my small RSS feed. I was happy with my tech watch, and I was consistent. Fast forward to today: there’s been an absolute explosion of information . Twitter now defaults to “For you”, so my feed is infinite. Meanwhile, my RSS reader currently shows 1,457 unread posts. There’s just too much, all the time. I created The Coder Cafe to solve this exact problem. My initial idea was to write one post a day, so that readers could learn one thing every day. The original newsletter’s description said it all: Feeling overwhelmed by the endless stream of tech content? At The Coder Cafe, we serve timeless concepts with your coffee, every day. Then things changed (👶), and I couldn’t keep up with one post a day anymore, so I switched to a more sustainable pace. In doing so, I lost the initial premise: helping people read less while still reading quality content. I’d given up on that idea until… recently. A few weeks ago, I started looking for ways to improve my tech watch (yet again). One of the tools I found was devdigest.io . However, its sign-up page looked like this, asking me which topic I wanted to subscribe to: I don’t know about you, but for me it doesn’t work. What if, instead of “Software engineering”, I want to be more specific and say I love this or that language? Or that I love posts about testing? There was no way to do that. I kept looking, but never found what I wanted. So I started building it . Introducing Barista I originally built Barista for myself. The initial idea was simple: let it fetch lots of content from the web. Then I would just give it a prompt describing my interests, in my own words. For example: I’m a senior SRE and Go engineer. Show me deep, technical content on: Programming: programming concepts, unit tests, etc. Go: performance, profiling, latency, runtime internals Systems fundamentals: Linux internals (processes, memory, I/O), databases, Postgres, etc. Kubernetes internals: controllers/operators, reconciliation, kube-apiserver, edge and fleet-scale rollouts Reliability & SRE: safe rollouts, disruption management, resiliency, incident analysis, etc. After using it for a while, I thought: if I enjoy it this much, why not turn it into a product and see if others like it too? Want to see what it picks for you? Write your own brief , and your first email lands in seconds, no account needed. In this first part, let’s look at how it works under the hood and at the main decisions I made along the way. Pipeline-Based Architecture At a high level, Barista is built as a pipeline: It has two halves, and they work very differently. The left half is about posts . Ingest, fetch, classify, and embed run all day long, and each post goes through them exactly once, no matter who ends up reading it. A post is downloaded once, classified once, and embedded once, whether it ends up in zero inboxes or a hundred. Each stage hands posts to the next through a queue. The right half is about users . Match, rank, and send run once a day per user, and there’s no queue here: what drives them is the clock. Each user picks a send hour, and the system works back from it. Match runs two hours before, rank one hour before, and send right on time. Ingest: Polls the sources and records each new post’s URL. A URL it has already seen is skipped, so each post enters Barista only once. Fetch: Downloads each post’s page and extracts its title, author, date, and text. A post is dropped if the page can’t be read, isn’t in English, or is too short, for example. It also respects and never hits the same site more than once every couple of seconds. Classify: Asks an LLM what the post is: its topic, how deep and how good it is, and whether it’s spam or a paywall teaser. Anything off-topic, spammy, or low quality is dropped here. Embed: Turns the post into a vector, a list of numbers capturing what it’s about (more on that below). From here, the post becomes a candidate for every user. Match: Two hours before a user’s send time, it takes the user’s interests (embedded into the same space when they saved them) and finds the recent posts whose vectors are closest. The closest ones become that user’s backlog. Rank: An hour before send time, an LLM grades how well each new post in the backlog fits the user’s interests, taking their recent votes into account. The best-graded posts are picked for the day. Send: At the user’s chosen hour, sends the email with the day’s picks, each with “More like this” and “Less like this” buttons. That feedback flows back into future rank runs. First, scale. Barista processes a few hundred posts a day, not millions of events per second. Kafka shines at throughput I simply don’t have, and it would be one more system to run, monitor, and pay for, next to a database I need anyway. Second, and that’s the reason I care about most: the queue and the data live in the same transaction. When fetch processes a post, claiming the row, saving the extracted text, and queuing the post for the next stage all happen in one transaction. Either everything commits, or nothing does. If the job crashes halfway, the transaction rolls back, the row is unlocked, and the next run picks it up as if nothing happened. With a broker, that’s much harder. We write to the database, and we acknowledge a message (or publish one), two systems that can’t commit together. Crash between the two, and we either lose work or do it twice. Solving that properly is a whole topic on its own (the transactional outbox pattern exists precisely for this). With everything in Postgres, the problem just doesn’t exist (or barely). Third, everything is queryable. A post’s whole journey, from the URL ingest found to the email it ended up in, is a set of rows. For example, “Why didn’t this post reach anyone?” becomes an SQL query. Posts and interests aren’t embedded the same way. A post is embedded as a document ; the interests as a query . A two-line description of what you want doesn’t look like the long article that answers it, and embedding models handle this asymmetric case explicitly. A prompt with several interests is split. My own prompt covers Go, Linux internals, Kubernetes, and reliability. As a single vector, it would land somewhere in the middle of all of them, close to none. So Barista has an LLM split the prompt into separate interests, embeds each one, and looks for posts close to any of them. A state: The data to judge, as JSON Questions: Each with a type that defines the shape of the answer Choice: Pick one option from a list we provide Score: Pick a level on a scale we describe (2 to 10 ordered levels) Noul: A yes/no question, answered as a probability Domain ( choice ): What is the primary domain of this post? Depth ( score ): How technically deep is this post? Quality ( score ): How well-written and substantive is this post? Paywall teaser ( noul ): Is this a paywall teaser? Spam ( noul ): Is this spam? Poor fit: largely unrelated to the user’s stated interest Weak fit: tangentially related but not a strong match Good fit: clearly matches the user’s stated interest Excellent fit: a standout match, exactly what the user is looking for Match (embeddings): from thousands of posts to a short list. Cheap, fast, approximate Rank (Jev): from that short list to the few posts in your email. Slower, costs money per call, precise Embeddings answer “what is this roughly about?” Jev answers “is this actually good for you ?” About 23,000 lines of Go, and 31,000 more lines of tests (yes, more test code than code). 22 alerts and nearly 50 custom metrics. An AI on-caller to triage alerts. A TLA+ spec, model-checked, to make sure nobody gets two emails a day. A randomized simulation that replays days of pipeline life on a fake clock. A chaos test that throws 1,000 simultaneous users at a database the size of a Raspberry Pi.

0 views
Stratechery 1 months ago

An Interview with Palantir CTO Shyam Sankar About the AI Religious War

Good morning, Today’s Stratechery Interview is with Palantir CTO Shyam Sankar . Sankar has worked at Palantir for 20 years, and has taken on an increasingly visible role as public intellectual, including authoring the book Mobilize , an exhortation “To Reboot the American Industrial Base and Stop World War III”. I previously interviewed Sankar in June 2023 . That interview is a great place to start in terms of understanding Palantir, which we mostly discuss in this interview in the context of AI. To that end, in this interview we discuss why Sankar thinks the industry is insufficiently focused on AI diffusion, why companies focused on the top-line have more success adopting AI, and why he is frustrated at the labs refusal to take a systems engineering approach to AI safety. Then we discuss what Palantir has learned from AI, how companies can preserve alpha instead of the median, and whether or not we need more models. Sankar also explains exactly what a forward-deployed engineer is, why tech is in a religious war, and his retrospective on Anthropic’s battle with the U.S. government. This Interview is presented by Stripe, the economic infrastructure of AI, and for Stratechery itself. As a reminder, all Stratechery content, including interviews, is available as a podcast; click the link at the top of this email to add Stratechery to your podcast player. On to the Interview: This interview is lightly edited for clarity. Shyam Sankar, welcome back to Stratechery. SS: Ben, thanks for having me back. Well, the last time we talked was in conjunction with Ted Mabrey , the head of Palantir Commercial. As is usually the case with dual interviews, we got right down to business — and I do have to say, I do a lot of interviews where I usually kind of know where I want to go, but that one was super helpful to me in understanding Palantir and thinking about AI generally . But before we get into that, we never got to do my traditional background questions — where you came from, how you got to where you are. So for you, do we start in Orlando, in Lagos, or in India? SS: At least Lagos. My father, in his early 20s, moved to Lagos and built one of the first pharmaceutical manufacturing facilities in all of Africa. He set up this whole life there for the better part of ten years. I was born in India, but really I grew up until I was three in Lagos. And then there was this horrible armed robbery that happened at the house — they decapitated the dog, pistol-whipped my father, and threatened my mother. So we left all of our earthly possessions behind and started over again in Orlando, which ended up being a truly phenomenal place to grow up. The profound optimism of Disney World, the shadow of the Space Coast , seeing shuttle launches in elementary school, running into your courtyard filled with this sense of optimism about how technology will inevitably lead to a better world — which, if you fast-forward twenty years from the ’80s, I think kids were fed a very different diet of Terminator and “ nature always finds a way “, “How dare man try to do anything that creates progress?”, so that’s really where it started. Is that actually the ultimate example of man overcoming nature — not the space shuttle, but in fact Disney World? SS: (laughing) That’s true! The fact that millions of people go there every year, to the middle of the swamp — and it’s fantastic, a lot of fun. What does meritocracy mean to you? I was reading the recent profile of you in Colossus , and it opened with [Palantir CEO] Alex Karp’s statements in that regard, but it was put in the context of you growing up in Orlando, taking an entrance exam to go to Trinity High School, and how that launched you into what you became. Is that a sentiment from Alex, is it from you, or what’s your take? SS: It’s a sentiment for both of us, for different reasons. We’re both kind of acquired tastes, in many ways, and living in a world that judges you by the fruits you bear, rather than any dimension you have no control over, is obviously a better world to live in. I think it’s a precondition to the American Dream. I was going to ask you that. Because you have this background — born in India, originally living in Lagos, come to America. What does being an American mean to you? Is that the same question, or is there some tension between those two things? SS: They overlap profoundly. Being an American is this profound belief in your own human agency, and the community you’re in, and the ability to create a more perfect union — the recognition, the ability to hold the contradiction, that not everything is perfect today but it’s incumbent on us to make it better. That may sound a little Pollyannish and even corny, but that doesn’t exist anywhere else. Everywhere else, people are profoundly cynical — things are the way they are — and there’s a very thin line between cynicism and nihilism, and you kind of give up on everything. That’s the death spiral, that’s how you get the Dark Ages. After university and graduate school, you worked on Xoom, on remittances — and then you go to work for Palantir. SS: Xoom with an X. Xoom with an X, that’s right. Not the Zoom with a Z — which maybe I shouldn’t be talking to, since you’re now an executive at Palantir using Zoom with a Z, but that’s another discussion. You worked on Xoom and remittances, then Palantir, working on national security, arguing for building our homegrown industrial base. There’s an argument there that — to take a paradox that’s maybe unfair — how do you go from a career focused on sending money out of America to being an advocate for money here in America, rebuilding our capital base? Is there tension there, or am I creating paradoxes out of thin air to build a theme? SS: I think you’re creating a bit of a paradox out of thin air. First of all, there’s a policy question — if you have a working class trying to get money to support their family, how can they do that as efficiently as possible? The bigger issue is the profound lie of globalization. The calculus that globalization got wrong is this idea that we can do the innovation and “they” can do the production — “they” make the things, we do the innovation. The problem is that innovation is a consequence of productivity, if you stop making the thing, you cede the stimulus required to do the innovation around the thing. The example I always give young computer scientists is, what do you think motivated Google to do the research behind “ Attention Is All You Need “? If you talk to that team, they wanted the 3% improvement in Google Translate. You cannot think of something more prosaic leading to something more profound. So we should be very careful where we give up — we buy a little too much into comparative advantage and give up the stimulus for production. Why do you think — what leads to that mistake of thinking that it’s okay to just own the inputs and not worry about the outputs? SS: Because at the margin, it’s true. At the margin, you can hire WuXi as a cheap set of hands at the lab bench to do a little bit of work. But at the limit, that’s a transfer of knowledge. At every increment it seems to make sense — you’re still doing the innovation — until one day you wake up and realize, “Oh, I don’t have it anymore”. You’re the only Stratechery interview that I’ve offered a job to. You sent over a list of questions you wanted me to talk about, and I have to say they’re really good — I did ask if you wanted to prepare all my interviews going forward, I don’t think I got a response, maybe the email got lost. SS: (laughing) I’m thinking about it. Okay, good. Well, let’s drill in — we’ll take your outline, why not, go through it and talk about it, and I think there are themes that might emerge. So number one, and this is from Shyam Sankar, does this count as a Shyam bomb, by the way, the long extended email detailing what we should talk about? SS: It’s not nearly vitriolic enough, so you’re spared. Got it, that makes sense. Number one, is the AI industry solving the wrong bottleneck? You argue we are over-investing intellectually in the supply of intelligence and under-investing in diffusion. Tell me what you mean. SS: If you thought about a crass metaphor of AI through electricity — there are people who generate the electrons, the power producers — for electricity to have any impact on our economy, there needed to be other people who built machine tools that run on those electrons. And that led to a profound revolution. Not only would you introduce one piece of machinery into your factory, you’d start redesigning your factories around the fact that we have electrons. Let’s call that diffusion, how does the miracle of electricity diffuse into the economy? There’s a similar question with AI. I think we are very focused on how to make better models, smarter models, more machine intelligence — and we should keep doing that — but we’re very under-indexed on how to accelerate the rate of diffusion. Where is the economic value being created? How do we turn these tokens into economic value more quickly with a great ratio around it? I’m obsessed with that, because I think there’s a license to operate in society where the benefits of this stuff diffusing really do matter and I think we’re getting the calculus around some of this pretty wrong. So who is “we”? Who are the ones insufficiently focused on diffusion? Who are you trying to convince here? SS: I think the labs are, but in general the entire market structure. People are being rewarded — and it’s very rational, if you’re a lab, you’ve been in your own reinforcement-learning loop, you do fundamental research, you make a more powerful model, and your valuation doubles or quadruples and every year it seems to keep working. Baked into that is the idea that eventually this stuff will diffuse, eventually there will be economic value. But one of the conceits I’m not sure people are getting right is, what is the atomic unit of the enterprise? Let’s leave consumer out of this. The presumption, as expressed through the product strategy you see from the labs, is that the atomic unit of the enterprise is the knowledge worker — if I can make every worker more productive, that’s the ROI, and that’s not actually true. The atomic unit of the enterprise is the workflow, you can make a single supply-chain analyst more productive and generate no incremental ROI, you have to make the entire supply-chain workflow measurably more productive to capture the value. There are some roles where the cardinality collapses — the knowledge worker is the workflow, like coding — so you have perfect product-market fit for those things, and you can chase unbounded productivity. But that’s a very small part of everything we do in the real economy. Again, I don’t understand the audience here. In a market, shouldn’t the model makers just do their job, which is making better models, and then there are lots of opportunities for companies to take those models and diffuse them? Isn’t that what Palantir is trying to do? Who is the target of this exhortation? SS: To those wondering, “Okay, we’re creating this, we’re spending trillions of dollars, where’s the return, how’s it working, why is the best example of excellence an AI assistant, which is nice and convenient but that’s not going to inflect our GDP?”. You think the big problems that I’m interested in solving — I think one of the fundamental issues, if you zoom out a lot beyond globalization. In 1971, the relationship between GDP growth and wage growth broke. Before then, every time the economy grew, wages grew. And now, adjusted for inflation, wages have been flat since. That’s a profound problem, a lot of our current challenges are downstream of that reality. There are many definitions of a thriving middle class, but the one that resonates with me is the most qualitative which is you believe your children’s future will be better than yours. If you go a couple generations without being able to cash that check, you get massive societal instability. Why does this matter to you? Why does it matter to my audience? Is this your mission here? Why do this interview? Is this concern about the overall public perception of the tech industry? Is AI going to lose public support? Is it about people opposing data centers? Where does the rubber meet the road, from theoretical discussion to actions you want to see happen in the real world? SS: Is AI just a dope technology, or is it something we can actually use to make our society better? I’m trying to solve for making the world better, our society better, through backpropagation . What would have to be true of AI for these things to be possible? As cool as AlphaFold is, there are zero drugs on the market because of AlphaFold. It’s dope — super dope — but nothing is better because of it, it would be a travesty to turn our back on AI in such a way that all it can be is something really cool. Number two of the Shyam interview outline, why are ambitious customers winning? Why do some units and institutions put AI to consequential use while others struggle to move beyond experiments? How much of the difference is access to technology, and how much is leadership, urgency, authority, and an imperative to win? SS: This is one of the empirical things I’ve observed. It wasn’t obvious to me it would be the case, but if I segment the customers I’ve worked with — the ones who want to use AI to reduce headcount, to take costs out of the business — almost all of them have failed at even achieving those goals. If you compare it to the customers succeeding wildly, have real ambition, “I want to use AI to dominate my market”, “I want to use AI to put my competitors out of business”, “I want to use AI to do work that was always beyond the efficient frontier — things I always wanted to do but could never afford to do”. I think the conclusion I’ve come to is that there’s insufficient stimulus to motivate you to do the hard things when you have a myopic goal like getting rid of humans. There might be other factors too — human intelligence and machine intelligence aren’t exactly the same thing. How so? How are they different? SS: They don’t do exactly the same things in the context of the workflow. If you spend your time trying to delete the human, by definition the AI would have to be able to do everything the human does — even if it only does 98%, you’ll fail at the specific goal. Another way to reframe it, “I have this miracle intelligence now, how do I build the workflow around what it can do, rather than shoehorning it into the error that always exists between the human and the AI?” — the AI maximalist would say, “I’m just going to keep training a better model”. But I’d say, what percentage of the problems we have today can we solve without going beyond the current frontier? I think we’ve left a lot of problems unsolved because we’re not thinking about diffusion enough, and wer’e not actually trying to maximize the AI for what it can do, we’re instead trying to judge AI by the standard of, “How do I eliminate humans?”, which may not even be that valuable, judging by the people who are succeeding with it. Does this lesson of the importance and power that comes from focusing on the top line versus the bottom line — was that a lesson you learned in the age of AI, or something you learned working with companies before current LLMs came along? SS: It’s very pronounced in the age of AI. Before then, you’d say it’s more exciting and you succeed more often going after the top line, but you’ll still succeed going after OpEx reduction. With AI, the outcomes are much more binary. It’s going to lead to a category of winners and a category of people who view this as something that’s not quite working. Number three, who carries the burden of systems engineering? A capable model is not a working system — despite lab blindness, the idea that there’s anything other than the model. Who owns the integration of probabilistic models with deterministic software, human judgment, permissions, and real-world consequences? Explain that. SS: Just this weekend there was another article about how LLMs are able to communicate using timing differences in VMs for CPU cache. Again, it’s a complete absence of a systems-engineering approach to the problem. It’s saying, “Can we test and find things that can go wrong?”, rather than viewing it the other way around, “What would we have to build around this so we could actually use it to capture the economic value that exists?”. There’s a ceding of human agency and responsibility around solving these as systems-engineering problems. The tell is you look at these historical incidents — in a real company, you’d expect someone to publish a “ Five Whys “, we’ve done a retrospective, I’m documenting not just what happened but everything I will do and build and fix and change so it can never happen again. Think about how [Hyman] Rickover built the nuclear Navy. These two positions are interesting to juxtapose, Admiral Rickover building the U.S. nuclear Navy, and the Soviet nuclear fleet. The Soviets had to rest their submariners every six months in Sochi so they could regenerate their white blood cells, because they treated safety from radiation as an unsolvable problem, “It is what it is”, and Rickover designed our submarines to a standard of safety a hundred times more than what scientists thought was even needed. Very clearly there you have a human who absorbed the burden of systems engineering, and a philosophy of continuous improvement. I think companies are going to have to absorb that, and the people who provide AI are going to have to absorb it too. All of these problems are solvable. We could wring our hands and talk about how dangerous this new thing is — we could have done that with the automobile. Four million Americans have died since 1899 with the invention of the automobile, but we just kept going, we have seatbelts, airbags, anti-lock brakes, there’s a systems engineering approach to reducing risk, dare I even talk about the airplane. You don’t see that coming out in the discourse — other than, say, Power Shelf from Nvidia , who has actually released toolchains meant to provide more safety? There should be a proliferation of that right now. Do you think that falls on the model makers to do that? Or does it fall on companies like Palantir or Microsoft? Or to what extent is it in the interest of Palantir and Microsoft to frame it that way because suddenly the value of what you’re wrapping around the models becomes much more apparent? SS: Well, certainly that’s the business we’ve ended up building, so you can say there’s some self-interest there. But I’m kind of gaslit by how little focus there is in the labs on this. It comes down to model blindness, there’s an aesthetic where if you need anything other than the model, that’s somehow a failure of the maximalist version of AI, and we should just be building more there. If you were more focused on the practical realization of benefits for your customers, you probably wouldn’t think about it that way. To what degree are the model companies really selling progress, not product? Isn’t that good for you? SS: It’s great for me! Well, here’s a question. You talk about the need to focus on the top line rather than the bottom line, and the need to build things around what these models are capable of as opposed to retrofit them into a human replacement paradigm. How does that apply to Palantir broadly? You built this business, this concept of the ontology , all these disparate data sources, and you bring them in — and when we talked in 2023, it was a very compelling story about how this makes sense in the context of AI, with AI almost being a user interface across this data. At what point are you approaching AI and it seems awfully convenient that, “We’ve had it right all along and it fits right in” — especially in conjunction with a message that “You need to rethink what you do around AI”. To what extent has Palantir rethought what you do for customers because of AI? SS: Enormously. On the big macro things, we were right. The enduring value of ontology — I was just with another big customer who was reasserting how ontology is what prevents the kind of AI slop from accumulating in their enterprise, and provides a layer they can build their supply chain on. But it would be crazy not to think AI has gotten us to rethink lots of small things, including how the work gets done. The majority of work in the platform now happens through what we call AI FDE — using the models themselves to accelerate the programming of what’s happening in the platform. Also thinking about it as part of a toolchain. If you zoom out, we view the enterprise as a state machine. Before AI, every one of those state transitions, some human was doing — the state machine is very complicated, and you’re interacting with lots of legacy systems. So the point of the ontology was never just a semantic representation of your data in your enterprise, it was also to model the verbs , the actions you could take. It made the enterprise programmable — a harness for humans to the enterprise. The opportunity, and what we had to invest in, was turning that harness into something that models can use. And thinking about it idempotently, enterprises aren’t just going to rip out the humans and suddenly have AIs running the entirety of it. Some workflows will start with humans, move to AIs, come back and forth. So you need a state machine that’s invariant to how did this work start — mammal or AI — and how is this work going to end, and how I govern the transitions through that state machine accordingly and the actions that can be taken? How would you have changed your approach to the ontology and what you’ve built had you known back in 2006 that LLMs would be the ultimate interface to what you’re doing? SS: Since the core ontology is kind of enduring, I’m not sure we would have changed that. It has changed how you get value out of the ontology — the applications you build on it, how they relate to each other, and it’s changed how you get data and model systems into the ontology. The counterintuitive thing, maybe a-year-and-a-half ago, I mandated that every new employee learn to use the platform through AI FDE in their first week, “This is the future, let’s go maximalist on it”, and it actually had a profound retarding effect over time, which was that there were lots of young employees who only knew the platform through this abstraction layer and, as a consequence, didn’t understand the underlying building blocks that the platform used and was composed of. Perhaps the most important question, even as someone who is an AI maximalist, is knowing when not to use AI. It’s been very interesting, when you ask the AI to design ontologies for enterprises, Going back to the alpha-beta frame — when you ask the AI to design ontologies for an enterprise, it does a mid job. Going back to the alpha/beta frame, it’s all beta, it models you like it would model anyone else, smoothing over everything that makes you special or different. A reversion to the mean. Number five — we’ll come back to four — has enterprise software made companies more alike, and will AI make that worse? This is an argument you’ve put forward on multiple occasions, the idea of conventional enterprise software as beta, not alpha — software required you to sell to as many folks as possible to get the return on your investment, and if you’re selling to as many folks as possible, it’s defining workflows, so everyone ends up with the same workflow. Isn’t that fine? Aren’t most workflows non-essential to the top line — software is inherently a bottom-line endeavor, and in that case it’s fine? SS: In the old world, that’s the only thing you could use software for. Go back to the earnings calls during COVID — what were CEOs talking about as the technology successes? Zoom, Teams. Meanwhile, many of these companies who I’ve known had just spent five billion dollars on an ERP implementation that fell over like a paper tiger two weeks into COVID . So the question is, what parts of the software-industrial complex are actually working? I don’t besmirch them — essentially they’re solving for, “Can I sell you the software?”, which is not the same thing as, “Did the software work?”, “Does the software actually matter?”. You can juxtapose that to our entire approach to software has been solving for, “What software must exist to solve the problems I care about?”, it’s building software through backpropagation. That both lets you continuously up-level the ambition of the problem you’re trying to solve, and allows you to think through the abstractions you want to codify in software versus the parts you leave as what is going to be unique to the customer. That’s allowed us to pierce the trade-off between alpha and beta, “ How do I build software that makes each customer more different, not more similar?”, and therefore is a strategic weapon they can use in the market. So should customers be using Palantir for driving top-line revenue and still hiring a bunch of SaaS companies for everything else? SS: Empirically, that’s the case. No customer I work with is a greenfield where we’re the only thing that exists. If you’re happy with the beta you’re getting but you’re beating your head against the wall trying to figure out why the beta doesn’t let you capture the opportunities in front of you — are you fighting your software stack? Are you fighting decisions made in the past, borne out of an aesthetic desire for something easily governable and maintainable by your IT organization? IT will always yoke toward beta — decisions that are mimetic, closer to best practice, what everyone else uses. The people most interested in alpha are in the line of business — the person who feels frustrated that their strategy is hard to implement, versus “I have a precise steering wheel to do this”. So do models deliver beta or alpha? SS: Depends how you use them. If you just think about it at the limit, we’re just going to keep betting that these models will get better and I’m going to rent my intelligence from a lab — how are they getting better? They’re somehow compounding all the world’s knowledge into their system, which you’re maybe tacitly helping them do that, maybe you’re not, but that’s the trajectory you’re on. There should be an existential question about, “What is the theory of my firm?”, “What do I do if all the intelligence is compounding into weights I don’t control?”. A big part of what we’ve been pushing is this idea of Sovereign AI , that our customers have really taken to. It’s not a binary — you don’t need to leave the lab ecosystem. But for what workflows is actually the most valuable asset your post-training pipeline — it’s not about a specific open-weight model, it’s not about a specific post trained open-weight model, it’s actually that you have sovereignty over a post-training pipeline filled with the operational exhaust of your enterprise. The operational decisions that you’re making in the context of the operating system that is our software is generating data that allows you, every month, to train a new checkpoint and evaluate it against everything that came before, in a way where you know that model is yours that you’re going to be relying on. The stakes of doing that in something like government were obvious, your competitive advantage is everything, you wouldn’t rent the brain from someone that your competitors could rent the brain from. But it’s equally true in commercial world where frontier capabilities seem to be a function of unique data that pushes you past the frontier. If you talk to the Mercor’s or the data companies of the world, they’ll tell you the way they sell to a frontier lab is they generate a dataset that they post-train an open-weight model on to be provably past the existing frontier of the model the lab is selling. So if that’s how this game is happening, every company has this exhaust as a unique asset, why should they sit around and wait? And then as a consequence have a bigger question of, “If everyone has access to this, what is my alpha as a firm? Is everything reduced to beta?”. That makes sense — you give everything to an Anthropic or to an OpenAI, that learning is going to benefit everyone, which is going to transfer your differentiated knowledge into beta instead of being alpha. But why is the correct stopping point having a partner like Palantir? Why shouldn’t they just do all of this themselves? Why is it that you are a trusted partner in a way the models are not? SS: You can think of it as a model factory. What systems are you using today to make operational decisions? What system is generating the exhaust that has your decision-making processes and all the constraints that is effectively its own RL environment that you can go off post-train these models in? And as you post-train those models, how do you evaluate those models against historical decisions you’ve made, how are you going to manage deploying them to production? Having the entire vertically integrated chain where it just works and you’re able to leverage — a lot of what we’re investing in now is auto-research, how do I, without the customer investing in a big post-training team, use the decisions they’re making in supply chain or in production planning, use that exhaust to automatically start training models behind the scenes and surface to them, “Here’s a model that’s better than what you’re doing”? How do I use every point where you’re using an LLM and use that as a trace that I’m collecting that feeds back on itself, so that you have this continuous improvement? That’s the compounding loop, I think every customer wants to be in it. How do customers think about timing? It might be the case that in the fullness of time you’re just getting a median answer from a probability distribution, it is all beta, but if you’re first to beta, you can still make a lot of money. Is that the sentiment that you’re running like, “If we incorporate AI first, sure it’s all mid, but timing matters too?” SS: To make sure I understand, the mid point is coming from the frontier labs? Or weaker post-trained models? Let’s say you’re in a company that is considering it’s competitive set, who they’re competing with and they’re like, “Okay, Palantir, this is a good pitch, I think in the fullness of time you’re right, we should not be giving our knowledge to the frontier labs, we should be building our own hill-climbing capability, keeping it all internal, that’s what differentiates us. However, that’s going to take a while to get that set up. I could lean in to using the models right now, my competitors are not, if I’m first, I’ll have a short term advantage, I’m motivated by the short term, and that’s going to be enough”. Starlink on airlines, everybody is going to get Starlink eventually, but United is going to get a lot of benefit from doing it first. SS: I would tell customers they should win today, the primacy of winning does matter . But the part I push back on is, “How long does this stuff take?”, I’ve actually been surprised — it takes a week, especially if you have the operational exhaust where people are already using you to make the operational decisions, to develop a new post-trained model you can put into production. So that’s your alternative. Empirically, where we’ve done this, you get better-than-frontier performance at task-specific things. Say my business is selling electronic components, when people submit a request to purchase components, they submit an electrical-engineering diagram — pretty technical, definitely out of distribution for the frontier models, it requires a vision-language model. I have all my historicals, what the input is of the spec, and what the BOM [bill of materials] was that I quoted back out that a human built over the last 10 or 20 years. It takes a week to go train that model, and now you’re able to respond to your customers with a price faster than your competitors can, because it’s going to tak them weeks to work their way through the same specs. Presented by When I write about tech companies, I am often writing about businesses that depend on Stripe , because Stripe provides the foundation for Internet-native companies — including Stratechery. Consider Substack: building Stratechery was complicated and involved gluing together disparate pieces; Substack made it easy by delivering an integrated offering. One piece that was the same, however, was Stripe: Substack creators are also Stripe customers, as are creators on many other platforms. Zoom out and the pattern repeats. Fintechs can build entire business models around card programs without ever having to build the issuing and processing infrastructure underneath it. AI companies can charge for what customers actually use, which is particularly important when usage also drives costs, without having to build the systems to track and bill for it themselves. No business succeeds because of Stripe. Stripe doesn’t answer the hard questions about what to build or whether anyone will actually use it. But it does make more things practical to try. Number seven, could successful AI adoption be bad for frontier-model economics? If a workflow succeeds on a frontier model and then migrates to a smaller model the customer controls, or to ordinary software, who captures the value? SS: I think the customers will capture the value. I don’t think it has to be bad, but this is the fundamental question going back to something I said earlier which is, to what degree are the frontier labs selling progress that the next model will always be bigger and more powerful and more interesting than the prior model, versus to what degree are they selling a product? The more they’re selling progress, the more customers are rationally going to take non-frontier use cases off their workflows. Is it inevitable that the labs have to come for all software companies, because of the commoditizing nature of their models ? SS: I don’t know if it’s inevitable, it’s an open question, there’s still a question of how much value do you realize from incrementally more powerful intelligence? Right now we’re in a peak phase of not being able to distinguish between things that are dope, every new model release, I love, it’s really cool, but I’m also not seeing a commensurate amount of translation of new economic value unleashed that I couldn’t have previously gotten before. Why won’t frontier labs just own the entire inference layer from top to bottom, from smart models all the way down to dumb models? If it’s ultimately a commodity market, won’t they have a superior cost structure given they have the best AI to build the best inference anyway? SS: If it’s just about the cost of inference, probably. The question is whether you’ll have more and more things that are out of distribution, and that you get better performance from models you own, and to what degree companies will be comfortable on use cases that do represent alpha? So is this the key thing? Is your reason to be out here to exhort companies to stop giving their data to the model makers because, all data being equal, they will win? SS: I definitely think that’s true. Partly it’s to make sure companies know there’s an alternative for the use cases that aren’t solved today and to the extent you’re wondering where exactly is the ROI going to come from, why is it that the only uptake I’m really seeing is coding? I’ve had these two out-of-body experiences, probably bad form to talk about, with each of the frontier labs, where different people were saying, “You should really see the work that we, the lab, have done at this company”, but the reality is it was work I did. Yes, I’m spinning the token meter, but the translation of the model to economic value for that company required someone who actually had a sharp opinion on diffusion and the realization of that value. Is DeepSeek the most effective Chinese company there is? Particularly given their MIT license, and they just open sourced their inference stack . Do you use DeepSeek, how do you refrain from using it? SS: We don’t use it ourselves, but we let our customers in the commercial world have choice in the models they use. While I encourage them to use the Western stack for lots of reasons, and there’s a burgeoning Western ecosystem that’s definitely good enough, there’s a degree to which people have over-indexed on benchmarks and the bench-maxxing that’s happened. When Nemotron 3 was released — just vanilla, non-post-trained Nemotron 3 — we brought it into our own stack that we use to manage our internal operations, and there were five use cases where it was better than frontier, which should not be possible if benchmarks were a true, faithful representation of intelligence across its full jaggedness of it, should not be possible. So I lost confidence in benchmarks, and started this movement internally that it’s not about bench-maxxing, it’s about bench-making. The cardinality of benchmarks should be at least one-to-one with the number of customers in the world — what is your benchmark, what do you care about, how do you evaluate models against those things you care about? That’s a very empowering frame, getting out of, “What’s the latest, coolest model?” versus, “What actually matters for me, how much improvement is there, how do I trade off latency, cost, performance against all these dimensions?”. Why don’t you make your own model? SS: If I felt we had the need to make one, I would. Mostly since we exist in the context of our customers, I help them post-train models that solve their problems. I’ve toyed with and think there might be opportunities to create models more intrinsic to our product, that are distributed to all our customers that solve very specific problems, or a starter checkpoint they can start off of, that I think gives them a running head start against some of the problems they care about in domains with unique phenomenology in particular, things way out of distribution. I could see your overall argument, we’ve talked before, and we both love looking at industries in terms of the value chain and where it actually matters. I think your overall argument, and I’m trying to play Devil’s advocate here, I absolutely see the value in the data and owning the ontology, that and chips being the inputs all resonates with me. At the same time, there’s an aspect of controlling your own destiny, the essential inputs, and you opened this discussion talking about the problem with globalization — the idea that on the margins it made sense, but in totality you lose the plot. It’s interesting to the way you’re concerned about the models whether that be from an ideological perspective, from a them taking your exhaust perspective, from a them backwards-integrating into what you do perspective, why aren’t you investing to have an alternative, or contributing heavily to those who are? I’m sure Mark Zuckerberg would take some money, I’m sure Jensen [Huang] would take some money. Is there an aspect of putting your wallet where your mouth is? SS: The business case would be, I’m not sure the value accrued to the models. Certainly the residual compounding value is what we provide our customers. But then what’s there to worry about? It’s not going to accrue to the models anyway, isn’t the market going to take care of all these concerns? SS: I’m not worried — I think it will. Partly my exhortation is around, if we’re in a rush to realize the value of this genie of AI, are we actually putting all our emphasis and chips in the right place? We should be careful not to think of the Chinese as being ten feet tall but if you juxtaposed it with the profound focus the Chinese have on AI is about productive forces — how do we actually get economic value out of this? You can say that even the commoditization — one there’s an aspect of economic warfare through distillization attacks, we’re going to release an open-weight model and destroy a huge amount of U.S. market cap but the other part is, it serves as a stimulus and subsidy for the rest of their ecosystem, where they want to get better or are really good, from power to chips and I think it won’t be that long before the Chinese models are not open-weight. Why is that? SS: Because as they start to feel they’re at the frontier, or attempting to get beyond it, they’re going to try to monetize it and close it down. Do you think they’re at the frontier? SS: No, they’re behind it right now. Can you be a Chinese model maker and not be totally dependent on distillation? Doesn’t that leave you completely uncompetitive with your peer set? SS: Yeah, it does. Which maybe is the other aspect of it is how the CCP views the models as a threat to their own security and stability. There feels like there’s an aspect on all sides of, “Let’s just trust the market and our intuition”. From my perspective, I wrote Who’s Afraid of Chinese Models? this summer, which got at the fact that everyone is stuck on API prices, which of course include a profit margin. At the end of the day, I want to know the actual cost to serve. My assumption, I think a reasonable one, is that the frontier labs can serve very efficiently, in part because they have that capability, serving a very large Chinese model costs real money, it’s not like you can serve it for free. By the same token, this assumption that because they accelerated to six months behind, or three months behind, whatever you want to say, that it’s inevitable that acceleration will surpass — when the distillation explanation both covers exactly what has happened and continues to cover what has happened. When you think about the overall economic forces of the Chinese labs, they have to depend on distillation, if you develop a dependency on distillation, you won’t develop the capabilities to be on the frontier. So why can’t we all just relax? SS: Because winning AI is more than having the most powerful model. Maybe this is the fish-in-water thing I didn’t articulate, why do I have all this angst about how quickly we’re diffusing? Because that’s the whole race, the whole race is who realizes the most value and is in the best compounding loop around the things that matter, as opposed to the dope fact that we have a cooler and cooler, more powerful model. Got it, I finally got you to answer my first question, I just had to go around for a while. Are the labs copying forward-deployed engineering, or just the job title? Palantir is very famous for this — you specifically, the most famous for this — what is a forward-deployed engineer as you developed it, and does that apply to what the labs are doing in terms of creating these organizations that go into companies and help them adopt AI? SS: At this point it’s turned into the most popular job title, it goes beyond the labs, really. What a turn of fortune, huh? SS: For 17 years I was maligned as the person ruining Palantir because I created this horrible concept of the FDE, and then it became the coolest thing ever. But the challenge is, before you say, “What is a forward-deployed engineer?”, you have to say, “What is forward-deployed engineering?” — and that actually it’s a product strategy, not a role. There’s a role, yes, but it’s way downstream of the thing that makes it happen. The reason I think it’ll be very hard to copy is there are probably five people in the history of Palantir who know enough about the strategy to actually recreate it anywhere else. You can’t just go hire someone who was an FDE and do this. Just even as a starting point, forward-deployed engineers are not part of your go-to-market organization, they are part of your product organization. Right, they’re deciding what gets built by seeing exactly the problem the customer is having, communicating directly or being part of the product team and that influences what is rolled out next. SS: It goes through multiple layers, you’ll have to indulge me as I try unpack it. The first part of it is if your product exists on some Gaussian distribution of features, “I’ll average the signal across my thousands of customers and decide what to build next”, forward-deployed engineering is not the right strategy for you. If, on the other hand, your customer set exists on some power law, where for a set of problems you’re solving, there’s a small number of customers with the hardest version of the problem and if you can solve it, you get the entirety of the market, because everyone else will have this problem, they just don’t know it yet, some are living in the future — then you have to go from specific to general. The journey from specific to general is very hard is very hard, engineers hate the notion of wasted work. But you get from one to two to three, and you’ve earned enough surface area to understand the general form of the solution that’s going to work for the fleet. It’s a heterodox way of thinking about strategy, and it requires thinking about the shape of the engineers who do this work differently. Engineers exist on a broad continuum — this is a caricature, intentionally so, to be illustrative — on one end you have the hacker, the MacGyver, the person whose dopamine hit comes from solving this problem in the world. They’re the best duct-tape users in the world. SS: Absolutely! Never mind, it’ll only work once or twice, but, “This thing is true because of me”. They have a knack for figuring out which problems are worth solving, which is hard, let’s call it the first 80% of the problem. There’s a different skill, call it the artist, the other end of the dialectic, the engineer whose dopamine in life hit comes from how beautifully built the thing is. Never mind it solves no problem anyone cares about, “Don’t you see how elegant it is?”, this dialectical tension between two extremes, and how you get to the second 80% of the work. Each personality undervalues the contribution of the other, so it’s held together as a dangerously unstable equilibrium that has to be managed. I think we’re up to 96% if I’m doing the math right, so what’s the last 4%? SS: No, 80% + 80%, the whole point is the math doesn’t math, because everyone thinks they’re doing the majority of the work. So the answer is, someone sees a problem, doesn’t just understand the problem and what to fix, but how to fix it systematically so that it’ll be a sustainable fix not just for that customer, not just that time, but going forward, for all customers. SS: Yeah, and earning the opinion on where the abstraction should sit in the stack so it can actually generalize because building an end-to-end solution is overfit to one customer. So what are the parts you’re actually going to generalize, and what parts do you let be customer-specific? It’s engaging with an inherently messy process. I think a lot of folks are jamming a sparkling form of sales engineering, they take the FDE role and say, “We have really smart engineers who can go work with customers”, but there’s no way of metabolizing the pain the FDEs are experiencing into product, if you don’t have that, you don’t have FDE — it’s just sparkling sales engineering. Two questions to follow on this. When you talked about the Gaussian distribution of customer problems that lends itself to, “Build one thing that broadly solves a problem for everyone”, in many respects that’s consumer software. The best consumer software companies and consumer software leaders do not rely on focus groups, because you can’t get a focus group on eight billion people — you have to have your own sense and drive the software in a particular direction and believe in your vision. There used to be a phrase, you’re old enough to remember this, the consumerization of IT . Was the consumerization of IT, in your view of the world, the application of this “one solution for everyone” mindset, when engineering IT back in the day was line-of-business apps, it was people actually building software for their organization? In the SaaS-ification of everything, the spreading out of R&D across as many customers as possible, that is the issue that you’re pushing back against, and that’s actually what happened with the consumerization of IT. It wasn’t just about user interfaces, it was about one-size-fits-all. SS: I’d agree with that. But I think the correct point is an unstable equilibrium between the two. There’s a constant need for the masses to revolt against the high priests who have their perfect conceived notion of how things are supposed to work but they don’t work. Part of the problem is there was an economic rationale for this in that developing software was exceptionally expensive, so you needed to spread it across everyone, and because you had leverage over enough customers, you could do an 80% job that was better than a dedicated individual. I think the argument for AI is actually no, you can do small-scale engineering projects that solve 98% of the problem instead of 80%, and get back to a “many flowers blooming” approach much more akin to the ’70s and ’80s in terms of enterprise IT. SS: I think that’s right. And again, you’ll find the pendulum keeps swinging. There’s a proliferation where people go all-in on Codex or Claude Code in the enterprise, a proliferation of apps that don’t speak to each other — almost like attritional software. You built it to solve a problem, you either kill it or you accumulate debt over time. So what constrains that entropy? That’s what we think ontology does. The ontology provides that constraint point you can govern, so these things can interact, you can have a lot of freedom to vibe-code an app, and the cost of it operating in your enterprise is low, the cost of throwing it away is low. So you can empower your builders without giving up your ability to have a cohesive operating system for the enterprise. Here’s a defense, or a question, about the AI labs putting forward their versions of FDEs — or was it “sparkling sales representatives”? Isn’t the actual FDE the model itself? It ties into your overall concern, the way for them to solve your problems is to actually absorb all of your data. So yes, the people are not the FDEs, the AI is the FDE, and that’s the actual FDE you’re worried about? SS: I’m actually not worried about that now, this goes back to my experience of, “Let’s just have AI FDE be the entry point for everyone in our platform”, it’s all a mean reversion. There’s a lot of value in getting the problem decomp right, and if you get only an okay problem decomp, you leave a lot of the alpha on the table. That’s probably the part I’m least worried about going away. What are you most worried about? What has changed between 2023, when we last talked, and 2026, today? Are the models more capable than you expected? Less capable? How do you view the world differently now than you did before? SS: The models are more capable. I don’t know if I had an expectation — it was so hard, in a world before AI, to truly have an expectation, but it’s amazing, I’m delighted every time I see a new model release and get to play with it and get to see what’s possible. What I’m more convicted of is that there’s not a one-for-one overlap between human intelligence and machine intelligence, and the more we’re willing to build things that make sense for machine intelligence alongside the humans, the more value there will be. I see this in subtle ways. This might seem orthogonal, but it’s very relevant — I have this parts manufacturer for the submarine industrial base, and it used to take them two weeks to do their production plan during which the line was down. With AI, it took less than ten minutes, and now they have all this excess demand they didn’t have people to go do so they hired a third shift. There’s an army of blue-collar laborers who have their job because of AI, not because they use it, not because they think about it, they’ll never tie that back together, it’s the opportunities in our economy I don’t think people are going after hard enough. Just one question, I just mentioned the Anthropic thing — a lot of this feels, at the end of the day, feels like a lot of this conversation is ultimately about Anthropic. You were very close partners with Anthropic — the whole using Anthropic in the U.S. national-security apparatus thing was through Palantir. Do you regret that? When the whole showdown happened with the Department of War , were you stuck in the middle, or decisively on one side or the other? SS: Ben with the tough questions. Yes, we were stuck in the middle. I don’t regret it. We still work with Anthropic, we work with both frontier labs. This speaks to AI sovereignty right on the head which are who gets to decide how these things are used? I do think there’s a question of epistemic humility over these issues, which I’ll get to in a second. The customers have to decide if they’re going to be okay with the terms of use of a model or not, and what will the market accept ultimately. I’m not sure it’s going to be sustainable for model companies to have long, nuanced arguments over, “How will you use this thing?”, it’ll be much more binary, do you want to work with this institution or not? You have to trust your customers, to certain degrees around these things. It was probably not handled excellently by many parties involved, but it did surface an important issue here, when the intelligence is coming from one place, what are the conditions do you need to know you can depend on it in a mission-critical environment — whether that’s the factory floor or a government organization? Did that change what models you’ll work with — or is that still up to the customer? SS: I want that to be up to the customer. What it did change is we spent a huge amount of energy and effort on being able to safely swap models out , and being able to exercise that sovereignty. You need that just as much to go between two frontier labs as between a frontier lab and an open-weight, post-trained model that you’ve created. Creating that scaffolding gives customers assurance, if you thought it was a two-year journey to do one of these swaps, the decisions you’re making are effectively a one-way door. If it takes two minutes to do safely against an eval set for a specific set of workflows, you don’t have to be hung up about this in the same way. I think I’ve created a lot of trade space for my customers as a consequence. What was a bigger effect in developing this capability — that episode with the Department of War/Defense, whatever you want to call it — or was it that whole Fable “ No more zero data retention , I promise it’s for safety” angle? Was that the one that actually woke people up? SS: The second one woke up the broader commercial world, because until then it seemed like some narrow government dispute, “What do I care about that?”. The first one allowed us to build the product that we needed to enable that so when the second one happened, we were able to give our customers choice, to make decisions inside the OODA loop of “Holy shit, I just woke up to this reality, what do I do?”. Did that apply to you? “Holy shit, we just woke up to this reality — what did we do?” SS: Oh yeah, a hundred percent. So was that actually the best thing that happened to you? SS: I’m not sure if it was the best thing that happened to us, but we felt like we had seen where the world was going, and the sorts of trade space we would need. There’s a clarity that’s come, I think, from Alex [Karp] and from Satya [Nadella] in particular , who have basically been saying the same thing. Maybe I should ask you, is Microsoft actually your competitor in the long run? Both of you are talking about this concept of being harness-makers — the ontology, Microsoft Graph, whatever you want to call it, having the data in a controllable way, building your own hill-climbing capability, so you’re absorbing your own learnings rather than giving them away to a model. But it felt like I wasn’t getting that message clearly from either of you until about six months ago, and it’s like no one was really paying attention to this until then. SS: I’ll give you the inside baseball. Before Alex’s CNBC interview , it was the end of the quarter, he’d probably visited sixty customers, and every customer in private was telling him this, but none wanted to say it in public. It was very clear that there was this underlying frustration and belief that no one was willing to put their finger on. That’s part of why it had so much resonance, and why he delivered it with so much conviction and certainly, if you look at what we’re saying, we see the world in very similar ways to Microsoft. Number four, I told you we skipped this one, has effective altruism turned AI safety into a secular religion? SS: Clearly I think so. One of the things I’m worried about most, this goes back to the systems-engineering critique is that you have this weird rhetoric — the argument is essentially, “AI is going to create utopia, but of course there’s some chance, between 0 and 20 percent, of ending humanity”, so dystopia. These seem contradictory— They’re not contradictory — they’re two sides of the same coin. It’s a rejection of any middle pragmatic path towards absolutes. It’s extremism, just manifested in two different ways. SS: I’m preaching to the preacher here. It rejects all human agency in what’s happening right in front of us and therefore the obligation toward systems engineering. It influences how you even think about testing these things, what you think would have to be built around these things. I don’t begrudge anyone their articles of faith, but when your articles of faith are represented to the world as technical critiques, it’s very dangerous and risky. People think, “Who could know more than this person who works on this thing?”, and that would be true if it were a technical critique, instead of a religious perspective that comes out of a unique worldview. It’s a combination of a millenarian cult with a messianic complex. It’s, “This thing is going to end humanity, except if I do it, we have some chance of working out”.** You are preaching to the choir — I’ve written about this. You have to reject the frame completely . You don’t argue the relative chances, the expected value of utopia versus dystopia, you question why those are the only two options that might come out of this. But here’s the question: for many years people would say Palantir is maybe akin to a religious organization. Today defense tech is hot, but when Palantir came along it was not hot, you went there because you were a true believer. We may have talked about this last interview, we’ve certainly talked about it at some point, and the power that granted you as an organization to push through all these problems, to figure out all these issues, because you believed you were doing something important and meaningful. As you look back, how important was that belief system — the shared belief system — to Palantir’s success? SS: I think it was crucial. Part of the reason I can see this so clearly is that cult recognizes cult. We were a very different sort of cult, in the service of the West, in the service of democracy, a belief in state capacity, that the legitimacy of our institutions depends on the people who been elected to run them having the tools to run them in a way that serves the will of the people or their shareholders. That national security and prosperity are two sides of the same coin, national security is not an end unto itself, it’s a means to prosperity and human flourishing. You’ve got to get these things right, particularly in a post-terrorist world where every one of these events was a one-way ratchet toward less freedom and less security somehow. So yes, it was crucial to getting us to work, that’s why cult recognizes cult, although they’re very different cults. Is your critique that this is a religious movement, or that the religion is wrong? SS: That the religion is wrong. So this is a religious war. There’s a War on Terror callback for the people who know. SS: It is a religious war, but I’m not interested in fighting the religion head-to-head, I’m interested in making sure that people listening to the doomsaying have an understanding whether they’re hearing a technical critique — the presumption everyone has — or a religious perspective on a future world that may exist, and then let them decide. How is it the case, though? It’s really striking, I’ve been picking at you and teasing at you that all your arguments, which I believe are heartfelt, do happen to perfectly align with Palantir’s business model. It is in your interest for companies to understand and believe that the data layer is what matters, they need to control that, that the models need to work in service to them, not throw your exhaust to the model, you’ll get the median distribution anyway, etc. I think that’s all valid, and it also perfectly aligns with what’s good for you. By the same token, the remarkable thing about Anthropic — which just filed their S-1 , I haven’t had a chance to read it yet — but all their fervor, doomerism, and the things they put forward that you’re critiquing for not being technical, happens to perfectly align with their business model . It aligns with what they’re selling, and, interestingly enough, often with their customers’ interests — their customers don’t view Anthropic as a competitor, “Better they’re trying to create God than trying to compete with my SaaS application”. Is there a certain extent of game-recognize-game here? SS: The part I’d say is we’re all still founder-led institutions with a huge amount of agency over our business strategy and what we’re going to do. And the best way to run that is to align your strategy to things you actually believe in, all these things are all so hard. So I think the business is downstream of the fundamental beliefs you have. So at the end of the day, what decides who wins? Is it who believes harder, who works harder, or will fundamental market forces come to bear? You’re making a lot of arguments that companies that don’t pursue the median, that preserve their businesses, are going to succeed in this world, and in which case, isn’t everything going to be fine? SS: Unless we engender non-market forces that are reactionary. Like wrong safety regimes, a drive toward nationalization, we have data-center moratoriums that are engendered through a doomerism belief structure, we’re not able to rationalize and execute on delivering the benefits of AI to the average person in a way that lets them participate in the economic upside. All these forces, everything from a replay of the French Revolution to turning our back on the fundamental progress of capitalism are the greater risks. Shyam Sankar, thanks for the interview questions. SS: Thanks, Ben. Thanks for having me. This Daily Update Interview is also available as a podcast. To receive it in your podcast player, visit Stratechery . The Daily Update is intended for a single recipient, but occasional forwarding is totally fine! If you would like to order multiple subscriptions for your team with a group discount (minimum 5), please contact me directly. Thanks for being a supporter, and have a great day!

0 views
Blog System/5 1 months ago

BazelCon 2026 recap

We are right in the middle of fall, and that means BazelCon 2026 just took place. This time around it was hosted in Amsterdam and spanned three days: one day of tutorials and an overlapping Buildbarn meetup that I wasn’t aware of, and two days of main-conference talks and events. And as the event is behind us, it’s time for the now-traditional recap. Welcome to BazelCon 2026 sign. What follows is a recollection of my notes arranged by topic and intermixed with my own commentary and thoughts. Some sections and topics are more detailed than others because in some cases I didn’t have a seat and couldn’t type enough, and in others I got distracted in the hallways chatting with people. Speaking of people, several of you approached me to praise previous editions of these recaps, so I now feel obliged to write another one. Thanks for the kind comments! As we will see, “scale” was a central theme of the conference: AI is multiplying concurrent builds and tests, artifacts and graphs are growing at an accelerated pace due to new features like configuration transitions, and the ecosystem is responding by making execution, caching, and analysis more efficient. There is a lot to cover but here are a few things that felt memorable to me : The BUILD Foundation is now a reality, giving the Bazel ecosystem a vendor-neutral home. Its goal is to act as a proxy between the community and Google to help Google understand what to prioritize and to fund projects. If your company can spare “a few” dollars, please donate! AI-driven development is having a broad impact on the industry and, in particular, everyone is seeing their CI systems become overloaded. Well, news at 11: I’m dealing with this day in and day out. But what was new to me was that we at Snowflake are not the only ones struggling with local system overload. Lots of people out there have likewise “discovered” Git worktrees as a way to run multiple agents in parallel, which in turn means multiple concurrent Bazel servers. Bazel 10 is shaping up to be a substantial release that will help with the problem right above due to its many performance improvements and memory consumption optimizations. Have you struggled to keep Bazel up-to-date before? These days, if you want to get any platform-related work funded you have to spin it in terms of AI, so this release will be an easy sell. Let’s “Rewrite it in Rust”? I’m impressed. Google is seriously evaluating a progressive rewrite of Bazel in Rust, and this is probably the most exciting news I got out of the conference. You know I’ve been critical of Bazel’s usage of Java since day one so, if this takes off, I’ll be the first in line to evaluate the results (and it will likely push me to actually contribute to Bazel again). Fast and correct sandboxing on macOS remains a problem. This is “interesting” to me because it’s a problem I tried to fix almost ten years ago with the original sandboxfs, but I failed because of unexpected bugs in macOS’s FUSE support and eventually abandoned the idea when FUSE became a dead end on Apple’s platforms. Funnily enough, other folks have now reinvented sandboxfs—and even given it the same name (ugh)—and there is even another implementation of a similar idea in the form of actiondFS. Types are coming to Starlark, but Bazel’s late arrival to the party means that multiple competing approaches now exist. We have at least two LSPs with different annotation mechanisms and Buck 2’s own syntax. Hopefully they can all converge. Platforms and configurations remain difficult to model at scale. Careless use of transitions and build settings can produce an explosion of configured actions. Apparently, as one speaker noted, AI agents love transitions for some reason, which is interesting because they are not a popular feature and they are not particularly easy to use. Let’s dive into the full report now. You’ll find my notes arranged by talk but I’ve tried to group them into higher-level themes for easier navigation. These conference summaries take effort to write, and some of you are waiting for them. Show your true support by subscribing! The two keynotes are usually the most information-packed events but… as you can imagine they are also the most popular. The venue this year was not roomy enough to host BazelCon’s attendance (Helen quoted that we got 600 registrations), so I had to stand for these two events. The recordings and slides are not out yet, so consequently, I can only tell you a few details from memory. The conference opened with the usual Bazel Community Update , presented by Helen Altshuler from EngFlow and Chuck Grindel from Glydways. The biggest announcement is that the BUILD Foundation is now a reality. The effort had been discussed at the previous two BazelCons and likely various meetups, but it had remained mostly invisible while its organizers worked through the legal and financial details. The foundation now provides a neutral organization to support the broader build ecosystem (in their words this is not just for Bazel), and it is looking for both members and concrete proposals to fund. If you want to get involved, get your company pumped up and email [email protected] . Documentation continues to receive attention as it has always been a lowlight in previous surveys. Work is underway to make the docs easier for the community to own and improve by decoupling them from Google’s internal systems. But one must wonder: what exactly is the biggest problem with documentation in today’s world? AI agents used to do terribly with Bazel just a year ago and nowadays do… fine as we shall see in the summary. Maybe the work on documentation needs a different spin now. And as usual, a reminder to fill the annual Bazel user survey . Your input is necessary to quantify ecosystem-wide pain points and influence future work, especially now that the foundation exists. John Field and Tobias Werth from Google followed with the State of the Union , which presents a recap of major improvements during the year and the path ahead for Bazel 10 and beyond. Performance remains a major theme. Google reported improvements of about 15% in some workloads together with reductions in memory consumption. Some of these speedups come from upgrading from Java 25 to 27, while others come from correct action rewinding, optimizations to Skyframe cache pruning, and content-defined chunking. These changes are very relevant because Bazel’s large memory consumption gets in the way of scaling CI and prevents using multiple AI agents in parallel. And here is where we heard about Skymetal: the codename for the Google-internal exploration of rewriting Bazel in Rust. The rationale for this rewrite is obviously performance, and I’m guessing it’s now a real consideration because AI can make such large-scale changes feasible. Tobias acknowledged that Java was a reasonable choice back in 2006 when Blaze started and that the JVM can deliver great throughput performance at scale… but it is not the best choice for a tool like Bazel in this day and age, especially when optimizing for memory efficiency is critical. I called it in 2015. I have been in the BazelCon Program Committee (PC) for 3 years now. I remember that, during last year’s review, we encountered a few AI talks but I think none made the cut: they all looked too hype-y and out of place. But it was impossible to ignore the topic this year, and it was actually important to bring AI-related talks on board to not sound tone deaf. AI is a reality in our industry, and Bazel is a key component to survive the transition. Nicolas Lopez from EngFlow and I, representing Snowflake, presented AI Development: Challenges and Early Learnings for Bazel . Agentic workflows have expanded rapidly throughout 2026, and the effects are visible well beyond code generation. At Snowflake, we were fortunate enough to finish our Bazel migration and to stabilize remote execution by moving from our self-hosted open-source deployment to EngFlow’s fully-managed service before all of this happened. And I say fortunate because the increase in CI load that AI workflows brings can only be handled with a good build system and caching story. But none of that is news, so the core of the talk was to look at how Bazel usage looks different in agent-initiated environments. The key points from my side: Agents run more builds more frequently than humans, discover and invoke targets that were often “internal only”, and explore several approaches in parallel. Your intuition about how to evaluate which builds matter and how to measure them is probably wrong by now. Bazel and IDEs have never played great together and maybe that just doesn’t matter anymore. We are seeing a sharp decline in IDE usage, although developers still want a way to browse code changes and debug them. This means LSPs are key now to support “leaner” IDEs, and maybe standalone debuggers. Short build and test latency is critical when a human must remain focused on a coding task but, in an agentic workflow, the constraints are different. You know that, after you hit “execute this plan”, the agent will take many minutes to return so minimal build latency is not as important. And actually… maybe you now want to trade some latency in exchange for extra validations so that agents have to take fewer turns to converge. And because humans are now waiting for agents to finish for long periods of time, they have to fill that time with other tasks, which has driven them to adopt Git worktrees en masse. This is leading to scalability problems on dev machines because multiple concurrent Bazel server processes are not great for memory and disk usage. The rest of the talk, presented by Nicolas, focused on trying to understand behavioral changes by looking at anonymized backend data across companies. One specific insight was that people’s work days have lengthened over the year. Cynically, the promise of “working less because of AI” has not materialized: in fact, we are all seemingly working longer hours and with fewer chunks of focus time, so the dangers of burnout are higher. Maggie Lou from BuildBuddy presented Taking Humans Out of the Build Loop . The premise was that coding agents have improved quickly, but people still spend too much time copy/pasting logs, triggering builds, explaining failures, and reviewing the results. In her presentation, we witnessed many new features in BuildBuddy to allow agents (and humans!) to interact and diagnose remote builds with ease: to download filtered logs for a build. to answer questions such as “Why was my build slow?” which are extremely common in the Bazel ecosystem. to start a remote Firecracker VM and run Bazel inside of it. The VMs are snapshotted for quick reuse, and the runners can execute arbitrary commands rather than Bazel alone. to diagnose a failed build and either create a pull request or push a commit with the proposed correction. to perform a review and post comments to GitHub. The need for these features is unsurprising this late in 2026, but what’s really useful in their offering is how these features integrate with build data. Inspecting the BEP, profiles, remote execution metadata, and logs in unison via an agent can yield much better diagnostics and automated improvements than staring at just a few lines of console output. One thing that surprised me in chatting with the presenter is that BuildBuddy is not particularly big in terms of headcount but they churn out features at a very high rate—and that was true even before AI. Impressive! Armando Montanez (and Ulf Adams, but he didn’t make it) from EngFlow presented Proving Equivalence in any2bazel Build System Migrations . The talk described a structured way to use AI agents for build system migrations and started with a reflection: AI agents used to be terrible at Bazel less than a year ago, but now they do pretty damn well—especially if you can close the loop with automated validations. However, even if agents do well at writing Bazel builds, the fidelity of a migration leaves a lot to be desired if left unattended. And here is where any2bazel comes into play: it turns the process into a guess-and-verify loop. The initial focus of the tool are CMake-to-Bazel migrations, and the tool comes with a script that extracts reference compiler and linker actions from CMake in a deterministic manner. The agent then writes Bazel build files, runs , and feeds the resulting actions to a differ tool that compares those to the originals. The loop continues until the two action sets are equivalent. The equivalence checks are what’s hard though: there are compiler flags that may have no impact on the result, for example, so they need to be “ignored” to let the agent experiment with different Bazel-native approaches until it gets to bit-for-bit identical outputs. It’s important to focus on comparing outcomes and not internals so that the generated Bazel builds do not necessarily follow ancient idioms, like e.g. a Maven-like project structure in a Bazel build. In the end, though, this approach works surprisingly well. But the question is: “How good are the generated build files?” The presenters evaluated them along four axes: Correctness: Good, because equivalence is the central constraint of the loop. Hermeticity: Good, but you might need to do extra upfront work to remove host-specific behavior from the reference build before starting. Efficiency: Usually good when standard rules can model the build. Complex projects with custom build rules may end up with overly large Bazel actions though. Maintainability: Unsurprisingly, the weakest point. Agents tend to model variation with configuration flags instead of proper platforms and toolchains, which is not idiomatic to Bazel. Expert review of AI outputs remains critical, which is, again, not surprising. As a side note, it seems like the team likes pain because they tried to migrate an MSBuild project too. MSBuild is more painful than others because its binary log requires running through a real build: there is no dry-run mode, so it might be difficult to extract a truly clean log of actions, and the process is slow. Fortunately, the reference needs to be extracted only once before the comparison agentic loop can start, and it works: we saw a POC migration of the Color Picker tool that comes from PowerToys. When optimizing a distributed build system, it’s easy to focus on the costs of the remote execution workers: how many there are, what kinds of hardware they use, how well they auto-scale… but a significant driver in cost comes from the storage systems required to support those workers. In other words: the remote cache is expensive. Let’s look at a few topics that deal with this problem. Tyler French from BuildBuddy and Benjamin Ingberg from Meroton presented Content-Defined Chunking for Bazel . This was one of the most immediately-practical talks for anyone operating a remote cache, and it surely caught my eye because I had just been troubleshooting a problem at work that CDC would have prevented in the first place. The problem is that Bazel has traditionally treated each file as one indivisible blob. If an action produces a one-gigabyte binary (not uncommon these days huh) and this binary only changes by a few bytes from a previous build, the client or remote worker must re-upload the entire new file to the CAS and the CAS must store a full copy of those bytes. This is inefficient network- and storage-wise because the cache has to be overprovisioned so that these very large, rarely reused blobs don’t prematurely evict valuable cache entries. Content-defined chunking (CDC) divides a file into variable-sized pieces that can be cached independently. To compute the chunks, a rolling hash scans the contents and chooses boundaries when the hash matches a particular condition. Because the boundaries depend on the content rather than fixed offsets, inserting a few bytes in the middle of a file shifts only the nearby chunks instead of invalidating every subsequent one. With CDC, Bazel represents the original file as a list of chunk offsets and digests instead of a single digest, and each chunk is uploaded or downloaded independently. The presenters reported average reuse of chunks of 36%, chunks of 40%, chunks of 96%, chunks of 98%, and chunks of 99.5%. Furthermore, BuildBuddy estimates that CDC saves 35% of bytes written, deduplicates 60% of chunked bytes, and avoids about 400 TB of traffic per day across its fleet. Finally, the median project sees about 70% less remote storage, while local disk caches shrink by roughly 40%. Impressive numbers. Almost all of these benefits can be achieved by enabling CDC on the backend alone without changes to Bazel because most savings come from worker-to-CAS communication. But there are improvements to be made on the client too, of course. CDC fits bb-clientd especially well because chunks can be reused across output bases and, to materialize a file, the client needs only its chunk map. This can be much cheaper than reconstructing the whole file on every incremental build. For existing users, the starting point is together with a server that supports remote CDC. You’ll want to use the latest Bazel 8.x or 9.x releases for best results, as earlier versions didn’t perform the necessary validations to ensure that CDC didn’t corrupt data. The talk ended with a plea for tool authors to rethink binary formats: files that contain absolute pointers in them are poison for caching even with CDC because small changes in a file can have cascading effects across it. Wherever possible, relative pointers are better. Lore is Epic Games’ open-source, content-addressed version control system for very large, asset-heavy monorepos. Mattias Jansson from Epic Games came on stage to talk about it. But this was not just a presentation of the version control system. This was also a presentation of how Lore integrates with Bazel to prevent ferrying large assets between Lore repositories, the machine running Bazel, and the remote execution/cache cluster. The insight is that Lore and Bazel’s remote cache are both backed by a CAS… so if they can share the same storage, artifacts don’t need to move around. The idea relies on the fact that Bazel-the-client does not need to know the content of source files. All Bazel needs to know are the digests of those files to detect file changes across builds and to compose Remote Execution (RE) API requests. You’d imagine that computing digests requires reading the files, and you’d be right… but the server (Lore) already has those files, can compute their digests once, and can expose those to Bazel for consumption. So, what Epic Games has built is a translation layer between the RE API and Lore’s chunked content addresses, plus a virtual file system that exposes the precomputed digests to Bazel. In this way, Bazel talks to just one storage system and can leverage digests without computing them itself. Of interest was a brief note that Bazel can now use BLAKE3 instead of SHA-256 for content digests, which can likely be a big deal for performance because the former excels in speed due to parallel chunk processing. TIL. Caleb Froese from Canva presented Diffing Millions of Screenshots a Day, Hermetically . The premise of the talk is that, when developing a UI, you really want to have regression tests for how the UI looks —and doing that at scale is difficult. The idea is simple, though: make the code render a part of your UI, capture a screenshot, and compare it against a known-good image. Check in the golden image into source control, and call it a day. Except… if you do that at Canva’s scale, you end up growing the Git repository by about 20 GB per day , which is obviously untenable due to how Git works. A different approach is to store the images elsewhere and expose them to tests through an external repository rule. This integrates well with Bazel in the sense that the downloads are out of the execution path, but it also scales poorly: too much data must be downloaded to each client just for it to be re-uploaded right away to remote executors. And it also creates friction for developers when defining the build graph. In the end, Canva’s solution is to use the Build Event Service and the remote CAS to keep the assets outside of Git while preserving hermetic tests. This pattern applies to any test suite with large golden artifacts, not screenshots alone. Similar story to what Lore tries to fix. There is one extra wrinkle to worry about: GPU-based rendering introduces tiny output differences that make pixel-perfect image comparisons difficult. Canva’s solution is to pin these tests to a specific hardware class by selecting an execution pool through the execution property. That trades scheduling flexibility for reproducible images, which is a good compromise for their workload. Optimizing the way Bazel handles large artifacts helps with performance, but there are many other things that do too. There were a large number of talks around this topic, so let’s dive into some of them. Guillaume Maudoux from Tweag presented Taming Configurations Explosion , a practical talk addressing problems they’ve seen while supporting builds that target physical hardware boards. Such builds grew to have more than three million configured actions even though only about 500,000 distinct actions needed to run. The root problem is that configuration settings accumulate. A project may begin with a setting for the target platform, then add the board’s operating system, its physical layout, its capabilities, and so on. Every setting creates a new dimension in the configuration space and, because each configuration gets a distinct output-tree hash, apparently-different actions may in fact do identical work. Before you know it, you have blown up the action graph and possibly your disk space too. In the example from the talk, 12 parameters end up representing 72 million possible configurations. Only 856 of those configurations matter, and a particular source file has just 39 meaningful ways to be compiled. The rest is duplication introduced by the model. There are three main tools to fight this: Reset transitions: These discard irrelevant configuration values as early as possible in the graph. The art is to move decisions up the dependency tree so that downstream targets do not carry unnecessary dimensions. The trade-off is that ordinary output can become unmanageable, forcing users toward . But then… requires a configuration, so some targets may not be queryable at all without one. Path mapping: If two actions cannot be made identical during analysis, Bazel can rewrite configuration-specific paths during execution and replace their hashes with a stable component. This should be seen as a measure of last resort, though, because subtle problems arise. For example, if the same logical path comes from different files from different configurations, Bazel disables path mapping silently. Tweag fixed Bazel so that different copies of the same file don’t disable path mapping, but debuggability continues to be a problem when this condition does not apply. Flag scopes: This new feature allows a flag to declare where in the graph it applies and to automatically reset to its default everywhere else. This is similar to a reset transition but requires less manual graph plumbing. On the other hand, describing the correct scope can sometimes be harder than writing the transition directly. Han-Wen Nienhuys from EngFlow presented Horapha: Your Personal Warm Bazel , a clever experiment to avoid repeatedly starting Bazel servers and rebuilding their in-memory state. Several CI systems already offer similar features for efficiency, but Horapha targets developer-initiated workflows. The idea is to snapshot a warmed-up Bazel JVM with a new command and save that to disk. A later either starts a normal server when no checkpoint exists or restores the snapshot and continues from the saved state. The implementation relies on CRIU (Checkpoint/Restore In Userspace) , a Linux-only technology that can serialize a running process to disk. Correct restoration requires preserving process IDs, which can be achieved by placing Bazel in a PID namespace. In other words: a container but without pulling in the full weight of Docker. The prototype is available in the Horapha repository with the corresponding Bazel changes in the horapha branch of Han-Wen’s Bazel fork . Han-Wen is now trying to carve a path to get this integrated into upstream Bazel. Did you know that Emacs works similarly? Your executable is actually a snapshot of the LISP machine computed during the build process and stored to disk by the portable dumper introduced in Emacs 27. John Cater and Antonio Di Stefano from EngFlow presented Persistent Test Runners . For a long time, Bazel has had persistent workers for compilation actions but supporting tests has remained elusive—yet persistent workers for tests promise to increase test performance significantly by reducing JVM startup times, sharing heavyweight fixtures across tests, and sharing state such as container images. The reason I said elusive is because Bazel has tried to solve this before. Twice. Google introduced a persistent test feature back in 2019 but it was rolled back that same day. The roll forward was attempted again a month later, already in 2020, but this time separating the feature flag from the runner. Unfortunately, the whole mechanism was scrapped in 2022 because it never worked reliably. The old design suffered from classpath problems after incremental builds, leaked state between tests, and was tightly coupled to Bazel’s native rule—an unacceptable constraint due to the desire to move all rules to Starlark. More fundamentally, the test protocol and the persistent worker protocol modeled very different things. The new proposal from EngFlow introduces an API that explicitly separates the settings and inputs used to create the runner from the data needed by one test request. That distinction is important because the runner infrastructure must be able to decide whether an existing JVM is still compatible with a new test. The team explored several alternatives along the way: Pre-warming the next JVM instead of keeping the current one alive. This provided more control over when and why to restart a test in a new JVM, but suffered from significant coordination overhead. Forking a JVM. This did not work because, due to POSIX semantics, only the calling thread survives a fork call. The JVM is heavily multithreaded, so if you end up losing all but one thread, the new JVM is just not going to work. Android’s Zygote. This provides a pre-warmed runtime ready to be forked ( , anyone?), but it exists only for ART, not the standard JVM, and it’s just not reasonable to expect a switch to ART. Checkpointing. Instead of forking a running process, why not snapshot it to disk so that it can be re-created again? This might have worked, like Horapha does for Bazel startup, but raised difficult questions about when to capture the process and how to handle state outside the JVM. In the end, the only piece that survived these experiments was the coordinator that asks the runner whether a JVM can be reused. The decision considers the Java executable, JVM options, driver code, plugin configuration, and the digests of all loaded JARs. Configurable hooks run at JVM start/stop events as well as before/after each test. When running Bazel’s own test suite, this approach reduced total test time by 46%. The prototype is available in the branches of TheGrizzlyDev/bazel and TheGrizzlyDev/rules_java . It can be tried with a local module override and . Unconference discussion topic proposals and votes for the second day. Remote execution BoF Chi Wang and Tiago Quelhas led the Remote Execution Birds of a Feather . I only stayed for half of it, and so I only captured the discussion around remote persistent workers. Persistent workers are already part of several commercial remote execution offerings, including BuildBuddy and EngFlow, but their implementation was derived from Bazel’s local persistent worker support, which is not… particularly well designed. For example, we have at least three different variants of the persistent worker protocol: one for “regular” persistent workers, another for multiplex persistent workers, and yet another for multiplex persistent workers that support cancellation. And the protocol does not clearly specify which flags and tools belong to the worker and which belong to the action being executed. In fact, these distinctions are currently determined heuristically, with the worker assuming that flag files correspond to the action and other flags to the worker. There was consensus that this should be cleaned up, but the unsatisfying conclusion is that rehashing these complaints and discussions is not going to lead anywhere until someone sits down and presents a specific proposal for a new API. So, if you are reading this and have… opinions… volunteer to do this. Helen Altshuler from EngFlow and Nikita Chepanov from Plaid presented Where Bazel Clusters Break at Scale: Field Notes from Plaid and the EngFlow Fleet . That’s quite a mouthful to say “load testing”. And the reason is none other than AI once again: Plaid’s build volume doubled during the year due to AI-assisted coding and is on track to reach four times its early-2026 baseline. With a predictable increase in load comes a predictable outage. So, instead of waiting for it to happen organically, Plaid deliberately chose to load-test their CI system. The goal was to reach multiples of the normal load and discover each bottleneck under controlled conditions. They had to go through six rounds of tests and fixes until they were able to sustain their desired target. The previous five uncovered problems in network bursts, AWS quotas, source control, CI autoscaling, and cache infrastructure. The solutions were not magical: find and raise limits, cache everything possible, and reduce demand where it does not add value. Examples of the last category include skipping tests for pull requests in the middle of a PR stack and avoiding uploads for actions when they are unlikely to be reused. An interesting observation is that Plaid runs EngFlow in Plaid’s own AWS account, so the cache cluster is co-managed. But careful: shared ownership can easily turn into ambiguous ownership. The two companies addressed this by agreeing on health metrics and thresholds upfront and putting them on a shared dashboard. Both sides now know who must act before developers notice an outage. Ah, one of my favorite topics. Back in my Google days, I spent at least three years of my so-called 20% time working on improving the performance of the Bazel sandbox on macOS. Those efforts were painful: creating a writable FUSE file system is difficult, and diagnosing mis-interactions with macOS was a horrifying exercise. Today, I’m not scared anymore: I’ve been recently using AI to write yet another file system at work and agents do exceedingly well at handling corner cases. Let’s see how modern solutions do better than what I originally tried. David Zbarsky from OpenAI presented actiond: The Quest for a Better Sandbox , which was the first of at least two talks on improving sandboxing performance and strictness. The project started from frustration with local sandbox escapes on macOS and eventually grew into a custom file system, a local virtual machine, and a Bazel-built Linux kernel. actiond pretends to be a remote executor, but the “remote” worker is a Linux VM running locally on the Mac. Bazel communicates with it over a and actiond implements both execution and a content-addressable store. Funnily enough, leveraging this VM for action execution results in faster Bazel builds on macOS than running actions natively. Inside the VM, actiondFS mounts a directory described by a protocol buffer and creates the action sandbox without building a forest of links. Same idea as my original sandboxfs , but the key difference is that actiondFS is a kernel module rather than a FUSE file system so it solves all performance and deployment problems I originally faced with FUSE. A mind-blowing mention was linux.bzl : a Bazel-native build of the Linux kernel, used in this project to build the actiond VM end-to-end with Bazel. This reminds me that I’ve been saying, since the inception of Bazel, that this build system is the perfect pairing for a monorepo like NetBSD’s or FreeBSD’s; and, in fact, I recently wanted a Bazel-native build of NetBSD to put the EndBOX together. I wonder how difficult it would be to hack something up these days with AI… Oh, and: . This flag finally replaces the super-complex script that Bazel uses to run a test with a native binary. This resolves some compatibility issues across platforms and should result in measurably faster test execution. Borja Lorente from Byte Bard Software presented The Sandbox Is a Filesystem: Content-Addressed Bazel Builds on macOS with FSKit , yet another talk on sandboxing and macOS. The immediate problem they tried to address was sandbox escapes in TypeScript builds. You might not be aware, but there happen to be some tools out there that, when faced with a symlink, decide to resolve the target of the symlink and then perform extra operations on that location, like finding sibling files and the like. The compiler is one such tool, and consequently, escapes the symlink-based sandbox used on macOS and behaves incorrectly. Aspect originally patched the JavaScript rules to intercept Node.js file-system calls and redirect them, but that solution stopped working when was rewritten in Go. Apple’s new FSKit framework should in theory be usable to solve this, as it’s “just” a new way of writing file systems in user space. If we could leverage FSKit, the idea then becomes simple: represent the sandbox as a file system and mount a content-addressed view of the action’s inputs within it. Identical subtrees across actions share nodes, contents are fetched lazily, and outputs write through to the host volume. You know, exactly like my own sandboxfs did back in the day with FUSE. Unfortunately, FSKit comes with its own set of problems: An FSKit extension ships as an application, which must be packaged and notarized. This might be OK, but what’s bad is that, because this comes from an application, macOS displays a TCC (Transparency, Consent, and Control) popup notification when an app such as the Terminal tries to access the FSKit volume. Not cool for automated (CI) deployments. Mounting takes hundreds of milliseconds, making a separate mount per action too expensive. This can be solved by reusing the same mount across actions and making the file system create different subtrees per sandbox. Again, like the original sandboxfs. User space file systems have… unavoidable overheads as most operations have to cross the kernel/user space boundary at least twice. These may or may not be acceptable. With my own FUSE-based solution years ago, I just couldn’t fix some performance issues due to some oddities in OSXFUSE. AMFI and Gatekeeper inspect each executable once , adding substantial latency on first execution. And because any executable exposed through a separate file system looks brand new to the kernel… performance tanks. My original sandboxfs mitigated this by keeping inode numbers stable across different instances of the same file across different sandboxes, but that’s what ultimately led to the blockers I encountered with OSXFUSE. Because of all these problems, FSKit was not the clear choice for a new sandboxfs, so the team evaluated alternatives for performance like pure file copying, the old symbolic links, hard links, and APFS’ . FSKit was best at creating the initial directory structure, but later operations such as , , and were slower than with the alternatives. The conclusion was that there is no perfect answer to a fast and secure sandbox on macOS. Symlinks are fastest but allow some tools to escape. Hard links are the second-best option but they cannot protect source files against writes and only work within one volume. is efficient but limited to APFS and, again, one volume. FSKit provides the right abstraction with frustrating deployment and runtime costs. Because of this, the outcome of the talk is a proposal for a new sandboxfs protocol , not a specific implementation. Namely: a way for Bazel to send a manifest describing the inputs plus settings such as network access to a sandbox service. With that, the service can create the sandbox directory and return its path; Bazel can execute the action; and the service can then report the outputs and tear the sandbox down. Different backends can implement the same protocol using the best mechanism for each machine. I like the proposal and the fact that what was old is new again, but there were two interesting questions from the audience. One was: “What about an NFSv4 server?”, which is how Buildbarn exposes efficient virtual file systems on macOS; and the other was: “Can we not implement a new protocol and instead reuse the RE API?” Switching gears to the more theoretical aspects behind Bazel, we can look at changes to a core piece of the ecosystem: the Starlark language. The star (wink, wink) of the show in this area were type systems. Alexandre Rostovtsev from Google presented Static types in Starlark , an update on the type system first discussed during an unconference session at BazelCon 2025. Bazel 8.8 and 9.3 parse the new annotations but otherwise treat them as no-ops, allowing rulesets to adopt the syntax without breaking those releases. Bazel 10 will check annotated files and type-checking should be enabled by default by the time the final release ships. The syntax is a subset of Python’s type annotations with extensions to support Starlark’s native types like providers and attributes, both of which require typed exhaustive dictionaries. This should make large rulesets easier to navigate and maintain, and it lays the foundation for better automated tooling. Right after Google’s update on native Starlark types, Tamir Duberstein from OpenAI presented Type-checking Starlark without waiting for Bazel . I originally read this title as “type-checking without starting a slow Bazel process”—but no, the “waiting for Bazel” part here refers to the fact that the original type-system feature request was filed six (!!) years ago, not addressed in a timely manner, and the ecosystem could not simply stand still until the Bazel team decided to do something. During these six years, Buck 2 has come up with type annotations and a full-featured LSP for their Starlark variant. On the Bazel side, starpls implements another language server and type checker, but its annotations live in comments and the resulting experience is not ideal. OpenAI’s approach is sty , which combines ideas from with ty , the Python type checker developed by Astral. This new project provides fast cross-file checking, resolution, editor integration, and go-to-definition support while avoiding dependencies on a particular Bazel release. One difficulty is that, even if Starlark looks like Python, it isn’t Python: Bazel gives the language several domain-specific semantics. For example, a rule’s fields have types, mandatory status, and default values derived from the rule declaration. A generic Python checker knows none of this, so has to model it explicitly. By “pure” coincidence, OpenAI’s choices here do not diverge much from Google’s official typing system, so there is a path towards reconciliation. The project also introduces files, which act like external stub files and describe types for dependencies without modifying their source. These are particularly useful for rulesets that must continue to support Bazel versions that cannot parse type annotations, because the annotations can live out of sight from Bazel. The last topic I have notes on are talks about rulesets, but I do not have a lot. Let’s just cover a couple of the talks I did attend and take notes from. David Zbarsky from OpenAI presented : {Fast, Hermetic, Ergonomic} — Pick 3 , a new Rust ruleset built to address the pain points that OpenAI encountered with at scale. The usual dependency flow takes and , creates a synthetic workspace, runs , and generates a Bazel-specific . Repinning is slow—roughly O(n^2) in the size of the dependency graph—and Bazel has to repeatedly ask Cargo to contact registries and download metadata. rules_rs avoids that architecture. Bazel already has a downloader and lockfile, so the new ruleset leverages those directly and performs dependency discovery only once per platform. At OpenAI, repins dropped from about ten minutes to 100 milliseconds and can happen as part of an ordinary . Build configuration is read from , avoiding a separate Bazel lock file and the need to keep generated configuration in sync with Cargo. Rust build scripts remain a challenge because they can perform arbitrary work but appear to Bazel as one opaque action. For example, OpenAI replaced the build script in with a dedicated bzlmod module so that Bazel could see and schedule the underlying work. The ruleset also builds the Rust standard library from source, which enables Tier 3 targets and tools such as Miri . Combined with a hermetic LLVM toolchain, can cross-compile projects such as Selenium to Linux, macOS, and Windows. The question from the audience was simple: “What is the carrot for choosing over Cargo?” And the answer was simple as well: at OpenAI, they observed that everything in CI that did not use Bazel was falling over under agent-generated load. Antonio Di Stefano and Yannic Bonenberger from EngFlow presented No Bytes Left Untracked—Bazel Supply Chain Security . The key message was that, while we have always worried about correct builds and Bazel delivers on them, that’s just not enough anymore. We must also be able to explain where every byte comes from and enforce policy over their provenance in order to defend against security threats. Supply-chain attacks are becoming more frequent, and frameworks such as SLSA cover the complete software development lifecycle rather than compilation alone. They include requirements around review, provenance, and Software Bills of Materials (SBOMs). Bazel has always been in a unique position to provide this provenance information because it has a precise dependency graph and runs actions in controlled environments. But a common difficulty is that, outside of Google, Bazel interacts with other ecosystems: third-party package managers bring their own manifests and lock files and coordinating those with Bazel is difficult. There is no uniform representation of package identity, licensing, or provenance. The supply-chain ruleset addresses this with a standard target. The goal is for every package in the Bazel Central Registry to expose its identity and attributes, including licensing information, through a small JSON representation. The presenters asked for help in achieving this, as annotating packages is tedious and, ultimately, the responsibility of their owners. The processing model looks like this: A “gather” aspect walks the target graph of the artifact that needs to be shipped. Each dependency contributes metadata through a transitive provider, effectively producing a serialized view of the relevant graph. Tools convert that data into standard SBOM formats such as SPDX and CycloneDX. Validation actions enforce organization-specific policy, such as banning a particular license from entering a product. This is useful, but the target graph alone cannot fully account for all bytes in an output. True end-to-end attestation also has to inspect the action graph and the environment in which those actions run. Questions like these are to be expected: Which tools transformed the inputs? Where did the actions run? Did those environments have known kernel vulnerabilities? The project roadmap includes rules, module extensions, macro definitions, and stricter build-level enforcement. The 1.0 release was scheduled to happen during BazelCon, but unfortunately they’ll be a few days late due to last-minute issues with documentation and the like. And that’s all I captured this year. There were many other sessions—including talks on hermetic LLVM, Zig package integration, Gazelle v2, CUDA compilation, and richer platforms—but I either did not attend them or did not take enough notes to write anything of substance. Apologies if I did not cover yours here. Check the official BazelCon 2026 schedule for the complete program and stay tuned for the production-grade recordings . Photo while running towards Amsterdam Centraal. The common thread across the conference was scale. AI agents are multiplying the number of builds, tests, and changes that our infrastructure must process, while Bazel users continue to push larger graphs through increasingly-specialized execution environments. The good news is that the ecosystem is responding: Bazel 10 brings meaningful core improvements, remote execution keeps getting smarter, and the BUILD Foundation gives community work a place to grow. But even if the ecosystem is responding, you must too. Bazel is positioned to be a great answer to scalability issues in development workflows thanks to its safe cross-machine, cross-user caching features. And Bazel is also a good way to remain secure amid the unprecedented number of changes to your third-party dependencies. If you have not yet considered Bazel, the best time to do so is today. Stay tuned for the next article! I got some really cool swag from one of the vendors and I promised them I’d write something up once I had a chance to evaluate it. Welcome to BazelCon 2026 sign. What follows is a recollection of my notes arranged by topic and intermixed with my own commentary and thoughts. Some sections and topics are more detailed than others because in some cases I didn’t have a seat and couldn’t type enough, and in others I got distracted in the hallways chatting with people. Speaking of people, several of you approached me to praise previous editions of these recaps, so I now feel obliged to write another one. Thanks for the kind comments! As we will see, “scale” was a central theme of the conference: AI is multiplying concurrent builds and tests, artifacts and graphs are growing at an accelerated pace due to new features like configuration transitions, and the ecosystem is responding by making execution, caching, and analysis more efficient. My highlights There is a lot to cover but here are a few things that felt memorable to me : The BUILD Foundation is now a reality, giving the Bazel ecosystem a vendor-neutral home. Its goal is to act as a proxy between the community and Google to help Google understand what to prioritize and to fund projects. If your company can spare “a few” dollars, please donate! AI-driven development is having a broad impact on the industry and, in particular, everyone is seeing their CI systems become overloaded. Well, news at 11: I’m dealing with this day in and day out. But what was new to me was that we at Snowflake are not the only ones struggling with local system overload. Lots of people out there have likewise “discovered” Git worktrees as a way to run multiple agents in parallel, which in turn means multiple concurrent Bazel servers. Bazel 10 is shaping up to be a substantial release that will help with the problem right above due to its many performance improvements and memory consumption optimizations. Have you struggled to keep Bazel up-to-date before? These days, if you want to get any platform-related work funded you have to spin it in terms of AI, so this release will be an easy sell. Let’s “Rewrite it in Rust”? I’m impressed. Google is seriously evaluating a progressive rewrite of Bazel in Rust, and this is probably the most exciting news I got out of the conference. You know I’ve been critical of Bazel’s usage of Java since day one so, if this takes off, I’ll be the first in line to evaluate the results (and it will likely push me to actually contribute to Bazel again). Fast and correct sandboxing on macOS remains a problem. This is “interesting” to me because it’s a problem I tried to fix almost ten years ago with the original sandboxfs, but I failed because of unexpected bugs in macOS’s FUSE support and eventually abandoned the idea when FUSE became a dead end on Apple’s platforms. Funnily enough, other folks have now reinvented sandboxfs—and even given it the same name (ugh)—and there is even another implementation of a similar idea in the form of actiondFS. Types are coming to Starlark, but Bazel’s late arrival to the party means that multiple competing approaches now exist. We have at least two LSPs with different annotation mechanisms and Buck 2’s own syntax. Hopefully they can all converge. Platforms and configurations remain difficult to model at scale. Careless use of transitions and build settings can produce an explosion of configured actions. Apparently, as one speaker noted, AI agents love transitions for some reason, which is interesting because they are not a popular feature and they are not particularly easy to use. Agents run more builds more frequently than humans, discover and invoke targets that were often “internal only”, and explore several approaches in parallel. Your intuition about how to evaluate which builds matter and how to measure them is probably wrong by now. Bazel and IDEs have never played great together and maybe that just doesn’t matter anymore. We are seeing a sharp decline in IDE usage, although developers still want a way to browse code changes and debug them. This means LSPs are key now to support “leaner” IDEs, and maybe standalone debuggers. Short build and test latency is critical when a human must remain focused on a coding task but, in an agentic workflow, the constraints are different. You know that, after you hit “execute this plan”, the agent will take many minutes to return so minimal build latency is not as important. And actually… maybe you now want to trade some latency in exchange for extra validations so that agents have to take fewer turns to converge. And because humans are now waiting for agents to finish for long periods of time, they have to fill that time with other tasks, which has driven them to adopt Git worktrees en masse. This is leading to scalability problems on dev machines because multiple concurrent Bazel server processes are not great for memory and disk usage. to download filtered logs for a build. to answer questions such as “Why was my build slow?” which are extremely common in the Bazel ecosystem. to start a remote Firecracker VM and run Bazel inside of it. The VMs are snapshotted for quick reuse, and the runners can execute arbitrary commands rather than Bazel alone. to diagnose a failed build and either create a pull request or push a commit with the proposed correction. to perform a review and post comments to GitHub. Correctness: Good, because equivalence is the central constraint of the loop. Hermeticity: Good, but you might need to do extra upfront work to remove host-specific behavior from the reference build before starting. Efficiency: Usually good when standard rules can model the build. Complex projects with custom build rules may end up with overly large Bazel actions though. Maintainability: Unsurprisingly, the weakest point. Agents tend to model variation with configuration flags instead of proper platforms and toolchains, which is not idiomatic to Bazel. Expert review of AI outputs remains critical, which is, again, not surprising. Reset transitions: These discard irrelevant configuration values as early as possible in the graph. The art is to move decisions up the dependency tree so that downstream targets do not carry unnecessary dimensions. The trade-off is that ordinary output can become unmanageable, forcing users toward . But then… requires a configuration, so some targets may not be queryable at all without one. Path mapping: If two actions cannot be made identical during analysis, Bazel can rewrite configuration-specific paths during execution and replace their hashes with a stable component. This should be seen as a measure of last resort, though, because subtle problems arise. For example, if the same logical path comes from different files from different configurations, Bazel disables path mapping silently. Tweag fixed Bazel so that different copies of the same file don’t disable path mapping, but debuggability continues to be a problem when this condition does not apply. Flag scopes: This new feature allows a flag to declare where in the graph it applies and to automatically reset to its default everywhere else. This is similar to a reset transition but requires less manual graph plumbing. On the other hand, describing the correct scope can sometimes be harder than writing the transition directly. Pre-warming the next JVM instead of keeping the current one alive. This provided more control over when and why to restart a test in a new JVM, but suffered from significant coordination overhead. Forking a JVM. This did not work because, due to POSIX semantics, only the calling thread survives a fork call. The JVM is heavily multithreaded, so if you end up losing all but one thread, the new JVM is just not going to work. Android’s Zygote. This provides a pre-warmed runtime ready to be forked ( , anyone?), but it exists only for ART, not the standard JVM, and it’s just not reasonable to expect a switch to ART. Checkpointing. Instead of forking a running process, why not snapshot it to disk so that it can be re-created again? This might have worked, like Horapha does for Bazel startup, but raised difficult questions about when to capture the process and how to handle state outside the JVM. Unconference discussion topic proposals and votes for the second day. Remote execution BoF Chi Wang and Tiago Quelhas led the Remote Execution Birds of a Feather . I only stayed for half of it, and so I only captured the discussion around remote persistent workers. Persistent workers are already part of several commercial remote execution offerings, including BuildBuddy and EngFlow, but their implementation was derived from Bazel’s local persistent worker support, which is not… particularly well designed. For example, we have at least three different variants of the persistent worker protocol: one for “regular” persistent workers, another for multiplex persistent workers, and yet another for multiplex persistent workers that support cancellation. And the protocol does not clearly specify which flags and tools belong to the worker and which belong to the action being executed. In fact, these distinctions are currently determined heuristically, with the worker assuming that flag files correspond to the action and other flags to the worker. There was consensus that this should be cleaned up, but the unsatisfying conclusion is that rehashing these complaints and discussions is not going to lead anywhere until someone sits down and presents a specific proposal for a new API. So, if you are reading this and have… opinions… volunteer to do this. Where Bazel clusters break at scale Helen Altshuler from EngFlow and Nikita Chepanov from Plaid presented Where Bazel Clusters Break at Scale: Field Notes from Plaid and the EngFlow Fleet . That’s quite a mouthful to say “load testing”. And the reason is none other than AI once again: Plaid’s build volume doubled during the year due to AI-assisted coding and is on track to reach four times its early-2026 baseline. With a predictable increase in load comes a predictable outage. So, instead of waiting for it to happen organically, Plaid deliberately chose to load-test their CI system. The goal was to reach multiples of the normal load and discover each bottleneck under controlled conditions. They had to go through six rounds of tests and fixes until they were able to sustain their desired target. The previous five uncovered problems in network bursts, AWS quotas, source control, CI autoscaling, and cache infrastructure. The solutions were not magical: find and raise limits, cache everything possible, and reduce demand where it does not add value. Examples of the last category include skipping tests for pull requests in the middle of a PR stack and avoiding uploads for actions when they are unlikely to be reused. An interesting observation is that Plaid runs EngFlow in Plaid’s own AWS account, so the cache cluster is co-managed. But careful: shared ownership can easily turn into ambiguous ownership. The two companies addressed this by agreeing on health metrics and thresholds upfront and putting them on a shared dashboard. Both sides now know who must act before developers notice an outage. Sandboxing and local execution Ah, one of my favorite topics. Back in my Google days, I spent at least three years of my so-called 20% time working on improving the performance of the Bazel sandbox on macOS. Those efforts were painful: creating a writable FUSE file system is difficult, and diagnosing mis-interactions with macOS was a horrifying exercise. Today, I’m not scared anymore: I’ve been recently using AI to write yet another file system at work and agents do exceedingly well at handling corner cases. Let’s see how modern solutions do better than what I originally tried. actiond: the quest for a better sandbox David Zbarsky from OpenAI presented actiond: The Quest for a Better Sandbox , which was the first of at least two talks on improving sandboxing performance and strictness. The project started from frustration with local sandbox escapes on macOS and eventually grew into a custom file system, a local virtual machine, and a Bazel-built Linux kernel. actiond pretends to be a remote executor, but the “remote” worker is a Linux VM running locally on the Mac. Bazel communicates with it over a and actiond implements both execution and a content-addressable store. Funnily enough, leveraging this VM for action execution results in faster Bazel builds on macOS than running actions natively. Inside the VM, actiondFS mounts a directory described by a protocol buffer and creates the action sandbox without building a forest of links. Same idea as my original sandboxfs , but the key difference is that actiondFS is a kernel module rather than a FUSE file system so it solves all performance and deployment problems I originally faced with FUSE. A mind-blowing mention was linux.bzl : a Bazel-native build of the Linux kernel, used in this project to build the actiond VM end-to-end with Bazel. This reminds me that I’ve been saying, since the inception of Bazel, that this build system is the perfect pairing for a monorepo like NetBSD’s or FreeBSD’s; and, in fact, I recently wanted a Bazel-native build of NetBSD to put the EndBOX together. I wonder how difficult it would be to hack something up these days with AI… Oh, and: . This flag finally replaces the super-complex script that Bazel uses to run a test with a native binary. This resolves some compatibility issues across platforms and should result in measurably faster test execution. The sandbox is a filesystem Borja Lorente from Byte Bard Software presented The Sandbox Is a Filesystem: Content-Addressed Bazel Builds on macOS with FSKit , yet another talk on sandboxing and macOS. The immediate problem they tried to address was sandbox escapes in TypeScript builds. You might not be aware, but there happen to be some tools out there that, when faced with a symlink, decide to resolve the target of the symlink and then perform extra operations on that location, like finding sibling files and the like. The compiler is one such tool, and consequently, escapes the symlink-based sandbox used on macOS and behaves incorrectly. Aspect originally patched the JavaScript rules to intercept Node.js file-system calls and redirect them, but that solution stopped working when was rewritten in Go. Apple’s new FSKit framework should in theory be usable to solve this, as it’s “just” a new way of writing file systems in user space. If we could leverage FSKit, the idea then becomes simple: represent the sandbox as a file system and mount a content-addressed view of the action’s inputs within it. Identical subtrees across actions share nodes, contents are fetched lazily, and outputs write through to the host volume. You know, exactly like my own sandboxfs did back in the day with FUSE. Unfortunately, FSKit comes with its own set of problems: An FSKit extension ships as an application, which must be packaged and notarized. This might be OK, but what’s bad is that, because this comes from an application, macOS displays a TCC (Transparency, Consent, and Control) popup notification when an app such as the Terminal tries to access the FSKit volume. Not cool for automated (CI) deployments. Mounting takes hundreds of milliseconds, making a separate mount per action too expensive. This can be solved by reusing the same mount across actions and making the file system create different subtrees per sandbox. Again, like the original sandboxfs. User space file systems have… unavoidable overheads as most operations have to cross the kernel/user space boundary at least twice. These may or may not be acceptable. With my own FUSE-based solution years ago, I just couldn’t fix some performance issues due to some oddities in OSXFUSE. AMFI and Gatekeeper inspect each executable once , adding substantial latency on first execution. And because any executable exposed through a separate file system looks brand new to the kernel… performance tanks. My original sandboxfs mitigated this by keeping inode numbers stable across different instances of the same file across different sandboxes, but that’s what ultimately led to the blockers I encountered with OSXFUSE. A “gather” aspect walks the target graph of the artifact that needs to be shipped. Each dependency contributes metadata through a transitive provider, effectively producing a serialized view of the relevant graph. Tools convert that data into standard SBOM formats such as SPDX and CycloneDX. Validation actions enforce organization-specific policy, such as banning a particular license from entering a product.

0 views

How I am reading more

We live in what is being referred to as a “ post literate society ” in which 40% of Americans did not read a single book last year . This is mind blowing to me, but - I can also see that with screentime (on a phone alone) being somewhere over 5 hours a day , it makes sense where most of everyone’s time is going. However, if we can replace even one of those hours of that screentime with reading books, and that will amount to reading far more than 0 books per year! I generally read around 20 books per year, but I figured that I could do far better than that (and did in 2023 ). That year also coincided with massive personal, spiritual, and professional growth - I don’t think that this is mutually exclusive and is probably correlative. This year, I made a resolution to get back at it, and this is how I am reading more. The most important thing I think nearly anyone can do to read more is reduce screentime on a phone. By simply installing Kindle, KoReader, Libby, AudioBookshelf, MuPDF, or one of many other reading apps, we can use this in lieu of doomscrolling social media and news websites. Going further, we can delete social applications, youtube, and even the browser, and replace any idle time at checkouts, commuting, and where you would historically be “wasting time” with reading and listening to books. We are simply going to “waste time”… better! While I personally don’t subscribe to this method in that I don’t retain nearly as much that is being said in audio form (this is why I don’t consume podcasts, either), some swear by the ability to read while on the go simply by listening to books. If it works for you, then awesome! I just don’t seem to benefit much from audiobooks. I may revisit this though for driving and the gym and update this post if I do use audio more often. My wife hates this one trick! This, for me, has been the biggest eye opener and allowed me to read ~100 pages per day over the past month or so of this experiment. I simply have books lying around in my office, in the living room, my Kobo sitting next to the bed, etc. and instead of picking up my phone, I pickup a book instead. All things are downstream of how we spend our time - time spent reading begets more reading. Some may not like this in that they want to read one book to completion before starting on the next. I personally have anywhere from 5-15 books on the go at once. Off the top of my head, here is a non-exhaustive list of what I have on the go: I find that reading this way is tremendously interesting in that there is “cross-pollination” between domains and a growing connection between all things. You will find authors across time and geographical location discussing the same quote, book, or idea, across domains of theology, physics, computer science, design, art, everything. I then sit and meditate with what I’ve ingested, and create connections of my own. It’s fascinating. Not only this but, it’s a “cheat” in that if I get bored with one book/topic, I just go on to another, in one big circle. Boredom doesn’t mean ceasing to read, just selecting something else that I am actually in the mood for. The very first thing I do in the morning is make the Sign of the Cross and Pray. The very next thing I do is sit down to read. I have started to wake up earlier in order to get the time to myself so I can do this, and it is truly awesome to get an hour or so or reading in before starting work. I read 10 pages, do some pushups and stretching, read 10 more pages, more physical activity, and repeat for about an hour. Most days I get about 30-50 pages in before anything, and I feel that it gets the wheels turning in my mind for writing, creating, etc. as I have always found reading to be “conversational”. I am not usually gung-ho in the morning to immediately begin working, and this has immensely helped my ability to drop into work and the rest of the day. Try it out! If you are so inclined to use applications such as Goodreads or the like, then this can be a fun way to keep track of that which you are reading and “compete” with friends. I’d recommend against giving Amazon all your data, but you do you. I also think that reading has become an extension of social media in that there is an element of “one-uppmanship” which I don’t care to participate in. I personally keep a /reading page on my blog for the current year, and keep track that way. It’s a fun way to discuss books when people can see what you’re reading on your blog and it’s a good conversation starter. I have always hated the rationalization that “reading is too slow”, or that “I have no time to read!” As I said above, if you have time to scroll your phone, you have time to read and converse with the greatest minds that have ever lived. We need to slow down more than ever in this crazy, accelerating world. I find that almost no one sits and chews on ideas anymore, and that is detrimental to the future of humanity if we are not to create polymaths and people of skill. If we don’t have time to read, we don’t have time to grow, and that is simply not true. So, read more! I am thankful that my parents and teachers instilled a love of reading in me from a young age. Truly, one can learn about anything and everything if we only pick up a book and start flipping through. I personally don’t want to live in a post-literate society, I want to discuss these great works and continue to learn from everyone that’s come before, so that is why I choose to keep reading, and to read as much as I possibly can. Try it out for a month, and see how much you fall (back) in love with reading. I think we have all just forgotten how amazing it is to pick up a great book and lose ourselves in the worlds and ideas of another’s mind. As always, God bless, and until next time. If you enjoyed this post, consider Supporting my work , Checking out my book , Working with me , or sending me an Email to tell me what you think. The Brothers Karamazov The Go Programming Language The Art of Unix Programming The Republic An Introduction to the Devout Life The C Programming Language (K&R) Structure and Interpretation of Computer Programs Chruch Fathers Against the Machine The Bible (Everyday, first thing I read) Operating Systems, Three Easy Pieces Computer Systems: A Programmers Perspective Designing Data-Intensive Applications

0 views
Sean Goedecke 1 months ago

What requirements don't you have?

When designing software, the requirements you don’t have are as important as the requirements you do. Identifying what you can compromise on — what can be slow, or stale, or inflexible — is usually the key to an elegant design. For instance, take preforking web servers like Unicorn . Because they lack the feature of shared mutable state between server instances, they can run each server in its own process, which provides isolation for free. Because Unicorn specifically ignores the problem of slow client handling 1 , it can queue requests directly on Unix sockets, drastically simplifying the implementation. Because S3 does not support atomic multi-key updates — you cannot update multiple blobs in a single transaction — it can store data at the blob level however it chooses. That makes it much faster, since reads and writes don’t have to cross storage partitions, and much easier to scale, since less coordination means fewer sources of truth. StatsD uses UDP by default, which means it doesn’t guarantee that every piece of data you send makes it into storage. In exchange for dropping that requirement, it incurs much less network overhead, which is a big advantage for a stats aggregation service that’s constantly shoveling data over the wire. The general design approach of fanning out data to an edge cache buys a lot of speed and scaling by dropping the requirement that data must always be up-to-date. SQLite buys operational simplicity — it can run out of a single file! — by dropping the requirement of concurrent writes. By accepting high tail latency 2 , Cursor can scale their distributed git backend more easily. Well-designed systems turn their weaknesses into strengths. Anyone who’s spent time designing real-world software (or who’s studied distributed systems ) knows that system design is a process of compromise. If you attempt to satisfy every single potential requirement — speed, concurrency, up-to-date data, a simple interface, supporting complex user behaviors — you will fail to design a working system at all. Figuring out what requirements you can relax is difficult because it combines both business and technical expertise . It is technically challenging to identify precisely the level of staleness that a particular design change will allow; it is likewise challenging from a business perspective to determine whether that level of staleness is acceptable to users. In most cases, an engineer who understands the technical side must try and explain it to a product manager, who can make a judgement on the business side. But this is a very difficult partnership to get right. Engineers and PMs have different incentives and little ability to check each other’s work, which makes it hard to build trust . Without trust, the product manager is liable to avoid giving any ground at all 3 , which leaves the design in an impossible state. This is an underappreciated reason why solo developers or startups can sometimes run rings around larger companies. Because the technical and business decisions are united in a single person, they can make design tradeoffs that would be impossible for a large company, enabling them to build systems that are far more elegant and powerful. Knowing what requirements you don’t have becomes far more important when working with coding agents. Frontier models are very capable, but they have all gone through the purifying flames of RLVR : like high-achieving schoolchildren, they are obsessed with satisfying the Grader. On top of that, they have very little business context compared to an experienced human. That often manifests as them catching correctness or consistency “bugs” that are really just hypothetical unsatisfied requirements. For instance, it’s not uncommon for an LLM to casually introduce a mutex or other concurrency mechanism to ensure that two pieces of semi-related data are kept in sync, even if not told to do so. I’ve seen LLMs add weird checks in the middle of request handling to ensure that some already-checked piece of data hasn’t changed mid-flight, even if that wouldn’t successfully prevent the feared TOCTOU bug 4 . LLMs are obsessed with edge cases like “what if the current user loses their admin status in the middle of us handling one of their admin requests?” 5 , or “what if the cache in storage partition A is updated a nanosecond before the one in storage partition B, leading some users to see different data?“. Particularly if run in a loop or told to “make no mistakes”, they will pile on cases like these until they’ve transformed your four-line change into a thousand-line monster. This is why I’m confused by some people’s claims that code review is dead . About half the time I review a large AI-generated change, I notice some unnecessary requirement that makes the diff more complex. When I dig deeper, the LLM invariably introduced this requirement on its own. When working with a cache, I will often spell out in my prompt that I don’t mind the data sometimes being stale or briefly inconsistent between cache instances. When reviewing Golang code, the first thing I do is scan for added mutexes or layers of indirection that don’t look necessary to me. If you allow requirements like these to propagate unchecked through a codebase, they will petrify the system over time. The whole thing will be such a mess of checking and re-checking and holding locks and enforcing consistency that it cannot be scaled at all. Keeping systems elegant requires a ruthless focus: on accepting stale data or occasional tail latency, on avoiding all but critical instances of coordination, and in general on figuring out what requirements you don’t have to satisfy. The problem: if an HTTP request sent by someone with slow internet trickles in one packet per second, does that have to tie up a server process for the whole time? Unicorn’s answer is ‘yes, so put nginx or HAProxy in front of me’. When a read request hits a stale storage node, that node must update itself before responding. I’ve also seen this happen in reverse, where the product manager desperately tries to convince an engineer that some level of stale data is acceptable, while the engineer digs their heels in and insists on the “perfect” system. The consequences are similarly dire. Of course, simply doing a separate check shortens the TOCTOU window instead of removing it. In every single system I’ve worked on, it would be fine to simply carry out (or fail) the admin request: if somebody was allowed to perform some operation 10ms ago, it’s likely not a disaster to let them perform it now. The problem: if an HTTP request sent by someone with slow internet trickles in one packet per second, does that have to tie up a server process for the whole time? Unicorn’s answer is ‘yes, so put nginx or HAProxy in front of me’. ↩ When a read request hits a stale storage node, that node must update itself before responding. ↩ I’ve also seen this happen in reverse, where the product manager desperately tries to convince an engineer that some level of stale data is acceptable, while the engineer digs their heels in and insists on the “perfect” system. The consequences are similarly dire. ↩ Of course, simply doing a separate check shortens the TOCTOU window instead of removing it. ↩ In every single system I’ve worked on, it would be fine to simply carry out (or fail) the admin request: if somebody was allowed to perform some operation 10ms ago, it’s likely not a disaster to let them perform it now. ↩

0 views
Filippo Valsorda 1 months ago

(Post-Quantum) Cryptographic Right Answers

Publishing “Cryptographic Right Answers” for developers is a tradition by now. Colin Percival started in 2009 , Thomas Ptacek followed up in 2015 , and then Latacora carried on in 2018 and 2024 . It might feel too soon for an update, but so much has changed . The timeline of the post-quantum transition dramatically shifted in early 2026 , and there is now consensus that it needs to complete by 2029. 2029! We have three years! The good news is that, despite what you might have heard, symmetric cryptography is going to be fine, because Grover does not matter . The bad news is that all asymmetric answers changed compared to 2018 and most even compared to 2024. The answers below assume you are not constrained by any specific compliance regime, although they are mostly compatible with FIPS 140. 1 If you need to follow something stricter like CNSA 2.0, you’ll know. Just substitute as appropriate. Finally, remember the other big change of 2026: LLMs are very good at finding bugs now. “Get a review from the best model you can afford” is now firmly a Cryptographic Right Answer, along with the long-time classic “use a memory-safe language.” If you’re in a rush, here’s the cheat sheet: Now let’s dive in. If you’re in the cloud, KMS . Otherwise, XAES-256-GCM or XChaCha20Poly1305 with random nonces. If you’re encrypting more than a few MB, use Cobblestone-128 . Percival, 2009 : AES-CTR with HMAC. Ptacek, 2015 : NaCl/libsodium default, or ChaCha20Poly1305, or AES-GCM. Latacora, 2018 : KMS, or XSalsa20+Poly1305. Latacora, 2024 : KMS, or NaCl’s secretbox, or XChaCha20Poly1305. Latacora’s reasoning for why and when you’d use your cloud’s KMS is still solid, so start there. If you’re encrypting locally, you want an AEAD where you can avoid worrying about tracking nonces or how many messages you encrypted, so you want random nonces of at least 128 bits. 2 NaCl/libsodium’s secretbox is just a paper-thin wrapper around a less common AE construction (XSalsa20+Poly1305), so instead I recommend XAES-256-GCM or XChaCha20Poly1305. The former is an efficient composition of a standard KDF and AES-GCM, packaged as an extended-nonce AEAD, so even if your library doesn’t provide it under that name you can assemble it from the KDF and AES-GCM APIs. 3 Regular AES-GCM and ChaCha20Poly1305 with random nonces are only ok if you know for certain you won’t encrypt more than a billion messages with one key. AES-GCM-SIV is also a good AEAD choice if you happen to have it everywhere you need it, but that’s kinda unlikely. Some even newer options have nice properties like key commitment, but are not commonly available yet. Since you have an AEAD, consider putting context in the additional data, like the user ID you’re encrypting for, or the version of the protocol. Anything not secret that you will definitely still know at decrypt time. Very important is how you handle large messages, which KMS will not solve for you. Do not pass one large message to an AEAD, or you might be forced to process or store the plaintext before having authenticated it at decrypt time. Absolutely do not use unauthenticated stream ciphers. Instead, you should use STREAM (which is not a stream cipher but a way to use AEADs on a stream… I know, I know, terrible name). There are a lot of options—too many, in fact—and shamefully none are the consensus answer. Tink has one , libsodium has one , the AWS Encryption SDK has one , FLOE is one , age has one, and the list goes on. I recommend Cobblestone-128 , which is a STREAM variant derived from TLS, and is available in pyca/cryptography and soon in the Go standard library (and in the meantime at filippo.io/cobblestone ). 4 Avoid : unauthenticated modes (CBC, CTR, raw stream ciphers), random 96-bit nonces unless you spent a lot of time thinking about how many messages you encrypt, rolling your own AEAD construction. Don’t stress it. 256-bit keys if you need to pick. Percival, 2009 : 256-bit AES keys. Ptacek, 2015 : 256-bit keys. Latacora, 2018 : 256-bit keys. Latacora, 2024 : 256-bit keys. Remember that Grover doesn’t actually matter and 128-bit brute-force attacks don’t exist. Still, 256-bit keys rule out multi-target attacks, which is nice. However, don’t make other decisions based on this. For example, the recommended Cobblestone suite uses 128-bit keys and that’s fine because it has a careful analysis of multi-target attacks. Likewise, don’t go changing the default cipher suite preferences of your TLS library to enforce 256-bit keys; there’s no need. AES-256 is slower than AES-128 because unfortunately Rijndael ties the number of rounds to the key size, but this probably won’t matter in practice. Avoid : anything other than 128 or 256 bits, worrying too much about size, keys that are not uniform (e.g. using a password or ASCII hex string directly as a key). HMAC-SHA-256 . Percival, 2009 : HMAC. Ptacek, 2015 : HMAC. Latacora, 2018 : HMAC. Latacora, 2024 : HMAC. Yay for HMAC. Just be careful to sidestep canonicalization and parser alignment bugs by always authenticating a verbatim string of bytes, not something you need to recompute. Check the HMAC and then process or store or forward just . You can use KMAC or keyed BLAKE3 if you already had a reason to use their underlying hashes. HMAC-SHA-512 is also fine. Remember to compare tags with dedicated constant-time functions. Avoid : rolling your own YoloMAC , encrypted hashes, standalone one-time MACs like Poly1305 or GMAC. SHA-2 is still fine, but use a real multihash if needed. Percival, 2009 : SHA-256 (SHA-2), plan on SHA-3. Ptacek, 2015 : SHA-2. Latacora, 2018 : SHA-2. Latacora, 2024 : SHA-2. The best option, if you have it available, is still SHA-512/256, which isn’t vulnerable to length-extension attacks. Otherwise, SHA-256 and SHA-512 are both fine. 5 SHA-3 is unnecessary (because SHA-2 is fine) and slow, 6 but not wrong . If you already have Keccak (SHA-3) around for ML-KEM and ML-DSA, and you want to use it for hashing, draw 32 bytes from SHAKE128. BLAKE2 is a weird choice these days. BLAKE3 is very fast, but complex and uncommon enough that you want to have a good reason to use it and a good reason to trust your implementation. Multihashing is when you need to hash multiple things at once. For example, multiple columns of a row, or a filename along with the file contents. It’s subtler than it sounds, so use SequenceHash with SHA-2, or TupleHash (SP 800-185) with SHA-3. Avoid : SHA-1, MD5, all other hash functions, rolling your own multihash , truncating to less than 256 bits unless a cryptographer told you collisions are not a concern. 32 random bytes , a.k.a. 256-bit random numbers. Percival, 2009 : 256-bit random numbers. Ptacek, 2015 : 256-bit random numbers. Latacora, 2018 : 256-bit random numbers. Latacora, 2024 : 256-bit random numbers. Note that UUIDv4 and APIs like rand.Text will give you ~128-bit values instead. That’s usually fine, unless you need more than 280 trillion (2⁴⁸) unique values. 256 bits is overkill, but why not. Use your operating system’s CSPRNG: on Linux, on Windows, on macOS and BSD, on the web. A good library will wrap these for you. Avoid : non-cryptographic PRNGs, userspace random number generators like OpenSSL’s, haveged, CPU jitter entropy. 7 Argon2id or scrypt . But have you considered passkeys instead? Percival, 2009 : scrypt or PBKDF2. Ptacek, 2015 : scrypt, then bcrypt, then PBKDF2 if you must. Latacora, 2018 : scrypt, then Argon2, then bcrypt, then PBKDF2 if you must. Latacora, 2024 : Argon2id, then scrypt, then bcrypt, then PBKDF2 if you must. Everything my predecessors said is still spot on: “you can throw a dart at a wall to pick one of these.” I dropped bcrypt because the 72-byte truncation bites . One tip: you could argue to your auditors that scrypt is FIPS 140 compliant because its actual KDF step is PBKDF2, which is what they want. I heard it works. For parameters, ignore RFC 9106 which apparently wants to murder your production system, and use for Argon2id (libsodium’s INTERACTIVE preset) or for scrypt. They use the same memory, but the scrypt ones will take ~1.5× the CPU time and ¼ the GPU time, which is why you should prefer Argon2id. If you’re doing non-interactive key derivation, feel free to crank up Argon2id’s m , and then t (or just N 8 for scrypt) as far as tolerable. Much more importantly, do you really need passwords? If you only need them for logins, could you use phishing-proof passkeys instead? Maybe with email magic links as a fallback ? Or just support SSO (as long as it’s OIDC and not SAML)? (Note that in 2026, passkeys are still not PQ. That’s mostly fine. They’re still phishing-proof and credential-stuffing-proof. All a quantum attacker can do is log in to a specific site if they obtain its database or intercept a login.) Avoid : regular hashes, spending time thinking about password hashes instead of focusing on passkeys, phishable variants of email-based logins. 9 X25519+ML-KEM-768 in a secure, standard protocol. Percival, 2009 : 2048-bit Group #14 with a generator of 2. Ptacek, 2015 : Probably still DH-2048, or NaCl. Latacora, 2018 : Probably nothing. Or Curve25519. Latacora, 2024 : X25519+ML-KEM-768. The 2018 version of the Latacora answers is correct in asking “why are you as a developer thinking about this, and what does it even mean?!” Don’t roll your own key exchange protocol. Just pick X25519MLKEM768 in TLS, mlkem768x25519-sha256 in SSH, and/or MLKEM768-X25519 in HPKE and age. If you really need to obtain some keys and you know what you’re doing, both TLS and HPKE have “exporters” to derive them. Non-PQ solutions are an active, urgent liability due to harvest-now-decrypt-later attacks, and PQ alternatives range from impractical (HQC-KEM, FrodoKEM) to impractical and broken ( Classic McEliece ). For key exchange, using an ECC hybrid is cheap enough to be worth it, and indeed ML-KEM is usually deployed alongside ECDH. However, if picking or implementing the hybrid is going to make you stay even a single month longer on a classical, non-PQ key exchange, go straight to pure ML-KEM-768 now. P-256+ML-KEM-768 is also fine, just less common. NIST P curves got a bad rep for many years, but I think it’s 90% because they came out before we knew how to do cryptography engineering particularly well (and because of… let’s say non- NPOV proselytizing). Almost none of the attacks against ECDH on NIST P curves even matter for ephemeral key exchanges. Avoid : anything and everything without ML-KEM or X-Wing (a specific X25519+ML-KEM-768 combiner) in its name. HPKE with (MLKEM768-X25519 a.k.a. X-Wing, HKDF-SHA256, AES-128-GCM) , or age with PQ keys . Percival, 2009 : RSAES-OAEP with SHA-256, MGF1+SHA-256, and exponent 65537. Ptacek, 2015 : NaCl. Latacora, 2018 : NaCl/libsodium (box / crypto_box). Latacora, 2024 : Tricky, wait for established PQ solutions. This is one of the most improved answers in recent years, as we now have a standard to do hybrid encryption: HPKE. (“Hybrid” as in asymmetric + symmetric, not as in classical + post-quantum, yay for overloaded names.) MLKEM768-P256 is also ok as a choice of KEM, but less available. Pure ML-KEM-768 is fine if it’s all you have. All KDF and AEAD choices are fine, as well. If your message is large, do the same chunking Cobblestone does, with multiple sequential HPKE Seal/Open calls in place of the AEAD. Note that the PQ HPKE KEMs are maddeningly still a draft. 10 Worse, they are unnecessarily spread over four drafts, such that I had to write filippo.io/hpke-pq . However, I made the authors solemnly swear they will not change the wire format, and then we all shipped them in our cryptographic libraries, so you can and should use them. If you need something higher-level, with multiple recipients or a CLI, use age 11 with its new -prefixed keys, based on MLKEM768-X25519. PQ support is also rolling out for plugins like the YubiKey and the Secure Enclave ones. Avoid : again anything not based on ML-KEM (RSA and NaCl’s box 12 in particular), OpenPGP, encrypting emails . ML-DSA-44 . Percival, 2009 : RSASSA-PSS with SHA-256, MGF1+SHA-256, and exponent 65537. Ptacek, 2015 : NaCl, Ed25519, or RFC 6979. Latacora, 2018 : NaCl or Ed25519. Latacora, 2024 : Ed25519 if short-lived, otherwise Ed25519+ML-DSA-65. In January 2026, I would have told you to wait and see, and then everything started moving a lot faster . You need to move to PQ for auth, too. Just use ML-DSA-44. If your message needs pre-hashing, use “external-μ (Mu)” signing, not HashML-DSA. Store keys as 32-byte seeds exclusively. The two PQ alternatives are FN-DSA, which is stuck somewhere in the US Department of Commerce, and SLH-DSA, which is based on hash functions. The latter can make sense for some specialist use cases, but is slow, large, and not widely available in implementations. Why not a hybrid or “composites”? Hybrid auth is more complex and less useful than hybrid key exchange. I need to write a long-form post about this, but in short either you already have a key rotation strategy that you can use to rotate back to RSA/ECDSA/Ed25519 in the unlikely case of a cryptanalytic break, or you have such a long time horizon that you should assume quantum computers will break the classical half anyway. Also, ML-DSA is just such a better signature algorithm than its predecessors. It has hedged randomness (which is better than both random and deterministic nonces), built-in context, extra properties like SUF-CMA, and is relatively simple to implement and test. Why the -44 parameter set, when I’m recommending ML-KEM-768? Unlike ML-KEM-512 (NIST category 1), ML-DSA-44 sits at NIST category 2, with some margin above the 128-bit security level already. The one exception to the no-composites rule is SSH keys. OpenSSH 10.6 picked . I think they made a mistake , but it would be a mistake for you to go off the beaten path there. Note that asymmetric signatures are overused, and especially now that they are not cheap, you should try to avoid them. Consider whether you could use a simple HMAC. Maybe you can replace signed JWTs with random session tokens. If instead you do want to commit to something publicly, consider whether you should use a transparency log , and get a more practically useful notion of non-repudiability (and potentially smaller sizes, if you amortize the signature over multiple proofs). Avoid : all non-PQ options like RSA/ECDSA/Ed25519, stateful signatures (LMS/XMSS), HashML-DSA, ML-DSA “ semi-expanded keys ,” composite signatures, OpenPGP. If you’re in the cloud, use its ALB/NLB . Otherwise, rustls , Go’s crypto/tls , BoringSSL , AWS-LC , or s2n-tls with a popular, updated ACME client . Percival, 2009 : OpenSSL for websites, custom RSA protocol for applications. Ptacek, 2015 : OpenSSL, or BoringSSL if you can. Or just AWS ELBs. Latacora, 2018 : AWS ALB/ELB or OpenSSL, with Let’s Encrypt. Latacora, 2024 : AWS ALB/ELB or OpenSSL, with Let’s Encrypt. Not recommending OpenSSL will probably be my least practical suggestion, but OpenSSL has been making consistently puzzling and problematic choices for years now. The pyca/cryptography authors, in a long post about OpenSSL’s issues , summarize it as: Our experience with OpenSSL has been on a negative trajectory for several years. They even presented at the 2025 OpenSSL Conference (!?), apparently fruitlessly. They’re not alone in criticizing OpenSSL: here are HAProxy from the server side, and curl from the client side. I recommend rustls or Go’s crypto/tls, 13 which are memory safe. If you need to stick to C, both BoringSSL and AWS-LC are very competently maintained OpenSSL forks, and the latter, unlike BoringSSL, has versioned releases. s2n-tls and rustls-ffi are interesting options if you don’t need libssl compatibility. Whatever you use, make sure it prioritizes the X25519MLKEM768 key exchange, which requires TLS 1.3. Your cloud load balancer might require you to select a PQ security policy. On RHEL 9 and derivatives, you need to opt in . Previous lists split websites and client-server applications. I merged them because these days you’ll just use the same TLS stack for both. What changes is the PKI. For applications where you control both ends, consider making your own ML-DSA-44 X.509 certificates, self-signed or from a private root. For websites, wire up a popular , well-supported ACME client and keep it up to date. Merkle Tree Certificates will roll out in 2027, and you want to be well positioned to be included in the transition. Avoid : rolling your own transport protocol, TLS libraries that failed at their core job before (GnuTLS 14 , Mbed TLS 15   16   17 , wolfSSL 18   19   20   21   22   23   24   25 , Botan 26   27 ), offbeat TLS libraries, OpenSSL before version 3.5 (the first with X25519MLKEM768), any OpenSSL if you can, TLS 1.0–1.1, TLS 1.2 if you can, rolling your own ACME client. restic with a long random password. Percival, 2009 : Tarsnap. Ptacek, 2015 : Tarsnap. Latacora, 2018 : Tarsnap. Latacora, 2024 : Tarsnap. I checked restic’s encryption a very long time ago and it was slightly weird but good. Fully symmetric, so it’s not scared of quantum computers. Doesn’t look like anything changed since. If you need cloud storage, rsync.net has a “secret” plan for restic users , and they support an append-only mode . We all love Tarsnap, and I feel like I am betraying my elders right now… but its asymmetric cryptography layer is all RSA. Technically , I think the only things that truly break are the lower-capability keys: a write-only key can decrypt archives and a read-only key can forge archives. Server authentication is HMAC, and the RSA public keys are never sent to the server. In that sense, Tarsnap is as secure as restic, which is an impressive feat for a 2008 design. However, this feels like a major footgun with impending quantum computers. Kinda incredible that you can just walk up to this thing. Follow me on Bluesky at @filippo.abyssdomain.expert or on Mastodon at @[email protected] . FIPS 140 still has some very ugly bits around module validation (runtime self-tests, the integrity check, and the worsening RNG mess) but the actual cryptography algorithms these days are “good, actually.”  ↩ You might read that GCM can take 128-bit nonces, but when you do that it doesn’t have a separate CTR counter anymore, and messages with different GCM nonces can end up sharing CTR keystream, which makes the analysis more complicated.  ↩ Full disclosure: XAES-256-GCM is my design, but there are now multiple third-party implementations, including as part of Google’s Tink libraries, there’s a security analysis by Amazon Web Services , and it’s used by Microsoft in an official SDK .  ↩ Again, full disclosure, this is my design, but it’s adopted externally enough that I feel comfortable recommending it.  ↩ On 64-bit machines, SHA-512/256 and SHA-512 should be faster than SHA-256 thanks to their larger block size, except right now hardware support for SHA-256 is more widespread, so SHA-256 is faster in practice. They are both fast, so you probably don’t care.  ↩ Partially because of choices NIST made to make SHA3-256 strictly as secure as SHA-256, even where SHA-256 was overkill. SHA-256 and SHA3-256 have 128 bits of collision resistance and 256 bits of second preimage resistance. It’d be enough to have 128 bits of both, which is what you get from 256 bits of SHAKE128 output. Unfortunately, it doesn’t have a SHA name. TurboSHAKE128 (RFC 9861) would be even better, but it is neither FIPS 140 nor widespread.  ↩ People outside the FIPS 140 circle of hell don’t seem to have noticed, but new NIST rules require FIPS 140 modules to have an “internal” entropy source now. If your FIPS 140 “module” is a piece of software… what do you do? Everyone’s answer is “CPU jitter”: run a tight loop that accesses uncached memory and take high-resolution timestamps, hoping the frequency mismatch between CPU and main memory will make the measurements unpredictable. IMHO, this is the worst part of FIPS 140 since the module integrity hash, and it will hurt people. The one sane way to do it is to go through the motions, and then at the last moment mix the result with kernel entropy, like Go does. However, that’s harder to justify to the validation labs than doing just CPU jitter, so I’m afraid we’ll see pure CPU jitter in production a lot.  ↩ Argon2id parameters mostly do what you’d imagine, scrypt parameters do not .  ↩ A link with an opaque random token that logs in the opening browser is very hard to phish. A link that logs in the browser that started the login is very easy to phish. Short numeric codes are moderately easy to phish. (You can get the best of both worlds by using the Broadcast Channel API to pass the token from the new tab to the original one.)  ↩ In a different venue I said a serious engineering community would have a post-mortem about having wasted two of the five years we had for the transition to post-quantum cryptography, only to produce specs that changed nothing compared to what we had in 2024. But that’s for another time.  ↩ Again again, full disclosure: my design, but pretty uncontroversial pick.  ↩ I truly don’t understand why my predecessors recommended NaCl’s box. It’s an incredibly sharp and low-level API , pretending to be a high-level safe API.  ↩ One last time, full disclosure: I am a crypto/tls maintainer.  ↩ CVE-2020-13777 , GnuTLS 3.6.4–3.6.13: the session ticket key is all zeroes, breaking confidentiality in TLS 1.2 and allowing authentication bypass in TLS 1.3.  ↩ CVE-2023-45199 , Mbed TLS 3.2–3.4: pre-auth remote code execution via an oversized key share in the TLS 1.3 handshake.  ↩ CVE-2026-34873 , Mbed TLS 3.5.0–4.0.0: TLS 1.3 session resumption allows client impersonation.  ↩ CVE-2026-25835 , Mbed TLS 2.18.0–3.6.5 and 4.0.0: the RNG state is cloned across fork, so parent and child produce the same random values.  ↩ CVE-2026-5194 , wolfSSL 3.12.0–5.9.0: signatures by ECDSA certificates can be forged by providing an ML-DSA or Ed25519 signature algorithm identifier and a trivial ECDSA signature over the zero-length digest.  ↩ CVE-2026-5501 , wolfSSL through 5.9.0: the OpenSSL compatibility layer skips the leaf’s signature check when any valid end-entity cert is supplied as an “intermediate.”  ↩ CVE-2026-11310 , wolfSSL 5.8.4–5.9.1: the OpenSSL compatibility layer lets caller-supplied untrusted intermediates act as trust anchors.  ↩ CVE-2026-11999 , wolfSSL 5.7.4–5.9.1: the OpenSSL compatibility layer accepts any chain longer than the maximum path depth of 100, without reaching a trust anchor.  ↩ CVE-2026-55960 , wolfSSL 5.6.4–5.9.1: a raw public key is always accepted in place of a certificate, bypassing authentication.  ↩ CVE-2026-93302 , wolfSSL 5.3.0–5.9.2: trusted-peer certificates are matched by name rather than public key.  ↩ CVE-2026-89136 , wolfSSL 5.6.0–5.9.2: clients still accept an unsolicited raw public key from the server, bypassing authentication.  ↩ CVE-2026-89135 , wolfSSL 5.8.4–5.9.2: a failed chain verification in the OpenSSL compatibility layer permanently adds the attacker’s CA to the trust store used by native TLS, OCSP, and CRL checks.  ↩ CVE-2026-34580 , Botan 3.11.0: an end-entity certificate whose DN matches a trusted root is accepted as if it were that root.  ↩ CVE-2026-34582 , Botan before 3.11.1: TLS 1.3 servers process application data before Finished, so a client can skip Certificate, CertificateVerify, and Finished entirely, a full client authentication bypass.  ↩ Encrypting data : If you’re in the cloud, KMS. Otherwise, XAES-256-GCM or XChaCha20Poly1305 with random nonces. If you’re encrypting more than a few MB, use Cobblestone-128. Symmetric key length : Don’t stress it. 256-bit keys if you need to pick. Symmetric “signatures” : HMAC-SHA-256. Hash algorithm : SHA-2 is still fine, but use a real multihash (SequenceHash) if needed. Random IDs : 32 random bytes, a.k.a. 256-bit random numbers. Password handling : Argon2id or scrypt. But have you considered passkeys instead? Key exchange : X25519+ML-KEM-768 in a secure, standard protocol. Asymmetric encryption : HPKE with (MLKEM768-X25519 a.k.a. X-Wing, HKDF-SHA256, AES-128-GCM), or age with PQ keys. Asymmetric signatures : ML-DSA-44. Website or client-server application security : If you’re in the cloud, use its ALB/NLB. Otherwise, rustls, Go’s crypto/tls, BoringSSL, AWS-LC, or s2n-tls with a popular, updated ACME client. Online backups : restic with a long random password. FIPS 140 still has some very ugly bits around module validation (runtime self-tests, the integrity check, and the worsening RNG mess) but the actual cryptography algorithms these days are “good, actually.”  ↩ You might read that GCM can take 128-bit nonces, but when you do that it doesn’t have a separate CTR counter anymore, and messages with different GCM nonces can end up sharing CTR keystream, which makes the analysis more complicated.  ↩ Full disclosure: XAES-256-GCM is my design, but there are now multiple third-party implementations, including as part of Google’s Tink libraries, there’s a security analysis by Amazon Web Services , and it’s used by Microsoft in an official SDK .  ↩ Again, full disclosure, this is my design, but it’s adopted externally enough that I feel comfortable recommending it.  ↩ On 64-bit machines, SHA-512/256 and SHA-512 should be faster than SHA-256 thanks to their larger block size, except right now hardware support for SHA-256 is more widespread, so SHA-256 is faster in practice. They are both fast, so you probably don’t care.  ↩ Partially because of choices NIST made to make SHA3-256 strictly as secure as SHA-256, even where SHA-256 was overkill. SHA-256 and SHA3-256 have 128 bits of collision resistance and 256 bits of second preimage resistance. It’d be enough to have 128 bits of both, which is what you get from 256 bits of SHAKE128 output. Unfortunately, it doesn’t have a SHA name. TurboSHAKE128 (RFC 9861) would be even better, but it is neither FIPS 140 nor widespread.  ↩ People outside the FIPS 140 circle of hell don’t seem to have noticed, but new NIST rules require FIPS 140 modules to have an “internal” entropy source now. If your FIPS 140 “module” is a piece of software… what do you do? Everyone’s answer is “CPU jitter”: run a tight loop that accesses uncached memory and take high-resolution timestamps, hoping the frequency mismatch between CPU and main memory will make the measurements unpredictable. IMHO, this is the worst part of FIPS 140 since the module integrity hash, and it will hurt people. The one sane way to do it is to go through the motions, and then at the last moment mix the result with kernel entropy, like Go does. However, that’s harder to justify to the validation labs than doing just CPU jitter, so I’m afraid we’ll see pure CPU jitter in production a lot.  ↩ Argon2id parameters mostly do what you’d imagine, scrypt parameters do not .  ↩ A link with an opaque random token that logs in the opening browser is very hard to phish. A link that logs in the browser that started the login is very easy to phish. Short numeric codes are moderately easy to phish. (You can get the best of both worlds by using the Broadcast Channel API to pass the token from the new tab to the original one.)  ↩ In a different venue I said a serious engineering community would have a post-mortem about having wasted two of the five years we had for the transition to post-quantum cryptography, only to produce specs that changed nothing compared to what we had in 2024. But that’s for another time.  ↩ Again again, full disclosure: my design, but pretty uncontroversial pick.  ↩ I truly don’t understand why my predecessors recommended NaCl’s box. It’s an incredibly sharp and low-level API , pretending to be a high-level safe API.  ↩ One last time, full disclosure: I am a crypto/tls maintainer.  ↩ CVE-2020-13777 , GnuTLS 3.6.4–3.6.13: the session ticket key is all zeroes, breaking confidentiality in TLS 1.2 and allowing authentication bypass in TLS 1.3.  ↩ CVE-2023-45199 , Mbed TLS 3.2–3.4: pre-auth remote code execution via an oversized key share in the TLS 1.3 handshake.  ↩ CVE-2026-34873 , Mbed TLS 3.5.0–4.0.0: TLS 1.3 session resumption allows client impersonation.  ↩ CVE-2026-25835 , Mbed TLS 2.18.0–3.6.5 and 4.0.0: the RNG state is cloned across fork, so parent and child produce the same random values.  ↩ CVE-2026-5194 , wolfSSL 3.12.0–5.9.0: signatures by ECDSA certificates can be forged by providing an ML-DSA or Ed25519 signature algorithm identifier and a trivial ECDSA signature over the zero-length digest.  ↩ CVE-2026-5501 , wolfSSL through 5.9.0: the OpenSSL compatibility layer skips the leaf’s signature check when any valid end-entity cert is supplied as an “intermediate.”  ↩ CVE-2026-11310 , wolfSSL 5.8.4–5.9.1: the OpenSSL compatibility layer lets caller-supplied untrusted intermediates act as trust anchors.  ↩ CVE-2026-11999 , wolfSSL 5.7.4–5.9.1: the OpenSSL compatibility layer accepts any chain longer than the maximum path depth of 100, without reaching a trust anchor.  ↩ CVE-2026-55960 , wolfSSL 5.6.4–5.9.1: a raw public key is always accepted in place of a certificate, bypassing authentication.  ↩ CVE-2026-93302 , wolfSSL 5.3.0–5.9.2: trusted-peer certificates are matched by name rather than public key.  ↩ CVE-2026-89136 , wolfSSL 5.6.0–5.9.2: clients still accept an unsolicited raw public key from the server, bypassing authentication.  ↩ CVE-2026-89135 , wolfSSL 5.8.4–5.9.2: a failed chain verification in the OpenSSL compatibility layer permanently adds the attacker’s CA to the trust store used by native TLS, OCSP, and CRL checks.  ↩ CVE-2026-34580 , Botan 3.11.0: an end-entity certificate whose DN matches a trusted root is accepted as if it were that root.  ↩ CVE-2026-34582 , Botan before 3.11.1: TLS 1.3 servers process application data before Finished, so a client can skip Certificate, CertificateVerify, and Finished entirely, a full client authentication bypass.  ↩

0 views
Brain Baking 1 months ago

Laptop Stickers: Yay Or Nay?

Here’s an interesting dilemma for you: do you place stickers onto the back of your laptop? Are you a laptop sticker kind of person or afraid of anything glossy that might leave glue marks? I used to belong to the latter group, but after more than six years of typing on this M1 Air , I was ready to give in. The reason for this is simple. Sebastián sent me a couple of Emacs-related stickers, knowing I couldn’t resist. It’s all his fault. Look at what he did! A not so pristine golden coloured MacBook Air shining in the sun, desecrated by four stickers. (And yes, I am well aware of the irony of pasting a Free Software Foundation sticker on a MacBook that runs on a proprietary OS. I promise my next hardware choice will be more ethically sound.) Of course I can’t stop there: what to do with all that open space in-between the stickers? I could have placed them all at one side to make it even more painfully obvious that the beautiful symmetry is completely gone now. As for the question of where to stick them: I already think far too much and was too happy with the stickers to give this much thought. They’re on there. The Apple logo is still visible: a Brain Baking logo sticker covering that up might be the logical next step to take. Every time I receive stickers at conventions, I hesitate: do I stick these onto the laptop? Wait, what do they represent? Do I really want to proudly display the Octat GitHub mascot to promote GitHub as “the only way to do Git”? Nope. Do I really want to paste a Java mug or Gopher on there, identifying myself with these programming languages that aren’t bad but don’t get my engine running? How about a colourful JetBrains IntelliJ one that can serve as a free ad? Nope, nope, nope. It was easy to be in the (tech) sticker hater group. And then I finally found something that was fun to mess around with. So yes, I am now a happy Lisp and Emacs advocate at work. The stickers already provoked many Emacs versus Vim discussions that end once you show them that Emacs can be a window manager running your other apps, or that EVIL mode exists. Still, 99% of the die-hard coder colleagues—which are less than 10%, the others of course rely on VS Code—are Vim users. That’s great! But one wasn’t and told me he yesterday closed his Emacs window for the first time in weeks. We both had to move classes but I’ve made a mental note to meet up and exchange Lispy configs. Thank you Seb & Seb’s stickers. Many of my students like stickers on their laptops. Most just stick on there whatever they can get their hands on. I’ve seen a lot of Gophers but nowhere in our curriculum we explore Go and after approaching them, I learn that they don’t even know how to write a line of Go code. A Gopher is cool, that’s what matters! I do think that you should at least know what you’re implicitly preaching. Which is why I’m not limiting myself by sticking only tech-related stuff on there. The question then becomes: what else? Something retro game-related, obviously. But still: what? A classic Castlevania logo? I’d rather go for a custom-printed sticker with some obscure sprite work, from for instance Wario Land 3 or Gobliins 2 . If someone is able to recognise all these, I’ll finally have found my missing soulmate. Maybe a pixelated version of bread or a fountain pen? Or am I giving away too much information that way? Also, since the laptop turns seven in January, I should keep copies as the stickers are not transferable. Another approach would be to cover the entire back, making use of every square millimetre. A few colleague design lecturers carry laptops like this. I don’t think I’m cool enough for that. Terence caught a nasty laptop sticker paralysis while trying to perfectly place his, so a bit of thoughtful preparation might be in order. I love Abigail’s Kirby sticker on her Thinkpad. She even scanned her laptop with a photocopier and converted the entire thing into a clickable polygon-based SVG. Much cooler than my lazy cellphone snapshot. I’m also jealous of her Cory Wong pizza slice sticker! I do wonder what she’ll do when her laptop breaks down or it’s time for a replacement. Nia’s laptop stickers (a November 2022 snapshot) also contains some cool ones, as does Manton Reece’s , such as bookstore stickers. Here’s a discussion on the Framework forum containing more inspiration. It is clear that I still have some work to do. The four stickers are only the beginning. Laptop Stickers: Yay Or Nay? Yay. But then: how many? Overlapping or not? Planned placement or not? Tech-related only or not? See, even the most banal decisions in life come with Deep Thoughts ! To be continued with a photo when it’s done. Related topics: / stickers / By Wouter Groeneveld on 9 October 2026.  Reply via email .

0 views
David Bushell 1 months ago

Friendship ended with Deno, now Node is my best friend

It’s finally time I go crawling back to Node! I’ve been using Node heavily this month on a SvelteKit client project. When did Node get so good‽ Deno has been my go-to runtime for so long I forgot how to Node. Now I’m back, I find all the ECMAScript † sugar is supported and the old annoying APIs have been replaced or modernised. Most importantly, I never have to see . † Doesn’t seem like that Oracle trademark dispute will see a positive end :( The official Node docs recommend piping an internet script straight to bash (we never learn) to install NVM to manage Node & NPM. My (ancient) experience with NVM and NPM hasn’t been stellar. I heard Fast Node Manager (FNM) was better to switch Node versions. Obviously I roll bleeding-edge but I have client projects that demand stability. I opted for PNPM too to avoid getting immediately pwned. (The “M” in NPM stands for “malware.”) Some scripts I use have hard-coded binary names, so I added two aliases: Maybe that’s a crime but so far it’s worked flawlessly. PNPM also blocks post-install scripts. Does NPM still yolo those? I added additional settings to to delay malware updates. At first I tried setting the minimum release age to “one month” because it takes Microsoft at least that long to remove reported malware. This caused dependency issues where PNPM struggled to match suitable versions. I settled for “one day”; long enough to allow some other sucker to beta test the next Shai‑Hulud. Node can now run TypeScript without throwing a tantrum like a baby if the stars don’t align. That said, one does not simply publish TypeScript packages to NPM. Why? Just strip the types bro, I know you can! Let me sign a deal with the devil! To discourage package authors from publishing packages written in TypeScript, Node.js refuses to handle TypeScript files inside folders under a path. Node.js v26.10.0 documentation This restriction is philosophical rather than technical. I get it though. TypeScript is a Microsoft product. Opening that floodgate would pollute the entire ecosystem. Nobody wants more Microsoft. I’d love to see light “native types” in ECMAScript. There are type annotation proposals . I suspect I’ll be retired before those bear fruit. No TypeScript packages mean I need to find the latest churnware slop to bundle my stuff. Tsdown did the trick, with only two additional dotfiles. Not thrilled about that (every dotfile represents a mistake). I suppose I break even after deleting etc. Speaking of Microsoft lock-in, because they wrecked GitHub I’m self-hosting my own Forgejo instance . NPM limitations mean my packages have lost “provenance”. I had to configure the PNPM trust policy to allow my own stuff. Fun times! My final test for Node was converting my static site generator from Deno. Not many Node versions ago this would have required a major refactor. Today with I found surprisingly little work to do. The only required changes were to replace Deno’s file system API with — which is vastly improved from what I remember (literally ~10 years ago). Aside from that, I had to replace with Hono’s node adapter (a wrapper around ). After this minimum-viable migration I was shocked to see 15% faster builds . My codebase still favours idiomatic Deno. I bet I’m leaving performance on the table by not using other built-in Node APIs. That’s something to explore later. The only further change I made was to replace Deno’s with which is a straight import swap. So if I were to TL;DR in the middle: Node got a glow-up, wow! You’ve probably known this for a while. I kept using Deno out of habit and familiarity. And I haven’t exactly been enthused to write server-side JavaScript recently. I’m burying this part because it’s flogging a dead horse. Ultimately, Deno failed when they allowed the Silicon Valley Circus to define “success”. Deno went from an innovative modern JavaScript runtime to a boring start-up with uncompelling products . Half the employees were laid off and what’s left are tweeting AI fantasies and vibe-coding Temu Cloudflare. There is no reason to use the Deno runtime today. Deno Land Inc. stopped innovating that years ago. Node has slowly but surely caught up, even surpassing Deno in places. What finally pushed me away was: Basically stuff that made it borderline unusable on top of my other criticism. JSR support were very quick to delete my account on request. I don’t like leaving dead profiles around the internet. None of my packages are visible but old versions remain installable. It was fun early on but now it’s time to say goodbye. Thanks for reading! Follow me on Mastodon and Bluesky . Subscribe to my Blog and Notes or Combined feeds. Broken ZSH integration for weeks JSR’s aggressive “429 (Too Many Requests)” Bug(s) that made Deno choke on concurrent HTTP requests

0 views
マリウス 2 months ago

Updates 2026/Q3

This post includes personal updates and some open source project updates. もしもし、マリウスです, faxing at 9600 baud directly from Tokyo, Japan . After a short hop over to Hong Kong and Shenzhen , I’m back in the beautiful neighborhood of Shimokitazawa , where I’m spending almost the entire rest of the year until right before Xmas, when I’ll be heading back to Shenzhen. First things first, a warning: This is a very long post as it includes a metric ton of project updates. If you’re interested in the stuff that I’m building then this update is definitely for you. However, let’s start off with some infrastructure-related things. A few major updates happened in the past quarter with regard to my infrastructure. Probably the most important one is the migration from individual VPS instances to my own bare metal running a Proxmox “datacenter” . While I had been relatively satisfied with Vultr in the past, with an ever-increasing number of virtual server instances, for projects like MSG.TAXI , Hyperuplink , tty.fail , and everything related to this very website, my cloud service bill became overly expensive, all while contributions sadly decreased over the past months, making it unsustainable to run cloud infrastructure, especially to that extent. It just so happened that Vultr had more maintenance windows than usual over the past months, which prompted me to finally deal with the task of moving my VPS instances onto my own hardware. By migrating to bare metal, I was able to slash costs by approximately 30%, by discarding the resource safety buffer I had accounted for within each individual VPS, for a more dynamically allocating approach across individual instances. With rising hardware costs, however, one trade-off that I had to make concerns high availability. A full hardware failure on the current setup will result in all uncached services becoming unavailable for as long as the repairs take. Unless prices for hardware go down again, which is unlikely to happen , or contributions pick up again, which in the current market climate is equally unlikely, I won’t be building out the setup any further. As for some general stats about this specific website, over the past six months it generated at its peak over 270GB of traffic per month, which is considerable, given its compact size and its GTmetrix rating of (100% performance, 98% structure, 450ms LCP, 0ms TBT, 0.02 CLS), with the first contentful paint after 344ms, the speed index at 366ms, the time to interactive at 436ms, and an average page size (including images) of a few megabytes at most. Because I stopped running any form of analytics software, due to privacy reasons at first, but ultimately because of the realization that it has become pointless with all the robots LARPing as legitimate human traffic, I cannot tell you the number of visitors this website or any of the related projects have, and frankly I don’t even care. Not because I don’t care about actual humans being interested in the things I’m publishing, but because over the past months I have been receiving an increasing amount of feedback via e-mail, as well as welcoming a surprising number of new members to the community channel , so that I don’t need analytics software to show me that visitors appreciate the work I’m putting in and decide to stick around. Speaking of sticking around: The SimpleX group that existed next to the primary XMPP channel is no more. Neither the platform, nor the group itself developed in a favorable way over the past years, despite its almost 500 members. SimpleX turned from an interesting privacy platform into yet-another-Telegram-type messenger and is on the way to enshittification with VC investments from e.g. ACP, who is an investor in K2 Space (ELINT), OnScreen.ai (tracking), Zorus (employee/network monitoring), as well as Jack Dorsey. To make matters worse, at the end of September Evgeny Poberezkin reached out to me via e-mail with the following request: Thank you very much for this article: https://xn--gckvb8fzb.com/an-overview-of-privacy-focused-decentralized-instant-messengers/ (we shared it here: https://simplex.chat/ <redacted>). We launched equity crowdfunding on Wefunder in August ( https://simplex.chat/ <redacted>), to give users the opportunity to get a stake in SimpleX Chat and benefit from its growth - 150 people have already invested. Please help us spread the word - maybe you could write about it and some other recent news: the foundation, channels, public names, and supporter badges, which we launched recently ( https://simplex.chat/ <redacted>). It would be great to connect - SimpleX link is below - please send any questions! Thank you again and all the best Evgeny P.S. If you write something, could you please share with us before publishing so it complies with Regulation Crowdfunding rules? We cannot promote (and won’t be able to re-share with our community) if it mentions valuation, security type, how much is or left to raise (saying how many people invested is allowed), and how the funds will be used. We can mention perks we provide though. Thank you! – Evgeny Poberezkin SimpleX Chat, Founder Despite my article clearly stating, quote: Red flag: VC funded, specifically by Jack Dorsey , since Aug 14, 2024, hence I do not recommend it any longer. … Evgeny (or, more likely, his team that didn’t properly vet every organic site linking/mentioning SimpleX) sent me this fairly generic looking e-mail, to which I replied by pointing at the red flag . Long story short, the fact that SimpleX has now seemingly become so much of a product in the literal sense that they are trying to get approved organic content out for their funding campaign shows once more that it isn’t a suitable option for the privacy/decentralization community anymore. I have therefore deleted the SimpleX group, as well as removed all mentions of the messenger on this website, treating it the same way as I treat e.g. Telegram, WhatsApp or any other commercial platform. Anyway, a few days ago I shut down the last Vultr instance, an OpenBSD machine that had been serving this website for years. It outlived the rest of my cloud infrastructure by a couple of days. The clearnet version of this website had moved from the instance to a Bunny storage zone with a pull zone in front of it earlier in September, which happened due to the increased traffic by bots and maybe humans , and which means that there is no origin server at all any longer. The Tor and I2P sites still needed a machine of their own, since Bunny doesn’t offer a way to serve either of them, hence both are now served from a virtual machine on my own hardware. That machine has no public IP address, which neither the Tor daemon nor i2pd needs in order to publish a site. Unfortunately it does appear to make the I2P site less reliable, presumably because an I2P router that nobody can connect to depends on other routers to introduce it, and in a measurement about four hours after the move, 4 out of 8 requests to the eepsite succeeded, while all 8 requests to the onion service did. If the eepsite doesn’t load for you, simply try again, since a second attempt usually works. The clearnet side has a trade-off of its own, namely that this website now depends on a provider being there, where the VPS used to be able to serve the entire thing by itself if I ever took the CDN away. What makes me comfortable with it is that the build is still a folder of plain files that any web server can serve, hence going back would require not much more than a server, a workflow step and a few changes in the DNS, but not a rebuild. There’s a dedicated write-up on the whole publishing pipeline in the works, so I’m keeping it at this for now. It’s been almost three months since I got the Lenovo X1 Carbon Gen 14 Aura and switched from the StarBook Mk VI to it , and I haven’t regretted it so far. The laptop performs as well as I had expected it to while offering very decent battery life. At times I’m getting dangerously close to its 32GB RAM limit, which is something I had expected before purchasing it, but most of my workloads still have plenty of breathing room. Shortly after upgrading to the X1 Carbon I also decided to get an external (portable) 19" screen, and so I snapped up the Uperfect GR19BU. So far my experience with the display has been very decent, but I won’t get ahead of myself as I’m going to release a dedicated write-up/review on it soon. However, with several other new additions to my setup, like this display, the Mudi 7 , and the things below , it’ll probably make sense to also start preparing a follow-up on the travel desk setup from earlier this year. As usual with many of the posts on this site, however, it takes between one and three months from the first line to the finished and published post, so don’t count on it until the end of the year or maybe even early next year. After having had a few minor issues with the uni USB-C hub (8-in-1 with USB-C power), and slowly running out of USB ports, I decided that it was time to get a proper Thunderbolt 4 dock for my X1 Carbon , and what option would be better than the official Lenovo ThinkPad Thunderbolt 4 Smart Dock Gen 2 7500, for which I happened to find a pretty sweet deal. As a matter of fact the deal was so good that I didn’t realize at the time of buying that the dock comes with A) its own external 135 Watt power adapter and cannot be powered through a regular USB-C PD charger, which is sort of messing with my minimal yet productive travel desk setup , because I’m already carrying a PSU that weighs over 800g, and B) with cLoUd CoNnEcTiViTy . The dock itself is 590g, its PSU (plus power cord) another 350g, which amounts to 940g total added weight for only the dock. Clearly the dock isn’t meant to be a travel-friendly option, but it seems like no Thunderbolt dock really is considering the (even heavier) alternatives, like the CalDigit TS-4. However, with regular USB-C hubs not providing enough connectivity, performance and, most importantly, stability, it was time to try a different class of devices. Sadly the dock only lasted a single day before it stopped working and had a slight smell of burnt electronics to it. Hence I had almost three weeks of back and forth with Lenovo’s customer service in order to get it RMA’d/replaced, which was a frustrating experience to put it mildly. Then again, I don’t think the lackluster performance of Lenovo in the specific geographic region that I had to deal with them in is a fair representation of Lenovo’s global customer service, but very likely typical customer service across most companies in that region. Anyhow, I eventually received the replacement and I’m finally able to use it. The hardware is fairly decent, I haven’t encountered any odd messages in my log yet, and I finally have enough USB-A/-C ports to connect all sorts of peripherals, like my keyboard, my mouse, the portable monitor , and more. However, I’d wish that these docks would replace their HDMI and DisplayPort connectors with more USB-A/-C ports and maybe even a halfway decent sound card with various audio connectors (3.5mm amongst others). I never needed that many display outputs on a computer, let alone on a portable device. But I guess I’m the exception, as pretty much every dock manufacturer seems to follow this quadruple/sextuple/octuple display-setup trend. The only meh part of the dock seems to be the integrated Ethernet card/port, that appears to be a Realtek RTL8156B ( ), which is a bit of a potato. There are plenty of user reports online that describe all sorts of issues with this specific NIC under Linux. While it does offer 2.5G, matching my new switch perfectly, it does seem to come with a few issues with regard to reliability and actual performance. However, with the amount of USB ports on the dock I can connect one of the many 1G Ethernet adapters that I have and be done with it, in case the integrated NIC should ever give me a hard time. So far, however, it had been working without issues. In an ongoing effort to USB-C-ify all of my hardware I also pulled the trigger on a new portable switch, namely the Ubiquiti Flex Mini 2.5G. I’ve been using the blocky Netgear 1GbE switches forever, but I’ve always struggled to power them, as they come with a barrel connector and a dedicated PSU. While I did at some point get a USB-A-to-barrel-connector cable, judging from the power output of the PSU those switches are not intended to be run off of a USB-A port. It works, but it’s probably not the best idea. Short story long, I went for the Flex Mini primarily because it is powered via USB-C, so that I don’t have to carry another PSU or worry about damaging the device. As an added benefit, the switch now offers 2.5G links, which the Lenovo dock , as well as the Mudi 7 and the Slate 7 can benefit from. Ideally my portable NAS should also benefit from the higher speeds, but sadly that probably won’t happen with the current hardware. Speaking of which … The Ultra-Portable Data Center (v2) has had its second birthday and has held up extremely well, considering all the travel and, at times, incredibly dusty, humid, and/or hot environments that it went through. More importantly, though, even two years later there is still not a single comparable, commercial product on the market that would make me want to replace the existing system with it. Every piece of hardware that I’ve stumbled upon to date appears to come with major hard- or software headaches, be it the UnifyDrive UT2, the Beelink ME Mini, the CWWK x86 P6, or even the significantly larger/heavier AOOSTAR R7. The closest in terms of software freedom, hardware reliability and physical footprint to date appears to be the QNAP TBS-464, which is an ultra-thin and lightweight, portable 4-bay M.2 NVMe NAS introduced back in 2021. Because I had to further reduce the weight and size of the items that I carry with me on my travels, however, at the beginning of September I began working on the next iteration of my ultra-portable NAS, the UPDC v3. I haven’t yet found the time to pour the endeavor into a dedicated write-up, but I am happy to say that I’ve managed to reduce the build’s footprint from initially around 1.48 liters down to as little as 0.68 liters in volume. I won’t spoil too much, yet, but it’s fair to say that I’m relatively happy with the end result and that it allowed me to make the UPDC a fixed part of my carry-on luggage . Not much happened on the keyboard front this quarter, apart from a set of PBS Black on Black that I was gifted, and that has since been on my Kunai . It has become one of my favorite keycap sets and it is pretty much what I was hoping for . The PBS keycaps are however not as rough/textured as I was hoping them to be, which is a bit of a bummer. Anyway, I might post a dedicated long-form review in a few months when I’ll be able to better judge long-term use. I invested some time in pursuing my open source projects in the past quarter, hence there are a few updates to share. Several of them shared the same two things, which were a move to the SEGV-1.1 license , and a vanity import path under my own domain. As some of you might remember, I had an unpleasant encounter last year with one of the Alacritty developers, which prompted me to do something that was long overdue, namely switch to Ghostty. Along the way I implemented the exact feature I initially wanted for Alacritty and made my code public, on a dedicated branch in my fork of Ghostty. Over a year later, I’m still maintaining that patch. If you’re using my patch, make sure to update your local version. Neon Modem Overdrive , my BBS-style command line client, received a whole new backend this quarter. It can now connect to Hyperuplink, the bulletin board of the future, to which I’ll get in just a second . Neon Modem is the first dedicated client implementation for the relatively young and not-yet-well-thought-out REST API. Additionally, a shared prompt package now handles the server URL and credential input for that system as well as for Discourse and Lemmy, instead of each one keeping its own copy. I also tracked down a longstanding source of UI lag. The post-create and post-show windows were doing more work on every keystroke than they needed to, and reworking their handlers and rendering made the interface responsive again. A new release with all of this is available on tty.fail , with binaries on GitHub . Kopi , the command line coffee journal, had its two heaviest dependencies replaced. The SQLite driver moved from the -based to the pure-Go , so Kopi now builds without a C toolchain and ships as a fully static binary on every platform. The OCR helper, which reads the details off a photo of a coffee bag, moved from an Ollama-specific client to the official OpenAI Go SDK , so it can point at any OpenAI-compatible endpoint rather than only an Ollama instance. The Go module was renamed to a vanity import path under my own domain ( ), and the usual dependency, workflow and GoReleaser housekeeping came with it. On top of this, Kopi received the first contribution , which was applied to it via at the end of July. reader , the command line web page reader, had a productive quarter. The biggest change is the removal of the journalist dependency, whose crawling logic is now part of reader’s own package rather than pulled in from a separate module. As I don’t maintain journalist any longer it made sense to pull out the bits that I need for reader. Additionally, reader gained proxy support, so it honors the standard proxy environment variables (#23). It now also correctly handles the URL scheme when deciding whether a source is an HTTP resource (#35), and it got a fix for an -related issue (#37), which I worked out despite the reporter never supplying the example files I asked for. Note: Don’t be that guy . If you open an issue in any piece of software that you don’t pay for and that someone else dedicates their time to free of charge, consider upfront if it’s really something that you’re going to use, and if it’s an issue you’re willing to dive into and help fix. If either of these are a clear nope , then simply don’t report it at all. usbec , the USB Equipment Commander daemon that runs commands when USB devices are plugged in or removed, had its one core dependency reimplemented in-tree and enhanced. The module was dropped and its Linux netlink listener rebuilt inside usbec’s own package, so the daemon no longer depends on an outside module for that. The license moved from GPLv3 to the SEGV-1.1 license , the module was renamed to the vanity import path, and the release workflow and GoReleaser config were fixed along with it. In addition, the USB Equipment Commander is now a USB & Network Equipment Commander, with the introduction of NetworkManager (via D-Bus). This allows you to have usbec run commands whenever the network changes in any of the various ways it can change. My motivation was to run a script that queries my public IP and the inferred location via and shows it as a desktop notification whenever NetworkManager (re-)connects. zpoweralertd , my Zig rewrite and drop-in replacement of poweralertd, which is a UPower-powered power (.. power, POWER, POWERRRRR) alerter, has received a deep and thorough refresh. The biggest change is the C bindings, which I have replaced with handwritten s, just the way I had used them for the first time in ssh-askpass-zigtk , but more on that new tool below. The second big change is the Zig compatibility, which now requires at least 0.16, and which I have tested against the current master/future 0.17 release as well, to make sure that everything will continue working. With this, I also largely refactored the code, for which I initially took inspiration from poweralertd. The restructuring allowed me to clean up the codebase and find a handful of memory-related issues along the way. A new version of zpoweralertd has been released that contains these enhancements and, for the first time, it is available as pre-built binaries directly from the releases page. cexec , my small cached-exec wrapper that runs a command and caches its output for a given amount of time so that re-running it returns the stored output instead of executing it again, was rewritten from Go to Zig this quarter. The new version is a drop-in replacement for the previous one, but it changed a few things in the background, one of which is the storage. Previously cexec used BuntDB, which turned out to be a bad choice for a process that can theoretically run multiple times in parallel and access/write to the same database. The new version, instead, uses plain files that are scoped to the actual commands that are being executed. In addition, the new Zig version supports encryption for the cached runs, with an optional key from or the environment variable, which makes using cexec suitable even for output that contains sensitive data. On top of that, everything cexec does is now also available as a Zig module, so that the same caching can be used from another program without having to shell out to the cexec binary. New this quarter is , a GTK4 helper written in Zig . OpenSSH runs an askpass program to prompt for a passphrase or a yes/no confirmation when it has no controlling terminal. The reason it exists is my own issue with X11, which I explained here . The reference askpass, and most others, link GTK against X11, so they fail to build on my Gentoo system with the global USE flag. does not require X11 dependencies, so it builds and runs on an X11-less GTK4. It works on Linux and (hopefully) on the BSDs alike. Also new this quarter is Switchyard , a lightweight bridge that accepts e-mail over SMTP and forwards each message to XMPP. You might have read about it before in the dedicated post that I had published at the beginning of August, but if you haven’t I recommend going through it if a bridge for SMTP to XMPP sounds like something you could have a use for. For years I had a small shell script in my dotfiles that popped up a bemenu list whenever I clicked a link, so that I could decide which browser it opened in. This quarter I turned that idea into a proper GTK4 application written in Zig, namely Browser Select . It registers itself as a web browser, hence every link another application opens goes to it first, and a small popup then lists the browsers installed on the system for you to pick one with the mouse or the keyboard. Just like the script before, that used the Go version of cexec as a binary to cache the choice for a few seconds, Browser Select also uses the new Zig cexec library for remembering a choice for a while, so that clicking a burst of links doesn’t lead to repeated asking for a browser. The Flipper BUSY Bar review that I posted this quarter came with a little goodie: busybar.zig . It is a Zig 0.16 client library and command line tool for the Flipper BUSY Bar, implementing the device’s current OpenAPI specification as closely as possible, so that you can drive it over its HTTP API from Zig code or straight from the shell. It uses nothing but Zig’s library, which means it builds for every target Zig supports, including macOS and Windows. Darkwing Ducky is a BadUSB (“Rubber Ducky”) firmware for the PicoUSB, an RP2040-based board, built in Zig 0.16 with MicroZig . I’ve struggled to finish this for about ten months or so, primarily because implementing the required USB HID code that acts like an external keyboard wasn’t all that straightforward with MicroZig. Anyway, Darkwing Ducky announces itself to the host as an ordinary keyboard and then types out a predefined sequence, which can be useful for automating the setup of a machine that you have physical access to, or, well, for other things. While the PicoUSB comes with its own CircuitPython-based software, I wanted to try Zig on hardware, especially with MicroZig for a while and so this device was the perfect excuse to do so. If you’re curious, the repository has the details on the payload format and how to flash it. The internet bulletin board software that I had been writing about as ▓▓▓▓▓▓▓▓▓▓▓ in the previous updates has a name, and it’s out. Hyperuplink went public at the end of August, together with a dedicated post that covers what it is, why it exists and how to run it. If a JavaScript-free forum as a single binary sounds like your kind of thing, read that one first and come back here afterwards. Otherwise you might as well skip this part. Most of the quarter went into the bits and pieces that the board needed before anyone other than me could run it. Attachments and profile pictures with local or S3-compatible storage, board-wide settings and an administration UI for all of them, a search, soft-deletion for categories, forums and topics, and a manual that is embedded in the binary and available under Help -> Manual . On top of that came a whole set of themes and color schemes, as well as the packaging, which now covers Docker and Podman images, Quadlets, a Helm chart, a nixpkg with a NixOS module, an ebuild for Gentoo, and service files for systemd, OpenRC and rc.d. And if that wasn’t enough already there is the REST API, which is what Neon Modem connects to. If you’d like to have a look at Hyperuplink yourself without any commitment, there’s a demo instance that you can check out. You can find its login details on the official website . Account creation is disabled on the demo instance (for now). Go compiles down to a single static binary, which is why it is a great choice for Hyperuplink. However it has nothing along the lines of Django, Rails or Phoenix that takes care of the web parts, hence a good share of Hyperuplink was never about the bulletin board at all, but about routing, controllers, models, migrations, background jobs, translations and configuration. At the end of July I moved that share out of the repository and into Go on Glides , a web application framework for Go that includes everything needed to build database-backed web applications, on top of Fiber v3 and pgx , with embedded migrations, an asynchronous job queue, cron jobs, i18n, local and S3-compatible storage, and helpers that each project would otherwise have to reimplement. The reason for the split is that I’m building a second service on the same foundation, namely Maya , which meant that Hyperuplink’s internals had to become something that more than one program can use. Inca is the spiritual successor of addrb and caldr , my two earlier attempts at the same problem, this time as a single command line client for CalDAV and CardDAV that synchronizes calendars, tasks and contacts into a local database for offline use. It is built on top of the “framework” that I built and make use of in zeit , and therefore it shares a lot of zeit’s UI aesthetic. On the other end is Maya , a CalDAV and CardDAV server as a single Go binary with PostgreSQL underneath it, which (sadly) uses a patched hard-fork of go-webdav , and which exists because neither Radicale nor Baïkal ever made me happy. It’s the second program built on Glides . I’ve been dogfooding Maya myself since early September, and as of now it still isn’t publicly available because it’s not yet at a point that I’m comfortable releasing it, in particular due to its hard-fork of go-webdav, which was a requirement because the upstream project is sadly pretty much dead at this point. However, given the absolute mess that DAV protocols are, it’s not even surprising that the maintainer seemingly lost interest in this project, and that the ecosystem is so bad. Anyway, I have both, Inca and Maya, at a point that I can daily-drive them and, more importantly, that other clients (Android, iOS, desktop) can participate without too many hiccups along the way, but I’m not at all happy with the results for reasons that I will get into if I ever choose to release Maya. Also new this quarter, and admittedly not something one might call a modest undertaking , is Netrunner , a web browser built on WebKitGTK and GTK4, written in Zig . I’m calling it the hacker’s browser as it’s meant for people who prefer a lightweight browser over Chromium and Firefox and who care more about configurability and about built-in integrations than about endless features and add-ons. Netrunner deliberately leaves out a number of things that other browsers have, bookmarks being probably the most obvious one, because the people it is built for tend to have a system for those features in place already. Netrunner is configured through a single TOML file that holds the static settings as well as the runtime state, e.g. which sites are allowed to run JavaScript, play audio or send notifications. The session (i.e. open windows and their tabs) is also persisted in that one TOML file when the browser quits, and restored on the next start. Two other features that Netrunner comes with built-in are Onion addresses and Eepsites, which are native protocols for the browser. By default, whenever you open an URL or an link Netrunner opens a connection via Tor or i2pd and keeps it alive for as long as you browse sites within the Onion/I2P network. As soon as your browsing activity goes back to the clearnet, Netrunner automatically disconnects from Tor/I2P again. To the user these connects/disconnects happen completely transparently and every network gets a of its own, so a tab that follows a link onto another network moves over and keeps its back and forward history. In plain English this means that and URLs are indistinguishable from any other URL and you don’t need to do anything special to be able to open them. Obviously Netrunner is not a replacement for the official Tor Browser that the Tor Project releases and that is somewhat hardened to make sure you stay as anonymous and safe as possible. Instead, Netrunner’s Tor and I2P integrations are intended for the casual user who enjoys the freedom of browsing those networks as if they were part of the “normal internet”. Speaking about the normal internet, one thing that can’t be missed, especially these days, is content filtering. While WebKit sadly doesn’t support running a full-blown uBlock Origin, its own content filter engine is nevertheless a relatively decent option for basic ad blocking and annoyance filtering. As a matter of fact, Netrunner uses the same AdBlock and uBlock Origin lists that popular browser extensions use, but it does so by downloading and converting them into the WebKit content blocker format via adblock-webkit-convert.zig , one of two small Zig libraries that came out of this browser experiment. Sadly, the WebKit content blocker format does not support all the trickery that e.g. uBlock is able to do within its browser extension, which means that no, you won’t be able to avoid YouTube ads within Netrunner, at least for now. You will however still score above 62% on AdBlocker test sites , which is fairly okay. The other library that came out of this experiment is osdetect , which does what its name suggests: It detects with some amount of confidence what operating system a program is running on, and it gives you specifics like whether it’s e.g. a Debian or a Gentoo machine, or not even a Linux at all. I won’t tell what my main motivation for building this library was, but if I should ever get to the point that I have a 0.1 version of Netrunner ready for release you will be able to the source code for to find out. Which brings me to the release. Not only to that of Netrunner or Maya, but to the more general question of open source and how I intend to contribute to the ecosystem moving forward. Despite having a landing page online, Netrunner is a fun project that I don’t take too seriously and that I’m currently dogfooding, just like I do with Maya , to find out whether this is a project that I can imagine maintaining long-term, or whether it is one that will eventually outgrow my availability. After two decades of putting the software that I build for myself online, I have come to realize one or two things. The first thing is that “just putting it out there” won’t benefit the software and it certainly won’t benefit me. My main motivation for building all these things is my own curiosity about how stuff works and, ultimately, my own needs. I need a proper CalDAV/CardDAV server that is pleasant to administer/maintain and that can talk to all of the software that I’m using, hence I’m building Maya (and Inca) . I need a proper TUI client for Keebtalk and a few other forums, hence I’m building Neon Modem Overdrive . Speaking of which, I needed a forum and I was sick of the cruft that is phpBB or Discourse, so I built Hyperuplink . And it’s also me who is annoyed by the utterly insane bloat of modern web browsers, which is why I started building Netrunner. Publishing any of them inevitably changes the software from “what I need” to “what I need and what others seem to need” , and there is no guarantee, even if you go the extra mile to implement what others ask for, that those people will stick around or ever start contributing themselves. Zeit is one example where I experienced exactly that, multiple times, and every time it left a bitter taste in my mouth and, what’s worse, hundreds of lines of code that other people had requested but that nobody ended up using long term. At some point Zeit v0.x had become so bloated with other people’s needs that I rewrote it from scratch as the v1 release that it is today, with only the features that I believe make sense to support long term. The second thing that I realized is that “putting it out there” in hopes of finding like-minded people to collaborate with is a pipe dream. The open source “community” has been broken for a long time and, in most cases, was never much of a community to begin with, but rather the developer-equivalent of a one-man band . Not that there are no exceptions, however, my projects usually aren’t those exceptions. Kopi received its first contribution only this quarter, two years after I initially released it, and it was a one-time submission rather than something that materialized into a long-term collaboration. reader , in the very same quarter, collected a handful of issues, one of which I fixed without ever receiving any feedback on it whatsoever. And if you look through the few “Issues” sections on GitHub that I haven’t disabled yet, you’ll see that it’s the same story across the other projects as well, and you might understand why most of the repos lack the “Issues” tab these days. A single patch against two or three dozen issue reports is roughly the ratio that every single one of my projects has had over the past two decades, and I don’t believe that this is because my software is particularly unattractive to contributors, despite it being intentionally niche, but simply because writing a patch for someone else’s program is work, while filing a request is at most a two-minute annoyance. This is also why I, contrary to many other voices in the industry, do not regard opening an issue report as an actual contribution to a project. With all due respect, I don’t want your issue reports, keep them, especially the drive-by ones for something that you’re unlikely to end up using anyway. What a public repository attracts, hence, is an audience rather than a community , and many times that audience has a very short attention span. All of this eventually turns a maintainer into more of an unpaid support desk, which is not what I would like for myself. On top of that, LLMs have taken away the one argument that publishing open source software still had going for it. That argument wasn’t that a stranger would show up and maintain your software for you , but that someone out there might one day need the exact same thing badly enough to extend what you had already built, instead of writing it from scratch all by themselves. In 2026, however, that someone doesn’t need your repository any longer, because they’ll describe what they want to a model and get back something that compiles. Whether what comes out the other end is any good depends on the person directing the LLM and on the effort, or, dare I say, the money they’re willing to throw at it, rather than on the LLM itself. Code itself has become relatively cheap . As a matter of fact, if you want a specific feature implemented in any of my years-old tools, you might as well ask the machine to do it for you, so you can have what you need for the time being. And frankly, I’m quite happy about that! I’m happy that a random passer-by can get the feature that they thought they needed during their euphoric discovery phase of a tool they just found out about, mainly because I also know that the moment the honeymoon phase ends and the person loses interest in the tool, their interest in that feature will vanish along with it, and it would be left up to the maintainer to continue supporting it. Don’t get me wrong, I’m not arguing that collaboration never works, because examples like Linux, curl and PostgreSQL prove the opposite, but I am arguing that for small programs that a single person can hold in their head there are very few reasons for others to actively contribute, and even fewer in a world of automated code generation. Going back to where I started, I’m not sure yet whether I’ll ever publish any of the newer tools and programs that I’m building, like Maya or Netrunner, simply because I don’t see much of a reason to do so. Especially when, for projects like Netrunner, I know of far more popular examples that still died the moment their maintainer stopped investing time into them. And maybe that’s a good thing. Maybe these kinds of projects, just like the ones that I’m publishing, are simply not relevant enough in the grand scheme of things. Maybe it’s just Darwinism at work, and maybe that’s just how things should be after all. There he goes. One of God’s own prototypes. Some kind of high-powered mutant never even considered for mass production. Too weird to live, and too rare to die. – Raoul Duke

0 views
Ahead of AI 2 months ago

Language Models for Text Classification: From Bag-of-Words to Jev

The recently released Jev AI model has been quite a cultural phenomenon in technical communities in the past 2 weeks. While Jev aims to classify things, it’s easy to dismiss Jev as “just a classifier,” and my own view of Jev has evolved quite a bit over the past few days. In particular, my thoughts went from “classifiers used to be my bread & butter; I can easily build this myself” (more on this later) to “wow, this actually works better than I thought.” Figure 1: Quick overview of the Jev API; more details on that later. Sure, the latest state-of-the-art GPT and open-weight LLMs can do the same kinds of classification tasks as Jev, while also being capable of much more general decision-making. But Jev’s advantage is that it can handle those classification tasks much faster and more cheaply. At the other end of the spectrum, for a narrow, well-defined problem, Jev probably won’t classify anything better, faster, or cheaper than a special-purpose classifier. But its selling point is that it is far more general than those task-specific models. So, what is the methodology behind Jev (based on an educated guess), what can it do, and why is it so popular? I aim to answer all of these later in this article. However, I thought starting with a brief history of language models for decision-making would be a great way to begin. And it hopefully helps demystify some of the hype and show what Jev does very well (”Jev is essentially a text classifier,” but “Jev is also not ‘just’ a text classifier.”) PS: I am not affiliated with Jev in any way. Also, I am not offered free access to Jev, and this is also not a product endorsement, just a technical article to offer some insights into the history of text classification to help you make sense of the recent hype. Since this is a long article, I recommend reading it in your browser , where you can access the table of contents menu on the left side. For completeness, before we put Jev in context (no pun intended), I thought it made the most sense to start chronologically. In this section, I want to take a brief tour of applied text classification via naive Bayes, logistic regression, and the more classic (deep) neural networks before transformer-based models came along. Back in the day, when I was a grad student 15 years ago, even though recurrent neural networks already existed (more on that later), text classification was usually done with a bag-of-words representation because it was straightforward and could get good results on moderately sized datasets. In short, we can think of the bag-of-words representation as a method that makes free-form text input of different lengths compatible with classic classifiers (naive Bayes, Logistic Regression, SVMs, Random Forest, XGBoost, to name a few), which expect a fixed-size input vector. Popular real-world applications include anything from news article classification to email spam filtering. And yes, allegedly even Gmail’s original spam filter used a Naive Bayes model with a bag-of-words representation. As a side note, I wrote about this approach exactly 12 years ago. It was one of the first things I shared on arXiv. Figure 2: An old tutorial of mine from 2014 that explains naive Bayes classifiers using a bag-of-words model. So, what exactly is this bag-of-words representation? It’s a way to convert free-form texts with different lengths, e.g., Training example 1: “Zentropa is the most original movie I’ve seen in years. If you like unique thrillers that are influenced by film noir, then this is just the right cure for all of those Hollywood summer blockbusters clogging the theaters these days. Von Trier’s follow-ups like Breaking the Waves have gotten more acclaim, but this is really his best work.” Training example 2: “This film is just plain horrible. John Ritter doing pratt falls, 75% of the actors delivering their lines as if they were reading them from cue cards, poor editing, horrible sound mixing” Training example 3: “Zentropa has much in common with The Third Man, another noir-like film set among the rubble of postwar Europe.” into a fixed-size representation for the aforementioned “classic” classifiers. (The example above is an excerpt from the popular IMDb movie review classification dataset .) Figure 3: An illustration of a bag-of-words representation. A bag-of-words model starts by building the vocabulary, which consists of all unique words in the training set (optionally, one can get rid of so-called stopwords like “a” and “the”, which are words that carry little to no semantic meaning in most contexts). A bag-of-words representation results in these fixed-size inputs by assigning each word in a vocabulary its own position in a vector. We then count how often each word occurs in a document. For example, if we have a vocabulary of 50,000 unique words, it produces a fixed-size vector with 50,000 entries, regardless of whether the input consists of only ten words or 300k words. Note that most entries are zero because each document contains only a small subset of the vocabulary. (Instead of representing the raw counts, there are also normalization schemes like TF-IDF.) Then, once we have these word frequency vectors, we can train a classifier on a labeled training set, such as emails labeled as spam or non-spam. For example, a logistic regression model would then learn feature weights that correlate certain words (and word counts) with particular labels. For instance, certain words might increase the predicted spam probability, and others may decrease it. This approach is computationally cheap and can work well when particular words provide strong clues about the label. In a simple classification task such as spam classification, this is often enough to get quick, reasonably accurate results. But one of the biggest downsides of this approach is that, because of the nature of the bag-of-words representation, it loses word order. So, for example, “the dog bites the man” and “the man bites the dog” produce identical vectors despite describing different events. (There are some workarounds to preserve some local order by adding word pairs or longer sequences, called n-grams, as features, although this increases the vocabulary size.) Despite the shortcomings, I still think that a bag-of-words has its place in certain low-stakes applications because it’s so cheap, and a bag-of-words representation + logistic regression remains my go-to baseline for every text classification problem, since it’s so easy to implement. Figure 4: For those interested in building a simple logistic regression classifier, I have a tutorial up here . This model achieves 89.9% accuracy (on a balanced dataset). The aforementioned bag-of-words model would also work with (simple) deep neural networks, like multilayer perceptrons. But the downside still is that we would lose the sentence structure and word order. However, more sophisticated neural network architectures avoid the bag-of-words workaround: convolutional neural networks (CNNs) and recurrent neural networks (RNNs), which can take word embeddings as input. First, before feeding the input texts into a model, we have to convert them into a suitable representation. One such representation is bag-of-words. Another is word embedding vectors. The difference is that a bag-of-words vector represents the entire text by counting how often each vocabulary word occurs, while a word embedding represents an individual word as a dense vector of learned numbers. Figure 5: Illustration of creating word embeddings. Word embeddings work similarly to embedding layers in LLMs, i.e., they convert input tokens into dense vectors. Embeddings can happen outside the model (e.g., two classic, popular methods for learning them are Word2Vec and GloVe ), or the embedding layer can be part of the neural network architecture itself and be learned and tuned during model training. These classic embeddings are context-independent at lookup time. The word “bank”, for example, gets the same vector in “river bank” and “bank account” (as you may know, context can be handled via concepts like attention). For additional resources on embeddings, you may find the following ones helpful: Chapter 2: Working with Text Data (this is an LLM chapter but should give you the gist of embedding words or tokens; in LLM tokenizers, we split words into subword tokens; in Word2Vec, 1 word is usually 1 token.) Understanding the Difference Between Embedding Layers and Linear Layers (this is an illustration that shows when embedding vectors are mathematically equivalent to Linear layers and matrix multiplications.) Since many of you are probably familiar with recurrent neural networks (RNNs), I will keep this section short. RNNs are a classic go-to neural network architecture for natural language processing, and popular variants go back to the 1980s and early 1990s. Transformers, which were introduced in 2017 (and using the attention mechanisms that were first introduced in RNNs; see my Understanding Large Language Models for a brief timeline), then gradually replaced them in many NLP applications. RNNs read a sequence (like text) one word at a time. At each step, they combine the current word embedding (discussed in the previous section) with a hidden state from the previous step. We can think of the hidden state as a fixed-size vector that summarizes the text processed so far, so this makes word order matter, because rearranging the words changes the sequence of state updates. Figure 6: Illustration of an RNN classifier. Note that the figure above shows the RNN in the unrolled representation. I.e., the RNN reuses the same layer stack for each input, hence the term “recurrent”. And since it’s “recurrent”, the input text can have an arbitrary length. The figure below illustrates the “recurrence” with the unrolled representation side by side. Note that both show the identical architecture, it’s just a different visualization. Figure 7: Rolled and unrolled illustration of the same RNN. RNNs were notoriously hard to train, and there are important improvements to RNNs, like Long short-term memory (LSTM) networks, introduced in 1997, and gated recurrent units (GRUs), introduced in 2014, which use learned gates to control how information is retained and updated. (There is also the more recent xLSTM: Extended long short-term memory , introduced in 2024). Also, state-space models are inspired by this idea of a fixed-size hidden state updated sequentially, which is cheaper than transformer attention. However, the bottleneck is still how much information the hidden state can retain, and it still has to be processed sequentially. (Fun fact: attention was first developed for RNNs before the transformer architecture came along, but it’s a story for another time; I’ve written about it in my Understanding Large Language Models article.) The bottom line is that RNNs can be used to train text classifiers. Coming back to the IMDb movie review dataset, the bag-of-words classifier with logistic regression achieved about 89.9% accuracy (on a balanced dataset), while an LSTM RNN achieved only 85.66% accuracy. Yes, RNNs can be harder to train (stay tuned for the ULMFiT method below, which trains an RNN with much higher accuracy). Figure 8: A simple RNN with LSTM tutorial . This model achieves 85.66% accuracy (on a balanced dataset); the higher training accuracy indicates substantial overfitting. Note that this RNN was trained from scratch. A better approach is to pre-train the model on a larger dataset first, then fine-tune it on this target dataset (classically, we call this approach “transfer learning”). In the natural language processing domain, one of the most influential papers proposing this approach is ULMFiT (2018), which achieved an impressive 95.4% test accuracy on IMDb. Figure 9: Annotated figure from the ULMFiT paper. You probably know convolutional neural networks (CNNs) from their use in computer vision. However, it is also possible, although historically less common, to use them for text. Figure 10: Illustration of a convolutional neural network (CNN) to classify images. As shown in the image classification example in the figure above, CNNs apply learned filters to image patches (windows). Similarly, in the natural language domain, we can apply learned filters to windows of adjacent word embeddings. Figure 11: A CNN for text classification, step by step. Only 1 filter (channel) for simplicity. As illustrated in the figure above, a convolutional filter with a window size of three uses the same weights for each adjacent group of three words. Then, as it slides over the inputs, it moves the filter one word at a time across “the movie had surprisingly good acting”. So, this gives four windows (ignoring padding for simplicity): 1: “the movie had” 2: “movie had surprisingly” 3: “had surprisingly good” 4: “surprisingly good acting” So, in the last layer, before the classification head, we can either flatten or global max pool the results before connecting it to the classification head. While flattening preserves all information, it would produce differently sized vectors depending on the text input length. (E.g., if “the movie had surprisingly good acting” were longer, we would have longer feature maps.) So, to make it input-length agnostic, global max-pooling would be a better option here. In short, we can visualize the text CNN as shown below. Figure 12: CNN for text classification with multiple filters (channels). Also, what’s nice is that the filter computations across positions can run in parallel, which avoids the step-by-step dependency of an RNN. For a quick comparison, on the aforementioned IMDb dataset, my experiments show that such a CNN gets about 90.07% accuracy (but note that this is highly architecture-dependent; for example, you may know from computer vision contexts that accuracies can vary widely). (E.g., the good old AlexNet had a ~62.5% top-1 accuracy on ImageNet, and a ConvNeXt V2-H gets 88.9%.) Figure 13: A CNN trained to classify IMDb movie reviews; it gets 90.07% accuracy on this balanced dataset. You can find the source code here . In 2017, the original transformer architecture was introduced in the Attention Is All You Need paper. Since this topic has been covered so extensively (by me and others), I will focus on the classification-relevant aspects. But for those interested in the attention mechanism and other architecture details, please see my related articles: The key point is that the original transformer architecture was an encoder-decoder setup used for language translation, but it can be easily adapted for text classification tasks, as I’ll illustrate in the following sections. Figure 14: The original transformer architecture from Attention Is All You Need . I remember all too well the first years after the original transformer architecture release. They were pretty much defined by the rivalry between two different approaches: Encoder-style models like BERT, primarily developed by Google; Decoder-style models like GPT, primarily developed by OpenAI. Encoder-style models were natural text classifiers, whereas GPT models could do zero- and few-shot classification as an emergent property, but their strength was more in generative tasks. But let’s start with encoder-style models and how to fine-tune and use them to classify text. One universal aspect of using transformers, whether encoder- or decoder-style, is that we work with models pre-trained on large text corpora, and, in addition to using them as zero- or few-shot classifiers, we can fine-tune them on the target dataset (similar to ULMFiT, as mentioned in the RNN section earlier). As shown in the figure excerpt from the BERT paper (2018) below, BERT-/encoder-style models have a classification token at the first position that we can conveniently fine-tune for this. Figure 15: Annotated figure from the original BERT paper . While BERT models are not nearly as popular as autoregressive GPT-style transformers, thankfully some people still update and modernize them occasionally. One recent example that is often my go-to for classification tasks is the 2024 ModernBERT model. As shown below, on the IMDb movie reviews, ModernBERT gets approximately 95% accuracy with very little fine-tuning effort. Figure 16: Different LLMs fine-tuned to classify IMDb movie reviews; you can find the source code here . (I did very little hyperparameter tuning, and this can potentially be improved by 1-2% further; however, one of the points here is also that one can get really good results with pretty minimal effort.) LLMs like GPT are decoder-style, autoregressive transformers that are the center of all attention (no pun intended) for generating text and code. However, as I explained in chapter 6 of my Build A Large Language Model (From Scratch) book, as a gentle introduction to fine-tuning (before covering instruction fine-tuning), we can also repurpose these for text classification. Sure, we can also prompt an LLM directly, as shown in the screenshot below. Figure 17: Prompting an LLM to classify a movie review. However, if we want structured outputs and we have a specific target domain in mind, this is unnecessarily brittle and inefficient. Instead, we can replace the output layer with a leaner classification head, as illustrated below: Figure 18: Swapping the output layer of a GPT-style model with a leaner classification head. Now, fine-tuning has a few caveats. For instance, because of the autoregressive attention mask, we have to be careful about how we design fine-tuning so that the classification token has information about all other tokens in the sequence. Figure 19: Attention masks in BERT and GPT. If you are interested in further technical details, please see my recent end-to-end Building an AI Text Detector From Scratch article: Overall, though, the advantage of using GPT-style LLMs over e.g., BERT variants is that there are so many modern open-weight architectures out there to adopt. Anything between the small Qwen 3 0.6B models to the latest Kimi, GLM, or DeepSeek models. (Of course, using such >1B parameter models for classification could be a bit overkill from an efficiency perspective, but hey, it’s possible.) Figure 20: On the aforementioned IMDb movie review dataset, a relatively small GPT-2 124M model gets approximately 92% accuracy; a larger and newer LLM (like a recent Qwen3 variant) would likely perform better. While the original transformer architecture (an encoder-decoder) was split into two paradigms, encoder-style models like BERT and decoder-style LLMs like GPT, there were also efforts to use encoder-decoder-style variants, with the most recent variant (somewhat unexpectedly) being DeepSeek V4.1 Flash . (However, in this case, it’s a causal encoder not a bidirectional one as in T5.) Keeping the focus on encoder-decoder architectures for classification, probably the most prominent candidate is Google’s 2019 T5 (Text-to-Text Transfer Transformer) . Architecturally, the differences between T5 and the original transformer include updates to the architecture (as summarized below), as well as changes to training. The original transformer was trained to do language translation (in a supervised fashion); T5 uses pre-training on unlabeled text with span corruption, where the encoder receives text with missing spans and the decoder generates those missing spans. Figure 21: T5 architecture changes to the original transformer architecture. (The architecture drawing is taken from Attention Is All You Need .) Now, we can use T5 similar to the other RNN, CNN, and transformer approaches above, by adding a classification head. Additionally, we can also (train to) have the decoder output the class label prediction (like “positive” or “negative” in the IMDb movie review dataset case), similar to regular LLMs. Let’s call this approach text-to-text classification. While GPT-style LLMs are trained on massive amounts of text, they usually perform text-to-text classification well out of the box, as shown earlier (the figure below is inserted here again for convenience). Figure 22: Text-to-text classification with a GPT model. However, in the case of T5, it is common to further fine-tune the decoder to do well on these types of tasks in a given target domain. For T5, both approaches work. Here’s a summary: Figure 23: Classification head vs text-to-text approaches. So far, we have seen that there are plenty of approaches to text classification, from traditional methods like logistic regression and naive Bayes with bag-of-words representations to prompting the latest frontier LLMs like GPT-6 or fine-tuning any open-weight LLM with a classification head (or text-to-text classification). At first, I (almost) dismissed it as “just a classifier,” something that I build routinely for classification tasks with natural language inputs (e.g., see my AI Detector article as a recent public example). Before continuing this discussion, though, let’s start with a quick Jev overview. Jev is a new model released by TypeSafe AI , which just came out of stealth a few weeks ago and got a lot of attention (at first, it seemed a bit bizarre because it looks just like a classifier). Jev is a proprietary model (although the release was followed by a huge number of quick open-source clones, but we will get to this later) that is relatively cheap to use and claims to be on par with GPT-5.6 Luna (for decision-making) while being orders of magnitude faster and cheaper: Figure 24: Benchmark from TypeSafe AI blog . Here, regarding GPT-Luna, think of this as the text-to-text classification approach discussed earlier. So why all this hype? I think it’s partly because of the nice API and that it performs so well on all kinds of tasks, so it doesn’t require custom fine-tuning. For example, I can use it to categorize support tickets/emails (I made a video version to show the response time): Or, I can have the same model play Tetris in real-time (here, I am using the Choice API): Maybe the best way to succinctly explain it (before getting into technical details) is as follows: Like ChatGPT in 2022 was exciting because it was a general-purpose chat model that could generate all kinds of texts, one of the reasons the tech community is excited about Jev is that it is the ChatGPT moment for classification, where it can cheaply classify all kinds of text inputs without having to fine-tune a custom classifier for each task. (As of this writing, there’s not much known about the architecture and exact training algorithm, except that one of the founders said it was trained via “Reinforcement Learning for Calibrated Decisions”, but more on that later.) Over the past few years, we’ve gotten used to throwing bigger, better, and more expensive GPT-style LLMs at all kinds of problems, and for targeted decision-making or classification tasks, a cheap & fast approach like Jev may feel refreshing to most. Especially for one-off tasks where collecting training data and fine-tuning a custom ModernBERT sounds too tedious, we might just throw a Luna-like model at it. But on top of being popular for its versatility (that is, performing well on different target domains out of the box), Jev also has a relatively nice API which we can use via curl in the terminal or via its Python API. In short, there are three main API types illustrated below. Let’s start with the Choice API, which is convenient for multi-class classification. Figure 25: Jev’s Choice API. Use this for multi-class classification. Next is the Noul API, which is simpler and assigns a “yes” probability to a question. Figure 26: Jev’s Noul API. Use this for binary classification or multi-label classification (with multiple Noul questions). Lastly, the Score API assigns a score based on a rubric level (in the example below, 0, 1, 2). Figure 27: Jev’s Score API. Use this for ordinal classification. To sum it up, the different APIs and use cases are as follows. Figure 28: Jev API cheat sheet. To make these APIs more concrete, and to answer the question of how well Jev might do on the aforementioned IMDb dataset, we can run it with either the Choice or Noul API. Let’s start with the Choice API first. Each review would be formatted as follows: This Choice API is convenient if we want to use explicit labels for binary (here) or multi-class problems. An actual response might look as follows: Along with the label, we also get the confidence for this prediction, which can be really useful in real-world applications, as well as the probabilities for each class. (The confidence field summarizes how concentrated the probability distribution is. It is different from the probability assigned to the winning class.) One of the selling points of Jev is that, according to the documentation, these are well-calibrated (but more on calibration later). Alternatively, we can also use the Noul API here to classify the reviews. Using the same movie review classification context, the format would be as follows: And the answer via the Noul API is: (Interestingly, it gives 0.98 instead of 1.0 for the positive class, even though it’s the same text.) We can also apply the Noul API to multiple classes by asking one question per class, for example: “Is this article about finance?” “Is this article about politics?” “Is this article about technology?” Here, each question (independently from each other) returns a probability, and these probabilities don’t have to sum to 1. So, for a multi-class classification where each text can have multiple labels, we may prefer Noul, and for classification problems with only one final answer, Choice adds more convenience. Now, running Jev with either Choice or Noul on the 25,000 movie reviews on the test set gave the following results: Accuracy 96.47% (24,117 correct) Total runtime: 22 minutes 24 seconds 15,456,663 input tokens, $0.6492 total cost Accuracy 96.20% (24,050 correct) Total runtime: 23 minutes 3 seconds 15,106,663 input tokens, $0.6345 total cost Note that the small difference in performance and runtime between Choice and Noul could be due to random fluctuation since, similar to other LLMs, the runs are not fully deterministic. For instance, I ran the Choice API a second time over the same test set and got slightly different results, as shown below. Figure 29: Repeated Jev runs. (The non-determinism when serving LLMs and other models at scale is likely due to batch-dependent GPU kernel execution changing the order of floating-point operations, as laid out in a nice blog post by Horace He last year.) Anyways, the results look quite good overall (caveat: we don’t know if the IMDb test set was part of the training set). For reference, a ModernBERT model took 23 min to fine-tune on the training set; 7 min to evaluate on the test set. For comparison, the best ModernBERT model has similar accuracy, as shown below (I expect you can still get 1-2% higher accuracy with additional hyperparameter tuning). Note that this was run on a DGX Spark, and it’s possible to get faster inference performance with quantization and faster hardware. Figure 30: ModernBERT versus Jev. But our ModernBERT model can’t play Tetris, for example, or do anything else besides movie classification without us fine-tuning it for the new task. But we could then throw a GPT-5.6 Luna or GPT-6 Luna model at it (which is a bit slower and also more expensive). A classic rule of thumb was: Use a cheap LLM (like GPT-6 Luna) for one-off decision-making tasks; Fine-tune a custom classifier if we want to do this task repeatedly. Now, something like Jev could take the place of the above to a) reduce latency and save money over Luna and b) save us the work of fine-tuning a custom model. (Although if we have a very high-volume task and we want to maximize speed and accuracy on a very specific task, it, of course, still makes sense to fine-tune.) Of course, we could also be adding a Jev-like API on top of a (Modern)BERT or any GPT-style model. Adding a Jev-like API is pretty straightforward. In fact, as soon as Jev was released, I built a Jev-like ModernBERT model to show how simple it is to build your own Jev model. I decided not to release my Jev clone because I changed my mind in the meantime. I.e., it’s trivial to put a Jev-like API on top of ModernBERT, and it’s trivial to fine-tune it on a bunch of classification tasks. But it’s not trivial to make this model work well on all different kinds of tasks (like Tetris) without extensive training and testing. (Also, there are already enough quick Jev clones riding on the hype train by now; the world doesn’t need another quick clone, but a strong open-weight version would be nice, of course.) However, if you are interested in how that retrofitting would work, here is a quick overview. For example, we can implement a Jev-like Choice API by adding a small classification head to any BERT-, GPT-, or T5-style model as illustrated earlier. But instead of having the output nodes in this head match the number of classes, we have it with only 1 output node, as illustrated for the modified GPT model below. Figure 31: GPT model where we replace the output layer (which maps to the whole vocabulary) with an output head with only one node. Earlier, we discussed fine-tuning these models for a specific task like movie review classification with a pre-defined number of class labels (here, “positive” and “negative”). With this “1 output node” setup, we can actually extend this to a flexible and arbitrary number of classes. To extend this to an arbitrary number of classes (let’s consider the 3-class case of categorizing a customer ticket into the three categories “billing”, “technical”, “account”), we can do so as shown in the figure below. Figure 32: Using a BERT- or GPT-style model with a Jev-like choice API. As shown in the figure above, for each candidate option, we feed the model the input text, the task instructions, and the candidate’s description. The classification (scoring) head maps the output representation to a single scalar score. We then apply softmax across the candidate scores to obtain a probability distribution and return the highest-probability option. The main point here is that the proposed head has one output per class. Each class description produces its own representation, which the same head scores via the output layer (which is essentially a logistic regression model): s i is the scalar score for class label i ; w is a learnable weight; b is a learnable bias unit; h i is the output of the transformer before the classification head. For N candidates, this produces N scores. Softmax then returns N probabilities. The learned parameters and stay the same when N changes. Note that for h i : BERT-style encoder models use the final hidden state of the token (optionally passed through a pooling layer); GPT-style autoregressive models typically use the final non-padding token’s hidden state, which we need because of the autoregressive nature as discussed earlier (the last non-padding token can attend to the preceding text, instructions, and candidate description). Then, we fine-tune the model and the scoring head jointly using cross-entropy loss against the correct option. Since all candidates share the same scoring head, we can change the number and descriptions of the options without changing the architecture. But again, how well this works on unfamiliar tasks depends on the training data. By the way, why BERT- or GPT-style transformer-based models over simpler RNN and CNN architectures mentioned earlier? From a technical perspective, the approach outlined above works with either. But transformer-based models scale really well, meaning they can be pre-trained on larger datasets and benefit more than other models. Also, they can make good use of the information provided in the context (thanks to attention). So, if we want our model to generalize well to different target tasks without explicit fine-tuning on each one, pre-training a transformer-based model on a high-quality dataset likely gets us closer than RNN- or CNN-based models. So, how come Jev does so well on so many different tasks (from movie reviews to something arbitrary like playing Tetris)? Unfortunately, the architecture, algorithm, and training data details are not public. Also, keep in mind there’s a whole team and multi-million-dollar company behind it that specialized in and worked really hard on this model; we can’t expect to match that level of performance by training a ModernBERT-like model for a week on some open datasets. That being said, if I had to make an educated guess, architecture-wise, I’d guess that they are using something small similar to ModernBERT, hence, the low latency. For the training data, as mentioned before, the TypeSafe AI CEO said the following: 100% of our data is synthetic (but not the type of crap that is just spit out from an LLM obviously) So, yeah, I think most of the effort went into curating this dataset. It’s something I’ve also been preaching to students and collaborators for many years. As a short anecdote, about 8 years ago, I was collaborating with another professor in the social sciences department and helped to design the experimental setup for a text classification problem. Her student spent many days hyperparameter tuning both a bag-of-words baseline and a BERT model to eke out ~2-5% accuracy. Then I suggested we each sit down for a few days to hand-label more data (I think our original dataset was around 300 samples, and we doubled the size), which resulted in a >10-20% accuracy boost. Yes, it’s important to plot learning curves for that purpose :). Figure 33: Rule of thumb showing that often more data helps more than additional hyperparameter tuning. Finally, the training algorithm. Again, the details are not known, but TypeSafe AI’s blog post states that they were using a new algorithm called Reinforcement Learning for Calibrated Decisions (RLCD): “We built a new stack entirely focused on automation: with a new model architecture, parallel sampler for maximum efficiency, and training method we call Reinforcement Learning for Calibrated Decisions (RLCD).” This method is not public. A published method with a similar calibration objective is RLCR (Reinforcement Learning with Calibration Rewards), from the 2025 paper Beyond Binary Rewards: Training LMs to Reason About Their Uncertainty . Before providing more details, the next section gives a brief overview of calibration in general. Calibration is not a new topic and a step I recommend for any production model where you want to use and evaluate the class-membership probabilities. In short, calibration adjusts the model’s probability estimates so they better match observed class frequencies. For example, consider once more our IMDb movie classification problem. A model might assign a review 74% positive and 26% negative. These are probability estimates, but the model may be overconfident or underconfident. We cannot assume that the numerical values are reliable without evaluating calibration. I.e., predictions of 74% positive and 54% positive both yield the class label “positive” at a 50% threshold, although the model expresses more confidence in the 74% case. Figure 34: Illustration of how calibration works. Calibration techniques use a separate labeled dataset, e.g., a held-out validation set, to adjust these probability estimates. After successful calibration, among many reviews assigned a positive probability of approximately 74%, roughly 74% should actually be positive. For more information, I recommend the good old scikit-learn documentation . There are many approaches for this. For example, one that I used in my AI detector project is temperature scaling. Temperature scaling divides the model’s logits by a temperature ( T ) value before applying softmax. We learn T (a positive number) by minimizing the cross-entropy loss on the calibration dataset while keeping the model weights fixed. A temperature above 1 reduces confidence in the highest-probability class, while a temperature between 0 and 1 increases it. We then use this same temperature for new predictions. Because this scaling preserves the ordering of the logits, the predicted class remains unchanged when we select the highest-probability class. Jev’s RLCD training method remains proprietary, but a related idea we can discuss is Reinforcement Learning with Calibration Rewards (RLCR), which was introduced in the 2025 Beyond Binary Rewards: Training LMs to Reason About Their Uncertainty paper. (Note that there is no officially established connection between the two methods, but I am assuming that they could be related.) Reinforcement learning with verifiable rewards (RLVR) typically rewards a correct answer with 1 and an incorrect answer with 0. (For a comprehensive explanation and implementation, I recommend checking out my Build A Reasoning Model (From Scratch) book :)). In short, RLCR adds an additional penalty for inaccurate confidence estimates. So, in the conventional RLVR method, the reward R is either 0 or 1 based on the answer correctness (we are ignoring an optional formatting reward and length penalty here, for simplicity). In RLCR, the model generates reasoning and an answer, which is followed by an uncertainty analysis and a numerical confidence ( q ). This modified reward is where is 1 for a correct answer and 0 otherwise. For example, an incorrect answer with 90% (0.9) confidence receives a reward of -0.81, since At 20% confidence, the reward is -0.04. And a correct answer at 90% confidence earns 0.99. (Readers familiar with evaluating calibrated models may notice that the squared-error term is the Brier penalty for the stated probability that the answer is correct.) Figure 35: RLCR overview. Note that the same (here, Qwen2.5-7B) model generates the uncertainty analysis and q as part of its response. The uncertainty analysis is a written assessment of where its answer could be wrong. After answering, the model examines missing evidence, ambiguous wording, questionable assumptions, or possible reasoning errors. The paper’s prompt asks it to identify specific uncertainties rather than propose corrections. Also, the system prompt explicitly asks for q , a number between 0 and 1 inside tags. It represents the model’s estimated probability that its answer is correct. The system generates all these parts sequentially in the same response. For illustration purposes, the model answer could be as follows: Below is an annotated figure from the paper that illustrates how it improves the expected calibration error over regular RLVR with temperature scaling. On HotpotQA, RLCR reduces expected calibration error (ECE) from 0.37 to 0.03 compared with RLVR, with similar accuracy (62.1% versus 63.0%). Across six other datasets, average ECE falls from 0.46 to 0.21, while accuracy rises from 53.9% to 56.2%. These are the results in the paper’s Table 1(a). Figure 36: RLCR results from the Beyond Binary Rewards: Training LMs to Reason About Their Uncertainty paper. Conceptually, the “Classifier” in “RLVR + Classifier” is a supervised binary classifier that predicts whether the generated answer is correct. For Jev, I could apply calibration rewards directly to typed decisions, without generating reasoning text. For example, we could equip a GPT-style model with the classification head illustrated in Section 2.2 and adapt the RL training objective to reward accurate decisions and calibrated probabilities. We would train the backbone and classification head together. This would be an adaptation inspired by RLCR, and it remains unclear whether Jev’s RLCD works this way. Alternatively, since Direct Policy Optimization (DPO) is a cross-entropy (CE) alternative to Reinforcement Learning with Human Feedback (RLHF), we could also directly minimize CE + Brier loss on the classifier’s probabilities. I did this with the ModernBERT model, and there was a modest improvement over regular temperature scaling. Figure 37: ModernBERT improvements via RLCR-inspired Brier-loss optimization. The ↑ symbol means higher is better. The ↓ symbol means lower is better. 5.3 Side note: Is calibration necessary? Cross-entropy already encourages accurate probability estimates. Under ideal conditions, that is enough to obtain calibrated predictions without an additional penalty. I.e., using a simple coin flip example analogous to the movie review classification, the two classes are “heads” and “tails.” If it’s a biased coin that lands heads 80% of the time (in expectation), the true probabilities are 80% heads and 20% tails. On a representative training set, when we optimize cross-entropy, the model will already learn these as a side-effect of minimizing cross-entropy (negative-log-likelihood). So, in short, if the model learns the true class probabilities, its predictions are calibrated and an additional penalty is unnecessary. (And Brier loss has the same theoretical optimum as cross-entropy, as described in Strictly Proper Scoring Rules, Prediction, and Estimation by Gneiting and Raftery, 2007.) In practice, however, we never train to the real optimum (in expectation) but train on a finite dataset. So, once a neural network correctly classifies most training examples, it can further reduce cross-entropy on the training set by becoming more confident. These confidence estimates may then generalize poorly to the test set and new data. For example, in On Calibration of Modern Neural Networks , Guo et al. (2017) observed “neural networks can overfit to NLL without overfitting to the 0/1 loss.” That means test accuracy can still improve while test cross-entropy worsens. So overfitting can show up in the probability estimates even when classification accuracy continues to improve. Adding Brier loss changes how prediction errors are weighted during training. But whether this improves calibration needs to be checked on held-out data, of course. (The modest improvement in my experiment is an empirical observation for this setup, and we should not assume that adding Brier will always help.) In my experiments (see previous figure), adding the Brier loss to cross-entropy provided only a very small additional calibration benefit. But the motivation is more direct in RL contexts, such as described in RLCR, where we measure answer correctness and don’t already minimize cross-entropy. So, in RL contexts, the Brier term adds an incentive to report accurate confidence alongside the reward for answer correctness. Now that we covered Jev in reasonable detail, who is Jev for? Based on my assessment, it’s a pretty big target audience that intersects between people who a) want to save time by not having to fine-tune a custom classifier for every decision task and b) want to save money over using “the big guns” like GPT-6 and similar LLMs. There are also lots of interesting use cases to think of. In the section below is a short list of ideas. The list of use cases is seemingly endless. Sure, there are flashy examples like having it play video games like Tetris (as I showed in my earlier video above to demonstrate the low latency of the API). However, sorting emails is a more practical choice for most. For example, one could use Jev as an additional spam filter, prioritization, and so on. But beyond things like that, it could also serve as a tool to augment LLM-agent harnesses. Here it could be used as a pre-screener for regular LLM-agent harnesses to scan our contexts for prompt injection; select the reasoning effort level for a model; select a skill.md from your registered skill library; use it as a judge for evaluation or self-refinement; find relevant files for context building. The list is practically endless. Someone even posted a survey on arXiv analyzing 2,170 Jev-related projects that have sprung up recently in just a few days. Since Jev’s launch, 100s, if not 1000s, of quick Jev clones have sprung up. Most of the ones I checked out were just quick examples fine-tuning a ModernBERT or Qwen model with SFT and adding a Jev-like API. Based on what I can tell, none of them achieves the same level of performance as Jev on such a breadth of tasks. Comparing these projects to Jev is like comparing Alpaca (the early instruction-finetuned LLM based off of the original LLaMA open-weight model) to GPT-6. Sure, it may work similarly in spirit, but your mileage will vary on real-world tasks. No offense, but they seem like quick projects to jump on the hype train, and I don’t want to plug a specific one here. One exception here might be the GLiNER project, which has been around for ~3 years ago, and while it’s not fundamentally the same, it can be used for similar things. However, based on a benchmark , Jev is definitely stronger. Figure 38: GLiNER vs Jev comparison via https://github.com/AbdelStark/jev-benchmarks/blob/main/results/reports/btzsc-pilot-v1.md Anyways, there is definitely a genuine need and desire for a good open-weight alternative to Jev. The reason is not necessarily cost (because Jev is so cheap) but privacy. (Also, if Jev is already that fast over the internet, imagine how fast it could be on beefy local hardware.) So, of course I’d like a DeepSeek (or Kimi, or GLM, or MiMo) moment for Jev. I am sure people are working on this, but it will take some time. TypeSafe AI worked on this for many months with a dedicated team of experts. It’s unrealistic to expect to replicate that development and evaluation work in a week. (However, since this is a smaller and more efficient model than a 1-trillion-parameter model, by nature, it hopefully won’t take that long.) Update 1 (29 September, 10:20 am PT): OpenAI just announced the Decision API at their DevDay 2026 conference (29 September). It appears to be a Jev-like model directly integrated into their platform. Decisions API enables real-time decision-making by focusing Luna’s intelligence on a specific set of user-defined questions with finite pre-defined answers. Developers supply context using text or images, and get back answers they can use to classify content, route requests, or choose an agent’s next action. Available in limited preview today with a broad release planned in the coming days. Figure 39: OpenAI’s Jev-like Decision API announced at the OpenAI Dev Day. Update 2: A reader shared the Contrastive Language Models project with me in the comments below. It’s one of the nicer-looking Jev-likes. When I tried it, its IMDb test accuracy is just 82.90% (over 96.47% in Jev), and it fails the Tetris test . Another reader wrote in about Laya , another strong contender. It did better at IMDb (92.33% test accuracy) but then failed the Tetris test even worse. So, my point still stands. There are many solid alternatives. But what makes Jev so popular is not a unique idea (as mentioned before, classifiers existed for a long time) but the fact that it performs so well at so many diverse tasks. The only task where it allegedly doesn’t do well (as a reader told me) is legal reviews in non-English languages. (But the weak multilingual performance can be circumvented by connecting it to a cheap translation model, e.g., GPT -6 Luna with a small latency overhead.) All in all, at first glance, Jev doesn’t seem to offer anything fundamentally new. After all, one might say that “it’s just a classifier” (with a nice API on top of it). However, it works surprisingly well across a huge range of tasks. In that sense, it’s the plug-and-play version of dedicated classifiers. Sure, experts will still fine-tune specialist models, but the bar to justify fine-tuning a specialized model is now much higher, since it’s easy to just throw a Jev or Jev-like at it and get good-enough results. Also, I don’t expect Jev and Jev-likes to unlock new capabilities or solve previously unsolvable tasks. However, if we make such models part of our agent harnesses to aid the expensive GPT-6 or Opus 5.5 models in decision-making within that harness, using agent harnesses could become much faster and cheaper in the future. If you found this article useful, consider becoming a paid subscriber to Ahead of AI. Your support helps me spend more time on the experiments and detailed illustrations behind articles like this. You can also support my work through my books, Build a Large Language Model (From Scratch) and Build a Reasoning Model (From Scratch) , if you’d like to implement these concepts yourself. Thanks for reading and supporting my independent research! Figure 1: Quick overview of the Jev API; more details on that later. Sure, the latest state-of-the-art GPT and open-weight LLMs can do the same kinds of classification tasks as Jev, while also being capable of much more general decision-making. But Jev’s advantage is that it can handle those classification tasks much faster and more cheaply. At the other end of the spectrum, for a narrow, well-defined problem, Jev probably won’t classify anything better, faster, or cheaper than a special-purpose classifier. But its selling point is that it is far more general than those task-specific models. So, what is the methodology behind Jev (based on an educated guess), what can it do, and why is it so popular? I aim to answer all of these later in this article. However, I thought starting with a brief history of language models for decision-making would be a great way to begin. And it hopefully helps demystify some of the hype and show what Jev does very well (”Jev is essentially a text classifier,” but “Jev is also not ‘just’ a text classifier.”) PS: I am not affiliated with Jev in any way. Also, I am not offered free access to Jev, and this is also not a product endorsement, just a technical article to offer some insights into the history of text classification to help you make sense of the recent hype. Since this is a long article, I recommend reading it in your browser , where you can access the table of contents menu on the left side. 1. Language modeling and classification in the pre-transformer era For completeness, before we put Jev in context (no pun intended), I thought it made the most sense to start chronologically. In this section, I want to take a brief tour of applied text classification via naive Bayes, logistic regression, and the more classic (deep) neural networks before transformer-based models came along. 1.1 Bag-of-words: naive Bayes, logistic regression, and XGBoost Back in the day, when I was a grad student 15 years ago, even though recurrent neural networks already existed (more on that later), text classification was usually done with a bag-of-words representation because it was straightforward and could get good results on moderately sized datasets. In short, we can think of the bag-of-words representation as a method that makes free-form text input of different lengths compatible with classic classifiers (naive Bayes, Logistic Regression, SVMs, Random Forest, XGBoost, to name a few), which expect a fixed-size input vector. Popular real-world applications include anything from news article classification to email spam filtering. And yes, allegedly even Gmail’s original spam filter used a Naive Bayes model with a bag-of-words representation. As a side note, I wrote about this approach exactly 12 years ago. It was one of the first things I shared on arXiv. Figure 2: An old tutorial of mine from 2014 that explains naive Bayes classifiers using a bag-of-words model. So, what exactly is this bag-of-words representation? It’s a way to convert free-form texts with different lengths, e.g., Training example 1: “Zentropa is the most original movie I’ve seen in years. If you like unique thrillers that are influenced by film noir, then this is just the right cure for all of those Hollywood summer blockbusters clogging the theaters these days. Von Trier’s follow-ups like Breaking the Waves have gotten more acclaim, but this is really his best work.” Training example 2: “This film is just plain horrible. John Ritter doing pratt falls, 75% of the actors delivering their lines as if they were reading them from cue cards, poor editing, horrible sound mixing” Training example 3: “Zentropa has much in common with The Third Man, another noir-like film set among the rubble of postwar Europe.” Figure 3: An illustration of a bag-of-words representation. A bag-of-words model starts by building the vocabulary, which consists of all unique words in the training set (optionally, one can get rid of so-called stopwords like “a” and “the”, which are words that carry little to no semantic meaning in most contexts). A bag-of-words representation results in these fixed-size inputs by assigning each word in a vocabulary its own position in a vector. We then count how often each word occurs in a document. For example, if we have a vocabulary of 50,000 unique words, it produces a fixed-size vector with 50,000 entries, regardless of whether the input consists of only ten words or 300k words. Note that most entries are zero because each document contains only a small subset of the vocabulary. (Instead of representing the raw counts, there are also normalization schemes like TF-IDF.) Then, once we have these word frequency vectors, we can train a classifier on a labeled training set, such as emails labeled as spam or non-spam. For example, a logistic regression model would then learn feature weights that correlate certain words (and word counts) with particular labels. For instance, certain words might increase the predicted spam probability, and others may decrease it. This approach is computationally cheap and can work well when particular words provide strong clues about the label. In a simple classification task such as spam classification, this is often enough to get quick, reasonably accurate results. But one of the biggest downsides of this approach is that, because of the nature of the bag-of-words representation, it loses word order. So, for example, “the dog bites the man” and “the man bites the dog” produce identical vectors despite describing different events. (There are some workarounds to preserve some local order by adding word pairs or longer sequences, called n-grams, as features, although this increases the vocabulary size.) Despite the shortcomings, I still think that a bag-of-words has its place in certain low-stakes applications because it’s so cheap, and a bag-of-words representation + logistic regression remains my go-to baseline for every text classification problem, since it’s so easy to implement. Figure 4: For those interested in building a simple logistic regression classifier, I have a tutorial up here . This model achieves 89.9% accuracy (on a balanced dataset). 1.2 Deep neural networks for text classification The aforementioned bag-of-words model would also work with (simple) deep neural networks, like multilayer perceptrons. But the downside still is that we would lose the sentence structure and word order. However, more sophisticated neural network architectures avoid the bag-of-words workaround: convolutional neural networks (CNNs) and recurrent neural networks (RNNs), which can take word embeddings as input. 1.2.1 Word embeddings First, before feeding the input texts into a model, we have to convert them into a suitable representation. One such representation is bag-of-words. Another is word embedding vectors. The difference is that a bag-of-words vector represents the entire text by counting how often each vocabulary word occurs, while a word embedding represents an individual word as a dense vector of learned numbers. Figure 5: Illustration of creating word embeddings. Word embeddings work similarly to embedding layers in LLMs, i.e., they convert input tokens into dense vectors. Embeddings can happen outside the model (e.g., two classic, popular methods for learning them are Word2Vec and GloVe ), or the embedding layer can be part of the neural network architecture itself and be learned and tuned during model training. These classic embeddings are context-independent at lookup time. The word “bank”, for example, gets the same vector in “river bank” and “bank account” (as you may know, context can be handled via concepts like attention). For additional resources on embeddings, you may find the following ones helpful: Chapter 2: Working with Text Data (this is an LLM chapter but should give you the gist of embedding words or tokens; in LLM tokenizers, we split words into subword tokens; in Word2Vec, 1 word is usually 1 token.) Understanding the Difference Between Embedding Layers and Linear Layers (this is an illustration that shows when embedding vectors are mathematically equivalent to Linear layers and matrix multiplications.) Figure 6: Illustration of an RNN classifier. Note that the figure above shows the RNN in the unrolled representation. I.e., the RNN reuses the same layer stack for each input, hence the term “recurrent”. And since it’s “recurrent”, the input text can have an arbitrary length. The figure below illustrates the “recurrence” with the unrolled representation side by side. Note that both show the identical architecture, it’s just a different visualization. Figure 7: Rolled and unrolled illustration of the same RNN. RNNs were notoriously hard to train, and there are important improvements to RNNs, like Long short-term memory (LSTM) networks, introduced in 1997, and gated recurrent units (GRUs), introduced in 2014, which use learned gates to control how information is retained and updated. (There is also the more recent xLSTM: Extended long short-term memory , introduced in 2024). Also, state-space models are inspired by this idea of a fixed-size hidden state updated sequentially, which is cheaper than transformer attention. However, the bottleneck is still how much information the hidden state can retain, and it still has to be processed sequentially. (Fun fact: attention was first developed for RNNs before the transformer architecture came along, but it’s a story for another time; I’ve written about it in my Understanding Large Language Models article.) The bottom line is that RNNs can be used to train text classifiers. Coming back to the IMDb movie review dataset, the bag-of-words classifier with logistic regression achieved about 89.9% accuracy (on a balanced dataset), while an LSTM RNN achieved only 85.66% accuracy. Yes, RNNs can be harder to train (stay tuned for the ULMFiT method below, which trains an RNN with much higher accuracy). Figure 8: A simple RNN with LSTM tutorial . This model achieves 85.66% accuracy (on a balanced dataset); the higher training accuracy indicates substantial overfitting. Note that this RNN was trained from scratch. A better approach is to pre-train the model on a larger dataset first, then fine-tune it on this target dataset (classically, we call this approach “transfer learning”). In the natural language processing domain, one of the most influential papers proposing this approach is ULMFiT (2018), which achieved an impressive 95.4% test accuracy on IMDb. Figure 9: Annotated figure from the ULMFiT paper. 1.2.3 Convolutional neural networks (CNNs) You probably know convolutional neural networks (CNNs) from their use in computer vision. However, it is also possible, although historically less common, to use them for text. Figure 10: Illustration of a convolutional neural network (CNN) to classify images. As shown in the image classification example in the figure above, CNNs apply learned filters to image patches (windows). Similarly, in the natural language domain, we can apply learned filters to windows of adjacent word embeddings. Figure 11: A CNN for text classification, step by step. Only 1 filter (channel) for simplicity. As illustrated in the figure above, a convolutional filter with a window size of three uses the same weights for each adjacent group of three words. Then, as it slides over the inputs, it moves the filter one word at a time across “the movie had surprisingly good acting”. So, this gives four windows (ignoring padding for simplicity): 1: “the movie had” 2: “movie had surprisingly” 3: “had surprisingly good” 4: “surprisingly good acting” Figure 12: CNN for text classification with multiple filters (channels). Also, what’s nice is that the filter computations across positions can run in parallel, which avoids the step-by-step dependency of an RNN. For a quick comparison, on the aforementioned IMDb dataset, my experiments show that such a CNN gets about 90.07% accuracy (but note that this is highly architecture-dependent; for example, you may know from computer vision contexts that accuracies can vary widely). (E.g., the good old AlexNet had a ~62.5% top-1 accuracy on ImageNet, and a ConvNeXt V2-H gets 88.9%.) Figure 13: A CNN trained to classify IMDb movie reviews; it gets 90.07% accuracy on this balanced dataset. You can find the source code here . 2. Transformers In 2017, the original transformer architecture was introduced in the Attention Is All You Need paper. Since this topic has been covered so extensively (by me and others), I will focus on the classification-relevant aspects. But for those interested in the attention mechanism and other architecture details, please see my related articles: The key point is that the original transformer architecture was an encoder-decoder setup used for language translation, but it can be easily adapted for text classification tasks, as I’ll illustrate in the following sections. Figure 14: The original transformer architecture from Attention Is All You Need . 2.1 Encoder-style language models I remember all too well the first years after the original transformer architecture release. They were pretty much defined by the rivalry between two different approaches: Encoder-style models like BERT, primarily developed by Google; Decoder-style models like GPT, primarily developed by OpenAI. Figure 15: Annotated figure from the original BERT paper . While BERT models are not nearly as popular as autoregressive GPT-style transformers, thankfully some people still update and modernize them occasionally. One recent example that is often my go-to for classification tasks is the 2024 ModernBERT model. As shown below, on the IMDb movie reviews, ModernBERT gets approximately 95% accuracy with very little fine-tuning effort. Figure 16: Different LLMs fine-tuned to classify IMDb movie reviews; you can find the source code here . (I did very little hyperparameter tuning, and this can potentially be improved by 1-2% further; however, one of the points here is also that one can get really good results with pretty minimal effort.) 2.2 Decoder-style LLMs LLMs like GPT are decoder-style, autoregressive transformers that are the center of all attention (no pun intended) for generating text and code. However, as I explained in chapter 6 of my Build A Large Language Model (From Scratch) book, as a gentle introduction to fine-tuning (before covering instruction fine-tuning), we can also repurpose these for text classification. Sure, we can also prompt an LLM directly, as shown in the screenshot below. Figure 17: Prompting an LLM to classify a movie review. However, if we want structured outputs and we have a specific target domain in mind, this is unnecessarily brittle and inefficient. Instead, we can replace the output layer with a leaner classification head, as illustrated below: Figure 18: Swapping the output layer of a GPT-style model with a leaner classification head. Now, fine-tuning has a few caveats. For instance, because of the autoregressive attention mask, we have to be careful about how we design fine-tuning so that the classification token has information about all other tokens in the sequence. Figure 19: Attention masks in BERT and GPT. If you are interested in further technical details, please see my recent end-to-end Building an AI Text Detector From Scratch article: Overall, though, the advantage of using GPT-style LLMs over e.g., BERT variants is that there are so many modern open-weight architectures out there to adopt. Anything between the small Qwen 3 0.6B models to the latest Kimi, GLM, or DeepSeek models. (Of course, using such >1B parameter models for classification could be a bit overkill from an efficiency perspective, but hey, it’s possible.) Figure 20: On the aforementioned IMDb movie review dataset, a relatively small GPT-2 124M model gets approximately 92% accuracy; a larger and newer LLM (like a recent Qwen3 variant) would likely perform better. 2.3 Encoder-decoder style architectures While the original transformer architecture (an encoder-decoder) was split into two paradigms, encoder-style models like BERT and decoder-style LLMs like GPT, there were also efforts to use encoder-decoder-style variants, with the most recent variant (somewhat unexpectedly) being DeepSeek V4.1 Flash . (However, in this case, it’s a causal encoder not a bidirectional one as in T5.) Keeping the focus on encoder-decoder architectures for classification, probably the most prominent candidate is Google’s 2019 T5 (Text-to-Text Transfer Transformer) . Architecturally, the differences between T5 and the original transformer include updates to the architecture (as summarized below), as well as changes to training. The original transformer was trained to do language translation (in a supervised fashion); T5 uses pre-training on unlabeled text with span corruption, where the encoder receives text with missing spans and the decoder generates those missing spans. Figure 21: T5 architecture changes to the original transformer architecture. (The architecture drawing is taken from Attention Is All You Need .) Now, we can use T5 similar to the other RNN, CNN, and transformer approaches above, by adding a classification head. Additionally, we can also (train to) have the decoder output the class label prediction (like “positive” or “negative” in the IMDb movie review dataset case), similar to regular LLMs. Let’s call this approach text-to-text classification. While GPT-style LLMs are trained on massive amounts of text, they usually perform text-to-text classification well out of the box, as shown earlier (the figure below is inserted here again for convenience). Figure 22: Text-to-text classification with a GPT model. However, in the case of T5, it is common to further fine-tune the decoder to do well on these types of tasks in a given target domain. For T5, both approaches work. Here’s a summary: Figure 23: Classification head vs text-to-text approaches. 3. Jev overview So far, we have seen that there are plenty of approaches to text classification, from traditional methods like logistic regression and naive Bayes with bag-of-words representations to prompting the latest frontier LLMs like GPT-6 or fine-tuning any open-weight LLM with a classification head (or text-to-text classification). At first, I (almost) dismissed it as “just a classifier,” something that I build routinely for classification tasks with natural language inputs (e.g., see my AI Detector article as a recent public example). 3.1 Jev vs existing text-to-text classification Before continuing this discussion, though, let’s start with a quick Jev overview. Jev is a new model released by TypeSafe AI , which just came out of stealth a few weeks ago and got a lot of attention (at first, it seemed a bit bizarre because it looks just like a classifier). Jev is a proprietary model (although the release was followed by a huge number of quick open-source clones, but we will get to this later) that is relatively cheap to use and claims to be on par with GPT-5.6 Luna (for decision-making) while being orders of magnitude faster and cheaper: Figure 24: Benchmark from TypeSafe AI blog . Here, regarding GPT-Luna, think of this as the text-to-text classification approach discussed earlier. So why all this hype? I think it’s partly because of the nice API and that it performs so well on all kinds of tasks, so it doesn’t require custom fine-tuning. For example, I can use it to categorize support tickets/emails (I made a video version to show the response time): Or, I can have the same model play Tetris in real-time (here, I am using the Choice API): Maybe the best way to succinctly explain it (before getting into technical details) is as follows: Like ChatGPT in 2022 was exciting because it was a general-purpose chat model that could generate all kinds of texts, one of the reasons the tech community is excited about Jev is that it is the ChatGPT moment for classification, where it can cheaply classify all kinds of text inputs without having to fine-tune a custom classifier for each task. (As of this writing, there’s not much known about the architecture and exact training algorithm, except that one of the founders said it was trained via “Reinforcement Learning for Calibrated Decisions”, but more on that later.) 3.2 The Jev API Over the past few years, we’ve gotten used to throwing bigger, better, and more expensive GPT-style LLMs at all kinds of problems, and for targeted decision-making or classification tasks, a cheap & fast approach like Jev may feel refreshing to most. Especially for one-off tasks where collecting training data and fine-tuning a custom ModernBERT sounds too tedious, we might just throw a Luna-like model at it. But on top of being popular for its versatility (that is, performing well on different target domains out of the box), Jev also has a relatively nice API which we can use via curl in the terminal or via its Python API. In short, there are three main API types illustrated below. Let’s start with the Choice API, which is convenient for multi-class classification. Figure 25: Jev’s Choice API. Use this for multi-class classification. Next is the Noul API, which is simpler and assigns a “yes” probability to a question. Figure 26: Jev’s Noul API. Use this for binary classification or multi-label classification (with multiple Noul questions). Lastly, the Score API assigns a score based on a rubric level (in the example below, 0, 1, 2). Figure 27: Jev’s Score API. Use this for ordinal classification. To sum it up, the different APIs and use cases are as follows. Figure 28: Jev API cheat sheet. 3.3 Jev classifying IMDb To make these APIs more concrete, and to answer the question of how well Jev might do on the aforementioned IMDb dataset, we can run it with either the Choice or Noul API. Let’s start with the Choice API first. Each review would be formatted as follows: This Choice API is convenient if we want to use explicit labels for binary (here) or multi-class problems. An actual response might look as follows: Along with the label, we also get the confidence for this prediction, which can be really useful in real-world applications, as well as the probabilities for each class. (The confidence field summarizes how concentrated the probability distribution is. It is different from the probability assigned to the winning class.) One of the selling points of Jev is that, according to the documentation, these are well-calibrated (but more on calibration later). Alternatively, we can also use the Noul API here to classify the reviews. Using the same movie review classification context, the format would be as follows: And the answer via the Noul API is: (Interestingly, it gives 0.98 instead of 1.0 for the positive class, even though it’s the same text.) We can also apply the Noul API to multiple classes by asking one question per class, for example: “Is this article about finance?” “Is this article about politics?” “Is this article about technology?” Choice: Accuracy 96.47% (24,117 correct) Total runtime: 22 minutes 24 seconds 15,456,663 input tokens, $0.6492 total cost Noul: Accuracy 96.20% (24,050 correct) Total runtime: 23 minutes 3 seconds 15,106,663 input tokens, $0.6345 total cost 23 min to fine-tune on the training set; 7 min to evaluate on the test set. Figure 30: ModernBERT versus Jev. But our ModernBERT model can’t play Tetris, for example, or do anything else besides movie classification without us fine-tuning it for the new task. But we could then throw a GPT-5.6 Luna or GPT-6 Luna model at it (which is a bit slower and also more expensive). A classic rule of thumb was: Use a cheap LLM (like GPT-6 Luna) for one-off decision-making tasks; Fine-tune a custom classifier if we want to do this task repeatedly. Figure 31: GPT model where we replace the output layer (which maps to the whole vocabulary) with an output head with only one node. Earlier, we discussed fine-tuning these models for a specific task like movie review classification with a pre-defined number of class labels (here, “positive” and “negative”). With this “1 output node” setup, we can actually extend this to a flexible and arbitrary number of classes. To extend this to an arbitrary number of classes (let’s consider the 3-class case of categorizing a customer ticket into the three categories “billing”, “technical”, “account”), we can do so as shown in the figure below. Figure 32: Using a BERT- or GPT-style model with a Jev-like choice API. As shown in the figure above, for each candidate option, we feed the model the input text, the task instructions, and the candidate’s description. The classification (scoring) head maps the output representation to a single scalar score. We then apply softmax across the candidate scores to obtain a probability distribution and return the highest-probability option. The main point here is that the proposed head has one output per class. Each class description produces its own representation, which the same head scores via the output layer (which is essentially a logistic regression model): where s i is the scalar score for class label i ; w is a learnable weight; b is a learnable bias unit; h i is the output of the transformer before the classification head. BERT-style encoder models use the final hidden state of the token (optionally passed through a pooling layer); GPT-style autoregressive models typically use the final non-padding token’s hidden state, which we need because of the autoregressive nature as discussed earlier (the last non-padding token can attend to the preceding text, instructions, and candidate description). Figure 33: Rule of thumb showing that often more data helps more than additional hyperparameter tuning. Finally, the training algorithm. Again, the details are not known, but TypeSafe AI’s blog post states that they were using a new algorithm called Reinforcement Learning for Calibrated Decisions (RLCD): “We built a new stack entirely focused on automation: with a new model architecture, parallel sampler for maximum efficiency, and training method we call Reinforcement Learning for Calibrated Decisions (RLCD).” This method is not public. A published method with a similar calibration objective is RLCR (Reinforcement Learning with Calibration Rewards), from the 2025 paper Beyond Binary Rewards: Training LMs to Reason About Their Uncertainty . Before providing more details, the next section gives a brief overview of calibration in general. 5.1 On calibration Calibration is not a new topic and a step I recommend for any production model where you want to use and evaluate the class-membership probabilities. In short, calibration adjusts the model’s probability estimates so they better match observed class frequencies. For example, consider once more our IMDb movie classification problem. A model might assign a review 74% positive and 26% negative. These are probability estimates, but the model may be overconfident or underconfident. We cannot assume that the numerical values are reliable without evaluating calibration. I.e., predictions of 74% positive and 54% positive both yield the class label “positive” at a 50% threshold, although the model expresses more confidence in the 74% case. Figure 34: Illustration of how calibration works. Calibration techniques use a separate labeled dataset, e.g., a held-out validation set, to adjust these probability estimates. After successful calibration, among many reviews assigned a positive probability of approximately 74%, roughly 74% should actually be positive. For more information, I recommend the good old scikit-learn documentation . There are many approaches for this. For example, one that I used in my AI detector project is temperature scaling. Temperature scaling divides the model’s logits by a temperature ( T ) value before applying softmax. We learn T (a positive number) by minimizing the cross-entropy loss on the calibration dataset while keeping the model weights fixed. A temperature above 1 reduces confidence in the highest-probability class, while a temperature between 0 and 1 increases it. We then use this same temperature for new predictions. Because this scaling preserves the ordering of the logits, the predicted class remains unchanged when we select the highest-probability class. 5.2 Reinforcement learning with calibration rewards (RLCR) Jev’s RLCD training method remains proprietary, but a related idea we can discuss is Reinforcement Learning with Calibration Rewards (RLCR), which was introduced in the 2025 Beyond Binary Rewards: Training LMs to Reason About Their Uncertainty paper. (Note that there is no officially established connection between the two methods, but I am assuming that they could be related.) Reinforcement learning with verifiable rewards (RLVR) typically rewards a correct answer with 1 and an incorrect answer with 0. (For a comprehensive explanation and implementation, I recommend checking out my Build A Reasoning Model (From Scratch) book :)). In short, RLCR adds an additional penalty for inaccurate confidence estimates. So, in the conventional RLVR method, the reward R is either 0 or 1 based on the answer correctness (we are ignoring an optional formatting reward and length penalty here, for simplicity). In RLCR, the model generates reasoning and an answer, which is followed by an uncertainty analysis and a numerical confidence ( q ). This modified reward is where is 1 for a correct answer and 0 otherwise. For example, an incorrect answer with 90% (0.9) confidence receives a reward of -0.81, since At 20% confidence, the reward is -0.04. And a correct answer at 90% confidence earns 0.99. (Readers familiar with evaluating calibrated models may notice that the squared-error term is the Brier penalty for the stated probability that the answer is correct.) Figure 35: RLCR overview. Note that the same (here, Qwen2.5-7B) model generates the uncertainty analysis and q as part of its response. The uncertainty analysis is a written assessment of where its answer could be wrong. After answering, the model examines missing evidence, ambiguous wording, questionable assumptions, or possible reasoning errors. The paper’s prompt asks it to identify specific uncertainties rather than propose corrections. Also, the system prompt explicitly asks for q , a number between 0 and 1 inside tags. It represents the model’s estimated probability that its answer is correct. The system generates all these parts sequentially in the same response. For illustration purposes, the model answer could be as follows: Below is an annotated figure from the paper that illustrates how it improves the expected calibration error over regular RLVR with temperature scaling. On HotpotQA, RLCR reduces expected calibration error (ECE) from 0.37 to 0.03 compared with RLVR, with similar accuracy (62.1% versus 63.0%). Across six other datasets, average ECE falls from 0.46 to 0.21, while accuracy rises from 53.9% to 56.2%. These are the results in the paper’s Table 1(a). Figure 36: RLCR results from the Beyond Binary Rewards: Training LMs to Reason About Their Uncertainty paper. Conceptually, the “Classifier” in “RLVR + Classifier” is a supervised binary classifier that predicts whether the generated answer is correct. For Jev, I could apply calibration rewards directly to typed decisions, without generating reasoning text. For example, we could equip a GPT-style model with the classification head illustrated in Section 2.2 and adapt the RL training objective to reward accurate decisions and calibrated probabilities. We would train the backbone and classification head together. This would be an adaptation inspired by RLCR, and it remains unclear whether Jev’s RLCD works this way. Alternatively, since Direct Policy Optimization (DPO) is a cross-entropy (CE) alternative to Reinforcement Learning with Human Feedback (RLHF), we could also directly minimize CE + Brier loss on the classifier’s probabilities. I did this with the ModernBERT model, and there was a modest improvement over regular temperature scaling. Figure 37: ModernBERT improvements via RLCR-inspired Brier-loss optimization. The ↑ symbol means higher is better. The ↓ symbol means lower is better. 5.3 Side note: Is calibration necessary? Cross-entropy already encourages accurate probability estimates. Under ideal conditions, that is enough to obtain calibrated predictions without an additional penalty. I.e., using a simple coin flip example analogous to the movie review classification, the two classes are “heads” and “tails.” If it’s a biased coin that lands heads 80% of the time (in expectation), the true probabilities are 80% heads and 20% tails. On a representative training set, when we optimize cross-entropy, the model will already learn these as a side-effect of minimizing cross-entropy (negative-log-likelihood). So, in short, if the model learns the true class probabilities, its predictions are calibrated and an additional penalty is unnecessary. (And Brier loss has the same theoretical optimum as cross-entropy, as described in Strictly Proper Scoring Rules, Prediction, and Estimation by Gneiting and Raftery, 2007.) In practice, however, we never train to the real optimum (in expectation) but train on a finite dataset. So, once a neural network correctly classifies most training examples, it can further reduce cross-entropy on the training set by becoming more confident. These confidence estimates may then generalize poorly to the test set and new data. For example, in On Calibration of Modern Neural Networks , Guo et al. (2017) observed “neural networks can overfit to NLL without overfitting to the 0/1 loss.” That means test accuracy can still improve while test cross-entropy worsens. So overfitting can show up in the probability estimates even when classification accuracy continues to improve. Adding Brier loss changes how prediction errors are weighted during training. But whether this improves calibration needs to be checked on held-out data, of course. (The modest improvement in my experiment is an empirical observation for this setup, and we should not assume that adding Brier will always help.) In my experiments (see previous figure), adding the Brier loss to cross-entropy provided only a very small additional calibration benefit. But the motivation is more direct in RL contexts, such as described in RLCR, where we measure answer correctness and don’t already minimize cross-entropy. So, in RL contexts, the Brier term adds an incentive to report accurate confidence alongside the reward for answer correctness. 6. Who is Jev for? Now that we covered Jev in reasonable detail, who is Jev for? Based on my assessment, it’s a pretty big target audience that intersects between people who a) want to save time by not having to fine-tune a custom classifier for every decision task and b) want to save money over using “the big guns” like GPT-6 and similar LLMs. There are also lots of interesting use cases to think of. In the section below is a short list of ideas. 6.1 Jev use cases The list of use cases is seemingly endless. Sure, there are flashy examples like having it play video games like Tetris (as I showed in my earlier video above to demonstrate the low latency of the API). However, sorting emails is a more practical choice for most. For example, one could use Jev as an additional spam filter, prioritization, and so on. But beyond things like that, it could also serve as a tool to augment LLM-agent harnesses. Here it could be used as a pre-screener for regular LLM-agent harnesses to scan our contexts for prompt injection; select the reasoning effort level for a model; select a skill.md from your registered skill library; use it as a judge for evaluation or self-refinement; find relevant files for context building.

0 views
Unsung 2 months ago

“First, don’t interfere with user input.”

In response to a previous post , one of the readers wrote this: I would phrase this as the fault of the animation having violated the Hippocratic oath for animations, which is “first, do no harm” a.k.a. “first, don’t interfere with user input”. Yes, one has to be afraid of hyperbole – was there ever an onscreen transition that saved a life? – but there is something I really liked about this phrasing. After all, most transitions and animations are decorators, and every transition and animation is, by definition, also a delay . Here’s Shazam as I open it, and overlaid are my frantic taps as I’m trying to make it start the song recognition process: It’s a cute cold start animation, but: What’s particularly frustrating here is how Shazam is being used. On the other end of this whole flow is a song that might already be fading out – timing myself, a user, can’t control – so time wasted on the uninterruptible animation might be seconds separating failure from success. I know it does feel like a blink of an eye when watched out of context, and it is literally just a bit over a second of a delay in the best case scenario, but I wanted to share it as a general example. I believe these seconds add up, especially in a stressful moment, on an older device, repeated many times a day, across different apps… or all of the above. (My go-to example: Imagine your keyboard keys reacting with a second of delay!) At least, I should compliment Shazam for not making another mistake: after the recognition starts, tapping the same button doesn’t cancel it – instead, you have to tap a close box in the corner. Here, the designers realized I might actually be slamming the big button many times over, and I shouldn’t be punished for it even more. It’s not interruptible, like animations should be. It doesn’t even buffer the taps, so – in case the animation covers for something truly uninterruptible, like loading from the cloud – I can’t simply tap and forget, but instead have to wait and tap after it’s done animating.

0 views
Anton Zhiyanov 2 months ago

Go concurrency distilled

This mini-book provides a brief overview of many concurrency topics in Go. Each topic comes with interactive examples — feel free to experiment with them by changing the code and clicking Run . There's also a PDF version with static examples. This is a quick refresher on Go concurrency, not a beginner's guide. If you want to learn concurrency from the ground up with practical exercises, check out my other book — Gist of Go: Concurrency . The book is AI-free. Goroutines  • Channels  • Select  • Pipelines  • Time  • Context  • Wait groups  • Data races  • Race conditions  • Mutexes  • Semaphores  • Signaling  • Run once  • Object pool  • Atomics  • Testing  • Scheduling  • Diagnostics  • Final thoughts The foundation of concurrency in Go is goroutines – functions started with the keyword: The Go runtime juggles these goroutines and distributes them among operating system threads running on CPU cores. Compared to OS threads, goroutines are lightweight, so you can create hundreds or thousands of them. Goroutines are completely independent. The main function is also a goroutine, but it starts implicitly when the program starts. When ends, other goroutines also shut down. We use a wait group ( ) to wait for goroutines to finish in the example above. A wait group has a counter inside. Calling increments it by , while decrements it by one. blocks the calling goroutine (in this case, main) until the counter reaches zero. This way, main waits for both workers to finish before it exits. automatically increments the wait group counter, runs a function in a goroutine, and decrements the counter when it's done: Goroutines can pass values to each other through channels . A channel is like a window where one goroutine can throw something and another can catch it: Sending a value through a channel is a synchronous operation. When the sending goroutine writes a value to the channel ( ), it blocks and waits for someone to receive that value ( ). Only then does it continue. Returning an output channel from a function and filling it within an internal goroutine is a common pattern in Go. This allows the caller to receive values through the channel while the owning function retains control of it: To signal readers that all data has been sent, the writer goroutine closes the channel with : The reader checks the channel's status with a second value ("comma OK") when reading: While the channel is open, the reader receives the next value and a status. If the channel is closed, the reader gets a zero value and a status. A channel can only be closed once. Closing it again or writing to a closed channel causes a panic. The only reason to close a channel is to signal to its readers that all data has been sent. If this isn't important to the readers, then you don't need to close it. When a channel is no longer used, Go's garbage collector will free its resources, whether it's closed or not. automatically reads the next value from the channel and checks if it's closed. If the channel is closed, it exits the loop: Range over a channel returns a single value, not a pair, unlike range over a slice. You can protect yourself from accidental write/close errors by setting the channel direction. Channels can be: You can't read from a send-only channel or write to a receive-only channel (nor can you close it). Channels are usually initialized for both reading and writing, and specified as directional in function parameters. Go automatically converts a regular channel to a directional one: Buffered channels work like a FIFO queue with a fixed-size buffer for storing values. As long as the buffer has free space, writing to the channel doesn't block the goroutine. Similarly, as long as the buffer contains values, reading from the channel doesn't block the goroutine: By default, if you don't specify a buffer size, a channel is unbuffered (buffer size equals zero). Buffered channels work with the built-in and functions: Reading from a closed buffered channel returns values from the buffer and a status. Once all values are taken, it returns a zero value and a status, like a regular channel: Like any type in Go, channels have a zero value, which is . Writing to or reading from a nil channel blocks the goroutine indefinitely: Closing a nil channel causes a panic: The select statement is somewhat like , but specifically designed for channels. Here's what it does: Select is used to manage data flow in pipelines: To cancel goroutines: For non-blocking operations: And for much more. A pipeline is a sequence of operations where each step takes input data, processes it in a specific way, and outputs it. The input and output of each operation is a channel. A typical pipeline looks like this: A goroutine can signal other goroutines that it has finished its work using an output channel : If a goroutine doesn't need to return results, it can signal completion using a done channel : To terminate a goroutine early, a calling goroutine can use a cancel channel : There are three approaches to error handling in concurrent pipelines. ➊ Return on the first error: ➋ Use a result type: ➌ Collect errors separately: Besides handling date and time, the package offers tools for managing time-sensitive operations in concurrent programs. returns a channel that is initially empty, but receives a value after the timeout period. It's useful for timing out operations: waits for to complete, but thanks to , it won't wait longer than the duration: A timer ( ) is a structure with a channel to which it sends the current time when it triggers (expires). Timers are useful for planning future executions: stops the timer and returns if it hasn't expired yet, and otherwise: It's often more convenient to use the wrapper function. It waits for duration and then executes function : returns a timer that you can cancel before execution starts: If a timer is used in a loop, it's better to create a single timer and reset it instead of creating a new instance on each iteration: A ticker is like a timer, but it keeps firing until you stop it. Tickers are useful for executing periodic tasks: creates a ticker that sends the current time to the channel at interval . You must stop the ticker eventually with to free up resources. If the channel reader can't keep up with the ticker, the ticker will skip ticks. The main purpose of context is to cancel operations, either manually or by timeout/deadline. The function accepts a context and uses its channel to listen for cancellation: Cancel manually ( error): Cancel by timeout ( error): Cancel by deadline ( error): Context is layered. A context object is immutable. To add new properties to a context, a new (child) context is created based on the old (parent) context. The shorter timeout between the parent and child contexts always wins. The child context can only shorten the parent's timeout, not extend it: Multiple cancels are safe. You can call on the context as many times as you want. The first cancel will work, and the rest will be ignored. You can specify a custom cancellation cause using , and . This cause is accessible through : You can register a function to execute when the context is canceled with : Context can pass additional information about a call using , which creates a context with a value for a specific key. But it's generally better to avoid passing values in context. It's better to use explicit parameters or custom structs instead. The type lets you wait for one or more goroutines to finish: A doesn't know anything about the goroutines it manages. It works with an internal counter. Calling increments the counter by one, while decrements it. blocks the calling goroutine until the counter reaches zero. The method combines , starting a goroutine, and : All methods are safe to use from multiple goroutines. Normally, all calls happen before . But technically, there's nothing stopping you from doing some of the calls before and some after (from another goroutine). You can call from multiple goroutines. They will all block until the group's counter reaches zero. A data race happens when multiple goroutines access shared data, and at least one of them modifies it. We need to protect the data from this kind of concurrent access. A data race doesn't always cause a runtime panic. That's why Go provides a special tool called the race detector. You can turn it on with the flag, which works with the , , , and commands. Channels are safe for concurrent reading and writing, and they don't cause data races. Ways to prevent data races: A race condition happens when an unpredictable order of operations from multiple goroutines leads to an incorrect system state: If individual operations are concurrent-safe, Go's race detector won't find any issues. Because of this, it doesn't catch race conditions: You can't fully eliminate uncertainty in a concurrent environment. Events will happen in an unpredictable order — that's just how concurrency works. However, you can prevent a race condition — often by protecting a composite operation with a mutex: Sometimes you can prevent a race condition without using mutexes by applying an atomic compare-and-set operation or one of its flavors: The idea is always the same: The type protects shared data and parts of your code from being accessed concurrently: The mutex guarantees that only one goroutine can run the code between and at a time. A mutex is used in these situations: If all goroutines are only reading the data, you don't need a mutex. The method tries to lock the mutex, just like a regular . But if it can't, it returns right away instead of blocking the goroutine: The type distinguishes between readers and writers. It provides two sets of methods: Here's how it works: This creates a "single writer, multiple readers" setup. Both and implement the same interface: By using instead of a specific mutex type, you can build components that don't depend on a specific lock implementation. This lets the client decide which lock to use. You can use a channel instead of a mutex to protect shared data: A semaphore is like a container with N available slots and two operations: acquire to take a slot and release to free a slot. Here are the semaphore rules: You can implement a simple semaphore with a buffered channel, where N is the channel's size. To acquire the semaphore, send a value into the channel. To release it, take a value from the channel: For more complex situations, use the package. A rendezvous lets two goroutines wait for each other: You can implement a simple rendezvous with a wait group: A barrier is a general case of a rendezvous. It lets N goroutines wait for each other: You can implement a simple barrier with a wait group: The (conditional variable) type lets one goroutine signal to another that it's ready, and lets the other goroutine wait for that signal. A includes a mutex and has two methods — and . If there are multiple waiting goroutines when is called, only one of them will be resumed. If there are no waiting goroutines, does nothing. You can also use the method. While wakes up only one goroutine waiting on , the method wakes up all such goroutines. You can signal with a channel: And broadcast too: Broadcasting with a condition variable is limited: it only sends a signal, not the actual data, and it only works once. With channels, you can build a publish/subscribe system that doesn't have these limitations: The type makes sure that the given function runs only once. If multiple goroutines call at the same time, only one will run the function, while the others will wait until it returns: is perfect for one-time initialization or cleanup in a concurrent environment. Besides the type, the package also includes three convenience once-functions: The type helps reuse memory instead of allocating it every time, which reduces the load on the garbage collector: takes an item from the pool. If there are no available items, it creates a new one using (which we have to define ourselves, since the pool doesn't know anything about the items it creates). returns an item back to the pool. Things to keep in mind: An operation without synchronization can only be truly atomic if it translates to a single processor instruction. Such operations don't need locks and won't cause issues when called concurrently (even the write operations). There are only a few atomics, and they're all found in the package: Each atomic type provides the following methods: Numeric types also provide an method that increments the value by the specified amount. All methods are either translated into a single CPU instruction or are otherwise guaranteed to be atomic, so they are safe to use from multiple goroutines. The composition of atomics is always non-atomic: A bulletproof way to make a composite operation atomic and prevent race conditions is to use a mutex: Sometimes you can use an atomic type instead of a mutex to exit early: If your concurrent program uses channels or custom types with synchronization methods like , you can use those in your tests. This way, your tests won't be much more complicated than if the code were synchronous: If there aren't any suitable synchronization "handles" in the code you're testing, you can use the package. It exports two functions: runs an isolated bubble. The bubble uses a fake clock, and you can manually control goroutine synchronization with . blocks until all goroutines in the bubble — except the one that called — have either finished or are durably blocked. This lets you wait for a specific goroutine to finish or get blocked, so you can check the program's state: The fake clock in move forward only if: ➊ all goroutines in the bubble are durably blocked; ➋ there's a future moment when at least one goroutine will unblock; and ➌ isn't running. Thanks to this, time-dependent tests run instantly: The following operations durably block a goroutine: Blocking on mutexes, I/O, or system calls is not considered durable, and the bubble can't handle them. At the hardware level, CPU cores are responsible for running parallel tasks. At the operating system level, a thread is the basic unit of execution. There are usually many more threads than CPU cores, so the operating system's scheduler decides which threads to run and which ones to pause. At the Go runtime level, a goroutine is the basic unit of execution. The runtime scheduler runs a fixed number of OS threads, often one per CPU core. There can be many more goroutines than threads, so the scheduler decides which goroutines to run on the available threads and which ones to pause. The scheduler keeps switching between goroutines to make sure each one gets a turn to run on a thread, instead of waiting in line forever. This is how Go handles concurrency. Goroutine scheduler The goroutine scheduler's job is to run M goroutines on N operating system threads, where M can be much larger than N. Here's a very simplified version of it's algorithm: The number of threads running Go code is controlled by the environment variable or the function. A goroutine is a structure that starts out using about 2 KB of memory, mostly for its stack. The stack can grow if needed. Since goroutines are so lightweight, you can run tens of thousands or even hundreds of thousands of them on a small machine. To troubleshoot concurrent programs in production, we use metrics, profiling, and tracing. Metrics show how the Go runtime is performing, like how much heap memory it uses or how long garbage collection pauses take. Each metric has a unique name and a value, which can be a number or a histogram. You can use the package to get a complete list of metrics or check the values of specific ones: In practice, people rarely do this manually. Instead, all metrics are automatically exported using Prometheus or OpenTelemetry libraries. Profiling helps you understand exactly what the program is doing, what resources it uses, and where in the code this happens. Go uses a sampling profiler that's suitable for production. The most commonly used profiles are CPU, which shows how much processor time each function uses, and heap, which shows how much heap memory each function uses. Goroutine, block, and mutex profiles help identify problems related to concurrency. The easiest way to add a profiler to your app is by using the package. To collect a profile with the given name, call the endpoint. To view the collected profile, use the utility: You can also profile manually: Tracing records certain types of events while the program is running, mainly those related to concurrency and memory. When the profiling server from the package is running, call the endpoint to collect a trace. To view the results, use the utility. You can also collect a trace manually: You can set up automatic tracing with a sliding window that's limited by size or duration. This is called "flight recording". It lets you always keep a recent trace available in case something goes wrong: We've covered a number of Go tools for writing concurrent programs: If you like the book, please recommend it to your friends or colleagues. If you're interested, check out my other books and projects . I'm glad you finished the book. Thank you, and I'll see you next time! (bidirectional): for reading and writing (default); (send-only): for writing only; (receive-only): for reading only. Checks which cases are not blocked. If multiple cases are ready, randomly selects one to execute. If all cases are blocked and there is a default case, executes it. If all cases are blocked and there is no default case, waits until one is ready. Reader : Reads input data from a file, database, or network. N processors : Transform, filter, aggregate, or enrich data using external sources. Writer : Writes the processed data to a file, database, or network. Avoid concurrent data modification (typically by using channels). Synchronize access with mutexes. Use only atomic operations. Check if the assumed (old) state matches reality. If it does, change the state to new. If not, do nothing. When multiple goroutines are modifying the same data. When one goroutine is modifying the data and others are reading it. / lock and unlock the mutex for both reading and writing. / lock and unlock the mutex for reading only. If a goroutine locks the mutex with , other goroutines will be blocked if they try to use or . If a goroutine locks the mutex with , other goroutines can also lock it with without being blocked. If at least one goroutine has locked the mutex with , other goroutines will be blocked if they try to use . Calling acquire takes a free slot. If there are no free slots, acquire blocks the goroutine that called it. Calling release frees up a previously taken slot. If there are any goroutines blocked on acquire when release is called, one of them will immediately take the freed slot and unblock. There are two goroutines — G1 and G2 — and each one can signal that it's ready. If G1 signals but G2 hasn't yet, G1 blocks and waits. If G2 signals but G1 hasn't yet, G2 blocks and waits. When both have signaled, they both unblock and continue running. The barrier has a counter (starting at 0) and a threshold N. Each goroutine that reaches the barrier increases the counter by 1. The barrier blocks any goroutine that reaches it. Once the counter reaches N, the barrier unblocks all waiting goroutines. unlocks the mutex and suspends the goroutine until it receives a signal. wakes the goroutine that is waiting on . When wakes up, it locks the mutex again. should return a pointer, not a value, to reduce memory copying and avoid extra allocations. The pool has no size limit. If you start 1000 more goroutines that all call at the same time, 1000 more buffers will be allocated. After an item is returned to the pool with , you shouldn't use it anymore (since another goroutine might already have taken and started using it). reads the value of a variable. sets a new value. sets a new value (like ) and returns the old one. sets a new value only if the current value is still what you expect it to be. A blocking send or receive on a channel created within the bubble. A blocking select statement where every case is a channel created within the bubble. Calling if all calls were made inside the bubble. If there's a free thread, assign it a goroutine from the queue. If a running goroutine gets blocked (for example, while reading from a channel), put it back in the queue and assign a different goroutine to the thread. If a running goroutine gets stuck in a syscall, start a new thread to run other goroutines until the blocked goroutine finishes the syscall. Check the running goroutines every 10 ms. Preempt long-running goroutines and return them to the queue to prevent starvation. Goroutines for running concurrent tasks. Channels and select as flexible communication tools. Timers and tickers for working with time. Context for canceling operations. Wait groups for synchronizing goroutines. Mutexes to prevent race conditions. Condition variables for signaling events. Once for safe one-time initialization. Pools to reduce garbage collector load. Atomic operations.

0 views
Sean Goedecke 2 months ago

You should all be asking way more questions

When someone is explaining something to me, I ask on average one question every thirty seconds. I’m sure this is frustrating to some people, but it’s actually a good habit and you should do it too. Most of the questions I ask are very short, and require very short answers. Typically I’m asking for confirmation: “so when you say X, you mean Y?”, or “this X is the thing you mentioned earlier when you were saying Z?“. The point of these questions is to make sure I understand. A small misunderstanding early on balloons into a big misunderstanding later, because all the things you misinterpret based on the first misunderstanding will become misunderstandings in their own right, and so on. That’s why you can’t just wait until someone’s finished talking and ask all your questions at once 1 . I think most people don’t ask questions because they’re not really trying to understand: they’re happy to just trust that the person they’re talking to knows what’s going on. This goes double when that person is a well-respected or more senior engineer. However, once you have skin in the game , that all changes. When you’re in a position where you are the one responsible for success or failure — where you are going to have to go away after the conversation and take a bunch of concrete actions — you will find yourself wanting to ask many questions. When someone’s explaining a plan to me at work, I am usually building it in my head: visualizing the specific lines of code that would need to be written in order to implement it. I’ll sometimes handwave the details for solved problems (for instance, I might say “send emails like subsystem X of the same service that also sends emails”), but at minimum I’m planning out: If I hear something that is suspiciously vague (for instance, someone describes service X as “storing data” when I know service X only talks to an ephemeral Redis store), I will immediately ask “hold on, how is that going to work?” Usually that indicates a missing dependency (e.g. service X has to make an RPC call to service Y, which does have a persistent database), which often suggests design changes (for instance, moving some or all of the functionality into service Y). Sometimes questions like these will uncover a fundamentally unworkable feature of the design. This usually happens when a plan fails to take into account some wicked features . I remember many years ago a neighboring team built a complex event-driven system that was very elegant but made it completely impossible to silo customer data in a single datacenter. Because our company had “all your data lives in a single location” as a flagship feature, this system just did not work and had to be effectively abandoned. If you’re involved in any kind of technical leadership role, you will have to do this work eventually. Doing it as early as possible — i.e. in the conversation where someone is describing the plan to you — can save hours or days of wasted implementation. Often this is enough to turn a failed project into a successful one . Maybe you only work with reliable engineers who can be trusted to make all the right decisions. You can thus let them talk without interruption, because it doesn’t really matter if you have a detailed understanding of what they’re saying. That’s great! But these days you probably also have colleagues that are inherently unreliable: AI agents. I mostly work with GPT-6-Astra and Claude Opus 5.5. These are good models that don’t often make code mistakes: when they set out to do something, they usually do it 2 . But they make design mistakes all the time. They assume that two services can talk to each other when in fact they can’t, or they forget about the fact that their code has to run both in the cloud and on-premises, and so on. This is mostly due to the lack of continuous learning : you didn’t know this stuff on your first day either, but you had plenty of time to pick it up. Language models are always on their first day. You should be absolutely peppering AI agents with questions. I constantly ask things like: There will probably come a day when I always get sensible answers to these questions that convince me the model knows what it’s doing. But today is not that day. About half the questions I ask get answers that convince me 3 the model has made a mistake: it should have reused the existing subsystem for X, or authed to Y differently, or kept the Z implementation simple, and so on. When this stops happening, I’ll stop asking questions (and try and see if my company will still be willing to pay me to occupy more of an architect role, I suppose). You should all be asking way more questions. In other words, you should all be trying harder to actually understand what you’re hearing . Don’t trust that the person (or AI model) you’re talking to knows what they’re doing, even if you think they’re smarter than you. Nobody understands complex software products. If you have deep domain knowledge of any area of a codebase, you will routinely find yourself correcting powerful AI models and principal engineers. Sometimes questions you have will be answered later on, but in my experience this is more about questions like “what are the broader consequences of X”, not the simple confirmation questions I often interrupt to ask. Your experience might be different if you’re working in a different domain or with a different language. I know some of these might sound like leading questions that would trigger sychophancy, but in my experience good coding models are very happy to robustly defend themselves. How data needs to flow between services (what kind of data, and how it will travel over the wire) How services will communicate with each other (e.g. how will they auth?) What data needs to be persisted, and where it’s going to live Do we do X elsewhere in this codebase? Does service Y really support this type of authentication, or are you assuming we’d have to go build that too? Is this subsystem you built necessary to satisfy requirement Z, or does it in fact satisfy some other requirement you assumed? Why do we need to update the interface for A? Why do we need to touch this file? Isn’t that unrelated to the change? Sometimes questions you have will be answered later on, but in my experience this is more about questions like “what are the broader consequences of X”, not the simple confirmation questions I often interrupt to ask. ↩ Your experience might be different if you’re working in a different domain or with a different language. ↩ I know some of these might sound like leading questions that would trigger sychophancy, but in my experience good coding models are very happy to robustly defend themselves. ↩

0 views