12256 stories
·
35 followers

Claude Code Can Debug Low-level Cryptography

1 Share

Over the past few days I wrote a new Go implementation of ML-DSA, a post-quantum signature algorithm specified by NIST last summer. I livecoded it all over four days, finishing it on Thursday evening. Except… Verify was always rejecting valid signatures.

$ bin/go test crypto/internal/fips140/mldsa
--- FAIL: TestVector (0.00s)
    mldsa_test.go:47: Verify: mldsa: invalid signature
    mldsa_test.go:84: Verify: mldsa: invalid signature
    mldsa_test.go:121: Verify: mldsa: invalid signature
FAIL
FAIL     crypto/internal/fips140/mldsa   2.142s
FAIL

I was exhausted, so I tried debugging for half an hour and then gave up, with the intention of coming back to it the next day with a fresh mind.

On a whim, I figured I would let Claude Code take a shot while I read emails and resurfaced from hyperfocus. I mostly expected it to flail in some maybe-interesting way, or rule out some issues.

Instead, it rapidly figured out a fairly complex low-level bug in my implementation of a relatively novel cryptography algorithm. I am sharing this because it made me realize I still don’t have a good intuition for when to invoke AI tools, and because I think it’s a fantastic case study for anyone who’s still skeptical about their usefulness.

Full disclosure: Anthropic gave me a few months of Claude Max for free. They reached out one day and told me they were giving it away to some open source maintainers. Maybe it’s a ploy to get me hooked so I’ll pay for it when the free coupon expires. Maybe they hoped I’d write something like this. Maybe they are just nice. Anyway, they made no request or suggestion to write anything public about Claude Code. Now you know.

Finding the bug

I started Claude Code v2.0.28 with Opus 4.1 and no system prompts, and gave it the following prompt (typos included):

I implemented ML-DSA in the Go standard library, and it all works except that verification always rejects the signatures. I know the signatures are right because they match the test vector.

YOu can run the tests with “bin/go test crypto/internal/fips140/mldsa”

You can find the code in src/crypto/internal/fips140/mldsa

Look for potential reasons the signatures don’t verify. ultrathink

I spot-checked and w1 is different from the signing one.

To my surprise, it pinged me a few minutes later with a complete fix.

Maybe I shouldn’t be surprised! Maybe it would have been clear to anyone more familiar with AI tools that this was a good AI task: a well-scoped issue with failing tests. On the other hand, this is a low-level issue in a fresh implementation of a complex, relatively novel algorithm.

It figured out that I had merged HighBits and w1Encode into a single function for using it from Sign, and then reused it from Verify where UseHint already produces the high bits, effectively taking the high bits of w1 twice in Verify.

Looking at the log, it loaded the implementation into the context and then immediately figured it out, without any exploratory tool use! After that it wrote itself a cute little test that reimplemented half of verification to confirm the hypothesis, wrote a mediocre fix, and checked the tests pass.

I threw the fix away and refactored w1Encode to take high bits as input, and changed the type of the high bits, which is both clearer and saves a round-trip through Montgomery representation. Still, this 100% saved me a bunch of debugging time.

A second synthetic experiment

On Monday, I had also finished implementing signing with failing tests. There were two bugs, which I fixed in the following couple evenings.

The first one was due to somehow computing a couple hardcoded constants (1 and -1 in the Montgomery domain) wrong. It was very hard to find, requiring a lot of deep printfs and guesswork. Took me maybe an hour or two.

The second one was easier: a value that ends up encoded in the signature was too short (32 bits instead of 32 bytes). It was relatively easy to tell because only the first four bytes of the signature were the same, and then the signature lengths were different.

I figured these would be an interesting way to validate Claude’s ability to help find bugs in low-level cryptography code, so I checked out the old version of the change with the bugs (yay Jujutsu!) and kicked off a fresh Claude Code session with this prompt:

I am implementing ML-DSA in the Go standard library, and I just finished implementing signing, but running the tests against a known good test vector it looks like it goes into an infinite loop, probably because it always rejects in the Fiat-Shamir with Aborts loop.

You can run the tests with “bin/go test crypto/internal/fips140/mldsa”

You can find the code in src/crypto/internal/fips140/mldsa

Figure out why it loops forever, and get the tests to pass. ultrathink

It spent some time doing printf debugging and chasing down incorrect values very similarly to how I did it, and then figured out and fixed the wrong constants. Took Claude definitely less than it took me. Impressive.

It gave up after fixing that bug even if the tests still failed, so I started a fresh session (on the assumption that the context on the wrong constants would do more harm than good investigating an independent bug), and gave it this prompt:

