Skip to main content
Andrej Karpathy discusses why AI labs prefer Rust programming language for engineers, emphasizing its performance and safety

Editorial illustration for Rust Emerges as Top Programming Language for AI Labs, Karpathy Signals Shift

Rust Dominates AI Engineering: Top Labs' New Language Choice

AI labs favor Rust as engineers, highlighted by Andrej Karpathy’s recent note

Updated: 4 min read

Forget the hype about AI inventing new programming languages. It's picking a favorite among the old ones. Rust is winning.

The evidence sits in casual remarks from engineers who build the future for a living. Late last year, Andrej Karpathy published a note about AI-assisted coding and casually mentioned building a tokeniser in Rust, not leaning on an existing library. Tokenisers live on the critical path of every model. Choosing Rust there is a deliberate, unspoken verdict: Python’s convenience stops where correctness and speed begin.

The same pattern shows up inside major AI labs. Andrej Karpathy provided one of the clearest signals late last year. While documenting experiments with AI-assisted coding, he mentioned building a tokeniser in Rust instead of relying on existing libraries.

Tokenisers sit directly on the performance path of every model. Choosing Rust there is a quiet admission that Python's convenience ends where correctness and speed begin. Even Elon Musk has publicly agreed that Rust is the language for AGI.

At OpenAI, the shift is explicit rather than implied. The Codex command line interface was rewritten entirely in Rust and released publicly. OpenAI said the Rust version is faster, more stable and easier to reason about as it scales.

Engineers pointed directly to Rust's guarantees as a reason. For autonomous agents that read and write files, manage tools and run unattended, that property matters far more than syntactic comfort. A similar learning curve is visible at Anthropic.

Engineers there have discussed learning Rust while building tooling around Claude, often with AI systems help them write the code itself. Rust is no longer treated as too difficult for fast-moving teams. AI assistance has flattened the learning curve enough that teams can get Rust's benefits without years of accumulated muscle memory.

Popular Meta apps, including Instagram and Facebook Messenger, utilised a decade-old C codebase for their messaging library, it led to problems with memory management and a subpar developer experience. In July last year, the company finally switched to Rust. On an episode of Meta Tech Podcast, three of the company's engineers, Eliane W, Buping W and Pascal Hartig, shared their experience with using C, discussing the challenges faced, the migration process and their success with Rust.

"I think one of the biggest things about Rust is the compile-time memory safety enforcement.

This isn't about fashion. It's about failures you can't afford. When code runs unattended in an agent, a memory leak isn't a bug.

It's a system collapse. Rust's compiler acts as a relentless, automated code reviewer that stops those collapses before they happen. The learning curve, once brutal, is now being smoothed over by the AI tools themselves.

Engineers at Anthropic use Claude to write Rust. The very technology they're building is teaching them to build it better.

The migration is practical, not philosophical. It's in production at OpenAI and Meta. It's a quiet admission that the old trade-off between safety and speed was a trap. The labs building the most consequential software are refusing to choose.

Common Questions Answered

Why are AI engineers increasingly choosing Rust for performance-critical tasks?

Rust offers superior performance and safety features that are crucial for complex AI engineering challenges. The language provides both high-speed execution and strong memory safety guarantees, making it ideal for building critical infrastructure like tokenisers.

What significant signal did Andrej Karpathy provide about Rust's role in AI development?

Karpathy demonstrated Rust's importance by building a tokeniser from scratch in the language, signaling a deliberate move away from Python's convenience. His choice highlights Rust's superiority in performance-critical areas where speed and correctness are paramount.

How does Rust's performance impact critical AI infrastructure like tokenisers?

Tokenisers are a critical performance path for AI models, and Rust provides the necessary speed and precision for these essential components. By choosing Rust, engineers can create more reliable and efficient tokenisation systems that outperform traditional Python-based approaches.

LIVE03:21OpenAI's Miles Wang in Talks for USD 2B AI Drug Discovery Startup