I am implementing ML-DSA in the Go standard library, and I just finished implementing signing, but running the tests against a known good test vector they don’t match.

You can run the tests with “bin/go test crypto/internal/fips140/mldsa”

You can find the code in src/crypto/internal/fips140/mldsa

Figure out what is going on. ultrathink

It took a couple wrong paths, thought for quite a bit longer, and then found this one too. I honestly expected it to fail initially.

It’s interesting how Claude found the “easier” bug more difficult. My guess is that maybe the large random-looking outputs of the failing tests did not play well with its attention.

The fix it proposed was updating only the allocation’s length and not its capacity, but whatever, the point is finding the bug, and I’ll usually want to throw away the fix and rewrite it myself anyway.

Three out of three one-shot debugging hits with no help is extremely impressive. Importantly, there is no need to trust the LLM or review its output when its job is just saving me an hour or two by telling me where the bug is, for me to reason about it and fix it.

As ever, I wish we had better tooling for using LLMs which didn’t look like chat or autocomplete or “make me a PR.” For example, how nice would it be if every time tests fail, an LLM agent was kicked off with the task of figuring out why, and only notified us if it did before we fixed it?

An image of Clippy, the paperclip with eyes from Microsoft Office, with a speech bubble saying 'FYI, your tests are failing because you are taking the HighBits of w1 in w1Encode, but w1 in Verify is already the high bits output of UseHint.'

For more low-level cryptography bugs implementations, follow me on Bluesky at @filippo.abyssdomain.expert or on Mastodon at @filippo@abyssdomain.expert. I promise I almost never post about AI.

The picture

Enjoy the silliest floof. Surely this will help redeem me in the eyes of folks who consider AI less of a tool and more of something to be hated or loved.

A calico cat lying upside-down on a wooden floor, body curved around a coffee table leg, looking a bit derpy, with a feather toy on a string dangling nearby

My work is made possible by Geomys, an organization of professional Go maintainers, which is funded by Smallstep, Ava Labs, Teleport, Tailscale, and Sentry. Through our retainer contracts they ensure the sustainability and reliability of our open source maintenance work and get a direct line to my expertise and that of the other Geomys maintainers. (Learn more in the Geomys announcement.) Here are a few words from some of them!

Teleport — For the past five years, attacks and compromises have been shifting from traditional malware and security breaches to identifying and compromising valid user accounts and credentials with social engineering, credential theft, or phishing. Teleport Identity is designed to eliminate weak access patterns through access monitoring, minimize attack surface with access requests, and purge unused permissions via mandatory access reviews.

Ava Labs — We at Ava Labs, maintainer of AvalancheGo (the most widely used client for interacting with the Avalanche Network), believe the sustainable maintenance and development of open source cryptographic protocols is critical to the broad adoption of blockchain technology. We are proud to support this necessary and impactful work through our ongoing sponsorship of Filippo and his team.

Read the whole story
denubis
9 hours ago
reply
Share this story
Delete

Miscellania: Europa Universalis V Confirmed! (First Impressions)

1 Share

Something different this week! The folks at Paradox Development Studios were nice enough to give me a review copy of the upcoming Europa Universalis V (releasing Nov. 4) ahead of release so that I could share some thoughts! For the unfamiliar, Europa Universalis is a series of strategy games covering the early modern period (traditionally 1444 to 1836, but now 1337 to 1836). While the series title implies a European focus, these games have become over time increasingly global and really represent an effort as global historical strategy. So this is a game where you play as a state (or state-like entity) from the end of the Middle Ages through the Age of Exploration through the rest of the early modern period to the period of the American and French revolutions, though obviously as your game develops, those revolutions may or may not happen as historically they did.

First, I should note that if you have not read it, I did an extended series on this game’s predecessor (I, II, III, IV) as part of my Teaching Paradox series – indeed, as the very first of the Teaching Paradox posts. You don’t need to read that series to understand this post, but I will be referring back to it.

Now while I have had EU5 for a couple of weeks at this point, due to teaching and research demands and such, I have only been able to give it a limited amount of time – about 30 hours – so I’m going to call this post a ‘first impression’ rather than a ‘review’ or ‘analysis.’ It should, of course, tell you something about this game that “about 30 hours” is a “limited amount of time.” In particular, I play these games relatively slowly (with a lot of automation turned off so I can make granular decisions), so those hours have only gotten me in one run to about 1450 (more on that below) which is hardly all of the game – hell, it is barely past the start date of EUIV. So what I want to do here is first present very briefly my answer to “is it good?” (yes) because if I don’t, I will be asked about it endlessly, and then get into the real meat of the question which is how the historical assumptions of Europa Universalis V differ from those of its predecessors.

And finally, in the interest of full disclosure, I did receive a review copy of the game and obviously I have interacted with the folks at Paradox before and will continue to try to bully them into making Imperator II.

This is where I got by 1450 starting as the County of Holland in 1337 (Luxembourg, Cologne, Julich and Berg are all vassals). You can’t see it, but somehow my now-Duke-of-the-Netherlands got elected Holy Roman Emperor, so I am actually the number 2 great power in Europe behind France, though that ranking is really deceptive, as my country doesn’t really have the military power to stand up to England or France alone.

Is it Good?

Yes.

Now, I should do some table-setting here: I am the kind of player who, as you will recall, really enjoyed Victoria III on launch. That title was divisive, in part because of a heavy emphasis on relatively indirect systems (building factories changes your demographics which changes your interest groups which changes your politics, that sort of thing) and because it de-emphasized the ‘war-game’ aspect these games often have. So please understand that in the battle between ‘more spreadsheets’ and ‘less spreadsheet’ when it comes to Paradox games, I am firmly in the ‘more spreadsheets’ camp. With that said then, let me qualify my previous ‘yes’ with:

Europa Universalis V is likely to be divisive: it is much more systems driven, much less ‘gamey’ in its design, much more granular (and thus slower) and substantially more complex. I also imagine that, once the game hits the general public, players will find ways to break those more complex systemic interactions in amusing ways – I imagine there will be a lot of balance patches and tweaks. But I think it needs to be stressed that this is not EU4.5. One of the things I really like about Paradox is that they do not tread water in design from one iteration to the next: HoI4 takes some big risks compared to HoI3, VickyIII is quite a jump from VickyII and so on (Crusader Kings has experienced perhaps the least of this from II to III, but the gap between CKII (2012) and CKIII (2022) is still a lot bigger, design wise, in my view, than, say the gap between Total War: Rome II (2013) and Total War: Pharaoh: Dynasties: Colon (:2024)).

The word I am going to keep using for this “lots of complex interacting systems summarized by charts of charts with charts and charts” is ‘crunchy.’ It isn’t soft and smooth, it fights you a little bit, but there’s a lot of texture and complexity there.

I wanted a screenshot to give an impression of just how complex they were willing to make this game and I couldn’t do better than “here look at how they model the Holy Roman Empire.” That is, I kid you not, 7 electors, 26 Free Imperial Cities, 52 Prince-(Arch)bishops, 195 Imperial Princes and 1 Republic for a two hundred and eighty-one states in the Holy Roman Empire.

The design is relentlessly crunchier: monarch points (“mana”) are gone, but this isn’t a full switch back to EUIII‘s ‘gold does everything’ system. Instead, monarch points have been replaced by a bunch of interacting systems that blend Imperator and VickyIII‘s approach to pops and buildings. Estates, an add-on mechanic in EU4 are now central: buildings and pops contribute to income but also estate power which shapes politics and cultural values. Culture-Value Sliders are back (something I missed from EUIII) but they now move gradually rather than in clear increments and are shaped by policies and privileges. In short, abstract game mechanics have been mostly replaced by interwoven systems which the player influences only slowly and often indirectly: if you build a lot of burgher buildings (like, say, fabric guilds in your towns) you will slowly empower your burghers and as they become more powerful keeping them happy will demand shifting your government in ways they want (but their increased power will enable you to do that). In a process that might take, you know, a century or two to happen, if not longer.

The game is also unapologetic about its complexity and frankly suffers a little from a UI that is clearly straining to do what it needs to. Basically all of the major country screens (‘diplomacy, economy’ that stuff) have sub-screens (usually 2-3), some of which open sub-sub-screens. Every ‘location’ – the ‘sub-province’ territorial unit – has its own buildings and economy and pops which all have their own screens. I never found it too hard to find what I was looking for, but if you are the kind of player who cordially hates that sort of thing and likes how minimal it is in CKII and III, well it is maximal here. I imagine that we’ll see over the course of this game’s post-release development, some stream-lining of UI and a few more tooltips (some of the economy tooltips take a minute before you understand what all of the icons mean), but unless they streamline the systems – and please do not streamline away the systems – this is always going to be a crunchy, complex game.

The developers are clearly aware of that because they’ve added the ability to automate most of these systems. If you don’t want to individually set trade priorities in every trading center, you can automate them. If you don’t want to individually plan out your economic buildings, you can automate that too. If you don’t want to set estate-by-estate tax rates to crush the wealth of your aristocracy so that they can’t stop you when you tear away their feudal privileges, you can set a ‘keep them happy’ automation on that as well. The clear intent here is to let players, especially of large territorial empires, focus their attention as they like.

I can’t say how well these automation systems worked because I did my run as the County of Holland, which can’t really afford to automate its economy, because economy is all it has. I fiddled a bit with trade automation and found it worked well enough prioritizing profit in my market, although I did end up reserving a chunk of trade capacity (you can do that!) so I could make sure specific industries got the raw materials they needed (the trade AI seems, reasonably enough, to focus on the profit of the trade but can’t consider the downstream economic effects of, say, a purchase of wool that makes a small profit, but the wool then goes through two production buildings to come out as dyed fabric where the big profit is in production. But again, easy enough, as the player, to notice the warning up at the top of the screen telling you your market is short on wool and to just reserve some trade capacity to buy wool). To judge by the performance of AI countries, the automation seems to work OK, but I imagine players will find exciting ways to break it shortly.

So that’s the ‘review’ part: this is a much more systems driven approach, which blends some of the best ideas from Victoria III, Imperator, and EUIII and EUIV and I think it works really well. I suspect it will turn off players who prefer less systems-driven, less-crunchy experiences, but the automation may soften that blow. There are some rough edges, some systems that clearly need balancing and refinement and such, as you’d expect for a game this complex at launch. But it works pretty well, I had no stability issues, it ran well for me (shocking, given its complexity) and for the folks who want a crunchier, systems-driven approach, this will be your jam. And France is a monster which must be destroyed.

I suppose if we must do number-scores, we ought to do them in true ACOUP fashion, so I give EUV a rating of Part Vc out of a ‘three part’ series.

On to the history part.

The Historical Viewpoint of Europa Universalis V

Perhaps the defining conclusion in my series on EU4 was that it was, fundamentally, a game about states. The state was the primary actor and frankly non-state actors – people, estates, non-state peoples, companies and so on – didn’t figure in very much. This was a reasonable frame for a game about the early modern period to take, but it was a frame and like any frame, some things must be left out.

Europa Universalis V is a game about nations – that’s the closest ‘single word’ I can get to in English. It’s better to say Europa Universalis V is a game about the place where people and polity meet. And indeed, the game actually specifies this: one of my repeated complaints with Paradox games not named Crusader Kings is that there’s often a lack of clarity as to exactly what the player is playing as: the ruler? the state? the people?

EUV specifies, at the beginning of the tutorial: you play as the “spirit of the nation.” Again, nation is an awkward word, but there’s none better. I admit, when I saw that, I laughed out loud because it was such a direct response – intended or not – to one of my critiques (particularly of Imperator, which shares its director, Johan Andersson with EUV). But the game sincerely means it: you are not the state, but the point at which the state and its people meet.

This is a game about the conjunction of people and polity, regardless of if those people make up a ‘nation’ or even a ‘state.’ It thus embraces more kinds of polities than EUIII or IV did: non-territorial companies, nomadic polities and so on. But it also embraces more about polities than they did: this is not just a game about states but also a game about people. ‘History from above’ is not gone – the state (or polity) – is a major mover and shaper of culture and events and Big Men can do Big Things in this game, but EUV introduces ‘history from below’ in dramatic fashion.

I think this is clearest in how it handles estates. First, a bit of background in my experience: I was playing as the County of Holland, with the aim of forming the Netherlands (to include all of the Low Countries) and eventually becoming a Republic. But Holland doesn’t start out as a plutocratic republic because this game starts in 1336: it starts out as a ‘feudal’ aristocratic imperial prince like dozens of others, albeit with a bit more ‘town’ orientation. But to hit the ‘become a republic’ button, you need to crank the ‘plutocracy’ value really high and to do that, you need a bunch of privileges and reforms that prioritize your burghers (the rich townsfolk) over your aristocracy and to do that you need to break the power of the aristocracy.

And doing that is a mix of bottom-up and top-down systems and what is really neat and new is that the aristocrats will try to fight you. The economy of your country is shaped by buildings. You build most of the buildings, but your estates build them too and not all of the buildings they build are helpful: most of the estates (aristocracy, clergy, burghers, everyone else) have a building which does basically nothing but increase their political power. Meanwhile, their chosen economic buildings add to your tax revenue, but also add to the estate’s revenue, and thus their power – power that in turn makes it more and more costly to tear away their privileges or preferred policies. And those privileges and policies in turn lock in the ‘values’ sliders (which now change gradually rather than in increments) so as long as you have a bunch of old-style late-medieval privileges and policies, you are never cranking the sliders from ‘decentralized’ to ‘centralized’ or from ‘aristocratic’ to ‘plutocratic.’

So you have to tear away those privileges, which costs a scaling amount of stability based on how powerful the estate that has them is. And of course ripping away the privilege of a powerful estate is going to both infuriate them (they each have an independent approval meter) and tank your stability (which lowers the approval of every estate) which is very likely to trigger some exciting unrest. What I like is that those privileges are not just “the aristocracy gets more powerful and the state gets nothing” – they almost invariably represent a tradeoff. The aristocracy gets more powerful but their levies are larger (because they’re expected to do vassal service) or the clergy gets more powerful but you get a bump to literacy (because they’re running your schools) and so on.

It creates a system where you can see why a country might become ‘trapped’ in a stable but stagnant situation, because change means losing the advantages of stability and the upsides of those tradeoffs immediately, but realizing the benefits of reform only gradually.

This is further emphasized with the control mechanic. Every ‘location’ has a control rating, which scales the manpower, tax revenue and other goodies you can get from it, representing how deeply that location is actually penetrated by your government. Control scales with travel distance from the capital (by sea or land), which in part incentivizes vassal states (better a vassal with good control paying tribute than you with zero control). But it also creates this quite granular feel of how state control radiates from the capital and from cities and towns, so while states have formal, rigid borders, you can absolutely have hinterlands in which state power barely exist (replacing the very binary core/not-core distinction from EUIV).

Beneath those systems people matter a lot more and you engage with them more directly. Buildings have to be staffed to work, which means they need pops of the correct social status to run them. If there’s demand, pops can promote between social statuses (somewhat slowly) to fill workplaces, so a modernizing country is going to be draining out its peasantry to fill growing towns, which in turn is going to change social, cultural and political balances. Warfare is also more closely tied to pops: levies are drawn from your pops now (professional soldiers come from the manpower pool, now generated by buildings which must be staffed) based on their type: burghers show up as heavy infantry, aristocrats as cavalry, peasants as peasant levies.

The new early start date (1337) gives the game a chance to just hammer you out of the door with the importance of population in its new systems because just about as you’ve got your economy humming the way you want, the Black Death comes along and kills a ton of your pops, causing absolute havoc in your economy, a potent, forceful reminder that your economy is run by people and those people fundamentally matter.

Pops in turn have needs (they want certain goods) and get angry if they don’t have those goods and that frustration links back into the estate system and influences control which in turn impacts how much you can gain in resources from a given place. Pop satisfaction, based on estate opinion and if they are getting needs feeds not just into unrest but also into control, so it is important not to just keep your pops alive, but increasingly as the game goes on to keep them happy.

Pops matter so much, one of the ‘country types’ is a society of pops: a polity that is a people without a defined territory, used for a lot of non-state peoples. I was initially really concerned when I loaded up the map and saw that much of the Americas was ’empty,’ but then realized, looking closer: no, it is nearly entirely filled by societies of pops, with whom you can still do diplomacy, declare war and so on. They’re just non-state polities that don’t have hard defined territories (but do exist in places – there’s a mapmode to see where they are). There are also ‘countries’ which are businesses with a collection of buildings. I don’t think either of these are playable (yet?) – I couldn’t seem to select them to play as – but even just interacting with them creates a really interesting texture to the game and a reminder that there are historical actors here that are not states.

So in the 1430s, I ended up getting elected as Holy Roman Emperor (a few key countries had women rulers who were ineligible, which left my Duke on top) and I managed to get an imperial tithe through the diet, which gave me an enormous influx of cash.
Which I am definitely, in this screenshot, using to better the safety of the Empire, by which I mean build out my economy.

Conclusions

One of the things I appreciate about Paradox’s development style is that they take risks: while there is certainly a Paradox ‘house style,’ the numbered sequels in their core lineup always take big swings at trying something new. Sometimes it works great (Crusader Kings II and III), sometimes it needs a bit of refinement to find itself (Victoria III) and sometimes it doesn’t ever quite come together (Imperator, Sengoku). But each time they are pushing, trying something new and embracing new viewpoints on what history can be in the process.

And I think Europa Universalis V is a substantial step in that direction. It is still EU – a bit more state-centered than CK or Vicky – but the historical vision here encompasses a lot more. It’s also clear that EUV was built from the ground up to really be a global grand strategy game. It’s not perfect at that (the institution system returns, with a better design but maybe not a perfect one), but now that not only non-European states, but non-European non-states are actors in the game with their own agendas and interactions, it’s made pretty great strides.

I’m excited to see where this one goes. Now, to be fair, I am a guy who really likes Victoria III, which is also very ‘crunchy,’ so Europa Universalis V is pitched right at my kind of player. I do think that Paradox is going to have to think, in terms of future development, what their ‘introductory’ game is, because I’d imagine someone coming in with no experience of a Paradox game is going to find Europa Universalis V pretty challenging to pick up (but rewarding).

But I’m also excited to play more and see how these systems interactions change over the various ages (the game breaks its tech tree into chronological ‘ages’). There are a bunch of key variables – crown power, control, market prices, and so on – which I can see get significantly tweaked either by technologies or modifiers linked to specific periods, which I can imagine really shake things up pretty dramatically.

But beyond just the ‘more systems’ approach, I’m really impressed by the effort, in a game that remains on some level fundamentally about states, to bring in a broader vision of history, which encompasses the historical agency of far more kinds of people and their competing interests and visions. I think I’ll have a lot more to say about this game as time goes on, both as I have more time with it and as it gets tweaks and more content.

Now, if you’ll excuse me, I still need to figure out how I am going to cut France down to size.

Read the whole story
denubis
1 day ago
reply
Share this story
Delete

Philosophy vs the Terminator

2 Shares
PERSON:
Read the whole story
denubis
4 days ago
reply
Share this story
Delete

Are new data centers boosting electricity prices?

1 Share

But a new study from researchers at Lawrence Berkeley National Laboratory and the consulting group Brattle suggests that, counterintuitively, more electricity demand can actually lower prices. Between 2019 and 2024, the researchers calculated, states with spikes in electricity demand saw lower prices overall. Instead, they found that the biggest factors behind rising rates were the cost of poles, wires and other electrical equipment — as well as the cost of safeguarding that infrastructure against future disasters.

“It’s contrary to what we’re seeing in the headlines today,” said Ryan Hledik, principal at Brattle and a member of the research team. “This is a much more nuanced issue than just, ‘We have a new data center, so rates will go up.’”

North Dakota, for example, which experienced an almost 40 percent increase in electricity demand thanks in part to an explosion of data centers, saw inflation-adjusted prices fall by around 3 cents per kilowatt-hour. Virginia, one of the country’s data center hubs, had a 14 percent increase in demand and a price drop of 1 cent per kilowatt-hour. California, on the other hand, which lost a few percentage points in demand, saw prices rise by more than 6 cents per kilowatt-hour.

Here is the full story, via Cliff Whinston.

The post Are new data centers boosting electricity prices? appeared first on Marginal REVOLUTION.

Read the whole story
denubis
7 days ago
reply
Share this story
Delete

The AI water issue is fake

2 Shares

The AI water issue is fake

Andy Masley (previously):

All U.S. data centers (which mostly support the internet, not AI) used 200--250 million gallons of freshwater daily in 2023. The U.S. consumes approximately 132 billion gallons of freshwater daily. The U.S. circulates a lot more water day to day, but to be extra conservative I'll stick to this measure of its consumptive use, see here for a breakdown of how the U.S. uses water. So data centers in the U.S. consumed approximately 0.2% of the nation's freshwater in 2023. [...]

The average American’s consumptive lifestyle freshwater footprint is 422 gallons per day. This means that in 2023, AI data centers used as much water as the lifestyles of 25,000 Americans, 0.007% of the population. By 2030, they might use as much as the lifestyles of 250,000 Americans, 0.07% of the population.

Andy also points out that manufacturing a t-shirt uses the same amount of water as 1,300,000 prompts.

See also this TikTok by MyLifeIsAnRPG, who points out that the beef industry and fashion and textiles industries use an order of magnitude more water (~90x upwards) than data centers used for AI.

Tags: ai, ai-ethics, ai-energy-usage

Read the whole story
denubis
14 days ago
reply
Share this story
Delete

AI Is the Market, and the Market Is the Government

1 Share

Good morning from Baltimore!

This is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.

Politics, Capital, and Attention

There are two things that I am trying to understand, both captured very well in Bloomberg’s Tuesday evening homepage.

  1. AI: Can’t go too far these days without someone talking about AI - how it’s a bubble how it’s the future how it’s both a bubble and the future. And the broader question there is about how the stock market can be so divorced from reality (or maybe, it’s just about understanding what reality the stock market inhabits)

  2. The economic decisions of the Trump administration

In the below image, Trump highlights both. He says that the Democrats have shutdown the government, citing a successful economy AND a successful stock market (but sometimes it’s Bidens economy, so you never really know). He says he is open to meeting about healthcare, which is great progress toward ending said shutdown.

But that line about the stock market is interesting. He’s right! It is a record stock market! Presumably, stocks would be cowering at this point.

  • Tariffs beat down profits (we now have tariffs on trucks, which is a flip-over-the-economic-table kind of move as it will make literally everything more expensive)

  • The dollar is flailing in the wind - and sure, a weaker dollar helps multinationals, but it also challenges returns

  • Many of the recent political decisions - no matter how you feel about them! - are creating an isolated United States, which likely isn’t good for economic growth.

Political instability usually rattles investors, but US investors seem to only see the United States of AI and literally nothing else. Ruchir Sharma wrote in the FT that “America is now one big bet on AI” which is true and as he points out, it’s a costly bet:

Outside of the AI plays, even European stock markets have been outperforming the US this decade, and now that gap is starting to spread. So far in 2025, every major sector from utilities and industrials to healthcare and banks has fared better in the rest of the world than in the US.

The US stock market is booming, but it’s all relative. There is a lot of glee in talking about bubbles. If you remove yourself from the situation, it is rather exciting to watch big companies toss around billions of dollars. It’s thrilling to gleefully tweet “the crash is COMING! Buckle up!” There is a sense of stability in the madness - we all know it’s absurd, no one knows if it’s going to work (not even the guys in charge), and it gives everyone something to talk about.

It gives the government immense power

Because the indexes are green, the government can apparently cancel funding that has already been congressionally approved, threaten allies, or bail out Argentina while railing against “globalism”. The feedback loop is simple:

  • Markets rise → Public confidence holds → Political risk premiums fall → Markets rise again.

I think for a while I thought that the stock market was just ignoring politics. But it isn’t! It is politics now, a political actor that can grant or withhold legitimacy1. Artificial intelligence fuels valuations, those valuations stabilize public confidence, that confidence grants the administration power, and the administration protects the system that sustains it.

The stock market has never been the economy - it’s really a reflection of what the economy dreams it could be in a world where share buybacks translate to meaningful productivity. But as AI swallows up more and more capital, it is both the economy and the stock market - and the government.

Gold keeps going up too.

Normally, equities and gold move in opposite directions. Stocks up, gold down. Fear or faith, pick one. But not now. The S&P is surging on AI optimism while gold is surging toward $4,000 an ounce. It is up 51% this year, the best performing asset this year2. The dollar is down 10%3. Both fear and faith are rallying simultaneously, which is rare and usually not a great sign.

Odd Lots had a good interview on the push-and-pull here. Viktor Shvets sees a cycle - tech is ripping apart society (apparently a good investment) so people are buying gold as a “hedge against destruction”.

The US equity market doesn’t seem to care. Both are winning right now, but both can’t be right forever. The US equity market is betting everything on one story:

  • Nearly 40% of US GDP growth this year comes from AI.

  • According to Morgan Stanley, “roughly 75% of S&P 500 returns, 80% of earnings growth, and 90% of capital expenditures growth” can be attributed to the AI data center build out.

  • AI companies hold $1.2T in debt, the largest segment in the investment grade market.

  • Nvidia, Microsoft, and Apple now account for over 20% of the S&P 500 index.

The underlying idea here is that AI surely will generate boundless bounty later, so valuations don’t have to make sense now. Nothing has to make sense now!

The Circle of Joy

The AI companies are spending a lot of money, primarily with each other. It’s a circular economy of speculation, as Bloomberg wrote about here.

Bain & Co. estimates this wave of AI infrastructure spending will require $2 trillion in annual revenue by 2030 to justify it which is more than the combined 2024 revenues of Apple, Amazon, Alphabet, Microsoft, Meta, and Nvidia.

The companies primarily make money through (1) subscriptions and (2) money paid to use these data centers.

But the companies have two headwinds.

  1. The $2T required here is more than 5x the annual subscription market, meaning they are going to need for a lot of people to pay for this. A lot of people don’t want to pay.

  2. The hardware depreciates in two to three years. Unlike the fiber laid during the dot-com boom, none of this will mature into durable capacity, as the WSJ highlighted.

So what do you do when you need 5x the global subscription software market to cover costs?

You make a social media app.

Everyone Gets a Social Media Company

  1. OpenAI launched Sora, a TikTok-like app that’s more focused on creation and posting than being “social” (whatever that means anymore) and Meta launched Vibes, another AI video feed. The goal here is likely to sell ads, in the same way that TikTok does. Carcinization and advertisement (adinization?): everything is destined to be a crab, everything is destined to be an ad.

This is interesting for a few reasons.

  1. AI is extraordinarily expensive but still searching for demand: Training frontier models will likely cost billions of dollars. But only a small fraction of people pay for these services. Some companies are starting to abandon it. Building a social media company is a sign that they’re chasing volume. They need eyeballs, data, and ads to offset the costs of scaling.

  2. Social media is a last-resort monetization model: When tech companies can’t make enough money on software licensing, subscriptions, or enterprise products, they default to attention. It’s reliable: people scroll; advertisers pay. The thing to watch here is that people are increasingly upset by social media, with almost 50% of teens saying that it harms people their age. John Burn Murdoch argues that we have passed peak social media.

  3. It signals a maturity problem: Right now, the supply of AI capabilities is growing faster than actual use cases. The economy hasn’t figured out what to do with all this intelligence yet, so it’s turning it into spectacle. And there are clear consequences - the technology is good. It’s good enough to be used maliciously and it will be. And there is very little talk of policy or guardrails to rein it in.

  4. It mirrors the late-stage tech pivot pattern: We saw this with crypto: when speculative returns dried up, projects pivoted to “community” and “social.” We saw it with Web3: when utility collapsed, companies turned to “metaverse” marketing (ahem, some of them changed the name of their whole company). Now we’re seeing it with AI: a turn toward social platforms that keep the narrative alive and keep investors engaged.

AI was sold as the end of slop but what it delivered was more slop. The market rewards attention, not utility, and both AI and politics has adapted to that logic.

The story that’s supposed to justify $2 trillion in annual revenue by 2030 has pivoted to... selling ads on AI-generated TikTok videos. That’s maybe the big payoff. That’s what’s sustaining the market confidence that’s granting political latitude. Gold traders see this. That’s why they’re hedging. Equity traders see it too but they just think the story lasts long enough to get a bag and get out.

The Government

And the bags are plentiful. AI’s sheer power - social media app or not - gives the government political cover. As long as portfolios are green, the electorate stays somewhat calm. The administration is effectively borrowing confidence from the AI bubble. Speculation has become governance.

Understanding this loop explains both of those questions I had.

  • The market stays green because of AI speculation.

  • That market stability creates political latitude.

  • That latitude allows the administration to do otherwise-impossible things.

  • And the administration protects the AI investments that sustain the loop.

Investors are trying to bet on which company the Trump administration will invest in next.

If the government invests in your company, you’re rich! Apparently the grid is next! A far cry from Reagan’s quip that “the nine most terrifying words in the English language are ‘I’m from the government and I’m here to help.’ Now, the nine most terrifying words “I’m from the government and I’m blocking your datacenter” or something. It’s a very strange form of socialism!

Outside of AI, the US economy is wobbling.

  • Manufacturing activity has contracted.

  • ADP data showed that in 3 out of the past 4 months, the private sector lost jobs.

  • Carlyle Group developed their own proprietary labor market data (necessary during a shutdown) based on their portfolio companies and real estate investments that apparently shows a completely flattened labor market.

  • But other components of the economy - like inflation and GDP growth - don’t show signs of a recession. The labor market does, which is very strange.

Which is why both gold and equities keep climbing. The equity market believes the AI story overrides everything else. The gold market believes something is fundamentally breaking. They’re both reacting to the same underlying reality, but they just have different theories about what happens next.

I spoke with Austan Goolsbee of the Chicago Federal Reserve about the labor market, and our conversation will be up tomorrow as their data says something else - but everything is confusing. The reality is confusing.

So: the stock market inhabits a different reality where AI speculation is all that really matters. We are in a rate-cutting cycle, with loose fiscal policy - might as well spend a ton of money on everything. The Mag7 will be completely fine either way.

And what explains the Trump administration’s economic decisions? Well, as long as the stocks stay up4, the administration has room to do things that would be impossible during volatility. Cancel appropriations. Block elected representatives from being sworn in. Invest public money in donor companies!

The stock market has become an emotional infrastructure that allows speculative sovereignty and has created an economy that governs through its own price chart.

Both gold and equities are surging because they’re hedging different kinds of collapse. Gold trades on fear of the system. AI trades on faith in the story. That both are rallying tells you something about where we are.

This is what it means to live in the United States of AI. Democracy as an asset class or something. For now, the line keeps going up. But speculation isn’t stability, and the permission government borrows from investors is never really its own.

This is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.

Thanks for reading.

1

This is not a new idea! The bond vigilantes are another good example of this

2

Citadel’s Ken Griffin is very concerned that people view gold as safer than the dollar and Ray Dalio says that well yes, gold is certainly much safer than the dollar.

3

China is trying to become the world’s custodian of gold reserves, in an attempt to expedite dedollarization. It might be working.

4

The teflon Trump thing is more than just the stock market - he can get away with saying stuff that President Biden would have never been able to say. Why? I don’t know.



Read the whole story
denubis
21 days ago
reply
Share this story
Delete
Next Page of Stories