CAREER & HIRING ADVICE
Share it
Facebook
Twitter
LinkedIn
Email

Why AI Infrastructure Is Moving to Rust

AI teams are not dropping Python. They are replacing what sits underneath it. Over the past two years, the tokenizers, model file formats, inference servers, data tools and coding agents that AI products run on have been rebuilt in Rust, a systems language that gives C-level speed without C’s memory bugs.

Cloudflare wrote its own LLM inference engine in Rust. OpenAI rewrote its Codex coding agent in Rust and then bought the company behind uv and Ruff, two Rust-built Python tools. Hugging Face’s tokenizers and the safetensors model format both have Rust cores.

The reasons are practical: AI infrastructure is expensive to run, it handles untrusted files and prompts, and governments now tell software makers to use memory-safe languages. Rust addresses all three while letting data scientists keep writing Python on top. Below is what is moving, why, what is not moving, and what it means if you are hiring the engineers who build this layer.

Key takeaways

  • Rust is the most admired programming language among widely used languages in 2026: 67% of developers who used it want to keep using it, and it climbed to 12th most used (Stack Overflow, 2026).
  • 48.8% of organizations in the 2025 State of Rust Survey make non-trivial use of Rust, up from 38.7% in 2023.
  • Cloudflare’s Rust inference engine, Infire, matched vLLM’s throughput at 25% CPU load against vLLM’s 140% (Aug. 2025).
  • Memory safety bugs fell from 76% of Android vulnerabilities in 2019 to under 20% in 2025 after Google moved new code to Rust and other memory-safe languages.
  • The Linux kernel made Rust permanent in December 2025, and the NSA and CISA urged memory-safe languages in June 2025 guidance.
  • Python is not going away. The shift is to Rust underneath Python, exposed through Python packages that look the same to the user.
Where Rust is showing up in the AI stackMoving to RustStaying in Python, C++ or CUDAYour app, notebooks and model codePython stays hereAgents and developer toolsCodex CLI, uv, RuffTokenizers and model filesHF tokenizers, tiktoken core, safetensorsInference serversCloudflare Infire, Hugging Face CandleData frames and vector searchPolars, Qdrant, LanceDBGPU kernels and training mathCUDA, C++ (not moving yet)Operating systemRust now permanent in the Linux kernel
Top of the stack is closest to the user. Examples are public projects; most give users a Python or JavaScript interface over a Rust core. Illustration: Apollo Technical.

What “moving to Rust” actually means

Almost nobody is retraining data scientists to write Rust. Model code, notebooks and experiments stay in Python. What changes is the layer that does the heavy lifting: the code that splits text into tokens, loads model weights, batches requests onto GPUs, crunches data frames, searches vectors and installs packages.

That layer used to be C or C++ wrapped in Python. Increasingly it is Rust wrapped in Python. A data scientist who types pip install tokenizers, polars or uv is running Rust without writing any. The bindings come from a library called PyO3, which lets Rust code show up as a normal Python package.

The other big change is at the edges. Coding agents, command line tools and inference servers that used to be written in Node.js or Python are being rewritten as single Rust binaries.

Reason 1: Speed without a garbage collector

AI infrastructure is mostly a cost problem. GPUs are the expensive part, and anything that wastes CPU time or keeps a GPU waiting costs real money. Python is an interpreted language with a global interpreter lock, which makes it slow for the tight loops that sit around model calls. Languages like Go and Java avoid that but add garbage collection pauses. Rust has neither: it compiles to machine code and frees memory at known points, so its performance is fast and predictable.

Cloudflare’s Infire is the clearest public example. Cloudflare had been serving most of its models with vLLM, the popular open-source Python inference server, but found it could not get full use out of GPUs spread across its edge network. It also had to run vLLM inside a gVisor sandbox for security, which added more overhead. So it built its own engine in Rust, and says it is writing much of its new infrastructure in the language.

CPU load while serving the same LLM workloadInfire (Rust)25%vLLM 0.10.0 (Python)140%vLLM inside gVisor sandbox250%
Source: Cloudflare, Aug. 2025. Llama 3.1 8B on one H100 NVL GPU, 4,000 ShareGPT prompts at 200 concurrent requests. 100% equals one full CPU core. Infire also served 40.9 requests a second against vLLM’s 38.4.

In Cloudflare’s benchmark, Infire was up to 7% faster than vLLM on an idle machine. The bigger gain was CPU: Infire needed a quarter of one core, while vLLM used 1.4 cores on bare metal and 2.5 cores inside the sandbox. Cloudflare reports GPU utilization above 80%, and because Infire runs as a trusted process, it no longer steals CPU from the other services on the same server. Infire also uses Hugging Face’s Rust tokenizers library for the step that turns text into tokens.

OpenAI’s tiktoken tokenizer, used to count and encode tokens for GPT models, follows the same pattern: a Rust core with a Python interface. OpenAI says it runs 3 to 6 times faster than a comparable open-source tokenizer.

Reason 2: Memory safety is now a security requirement

Memory bugs, such as buffer overflows and use-after-free errors, have been the largest single source of serious security holes in software written in C and C++. Rust’s compiler blocks most of them before the code ever runs.

Google has the longest public record. After it started writing new Android code in memory-safe languages around 2019, memory safety bugs fell from 76% of Android’s vulnerabilities to 24% in 2024, and below 20% in 2025. Google says its Rust code has roughly 1,000 times fewer memory safety bugs per line than its C and C++ code, and that Rust changes need fewer revisions.

Memory safety bugs as a share of all Android vulnerabilities201976%202424%2025under 20%
Source: Google Security Blog (Sept. 2024) and Google Android security team (Nov. 2025). Google moved new Android code to memory-safe languages, mainly Rust, starting around 2019.

Governments have taken notice. In June 2025 the NSA and CISA published joint guidance telling software makers, especially those serving national security and critical infrastructure, to plan for memory-safe languages. In December 2025, Linux kernel maintainers declared the Rust experiment over: Rust is now a permanent part of the kernel, Android 16 devices already ship a kernel memory subsystem written in it, and the graphics driver maintainers said they were about a year from requiring Rust for new drivers.

AI adds its own risks. Model weights were long shared as Python pickle files, which can run arbitrary code the moment they are loaded. Hugging Face, EleutherAI and Stability AI backed safetensors, a Rust-built format that stores only data, and had it audited by Trail of Bits, which found no flaw allowing code execution. It has since become the default way Hugging Face’s libraries save models. For an AI service that loads files and prompts from strangers, a smaller attack surface matters.

Reason 3: Python developers keep Python

Earlier attempts to replace Python in machine learning asked researchers to learn a new language. Rust adoption has worked because it does not. Each of the Rust projects below ships as a Python (or JavaScript) package, so the person using it never sees Rust. The team that maintains the package gets speed and safety, and everyone else just gets a faster library.

LayerRust-based projectWhat it does
TokenizationHugging Face tokenizersTurns text into model tokens; Rust is the reference implementation, with Python and Node.js bindings
TokenizationOpenAI tiktokenToken counting and encoding for GPT models; Rust core, Python interface
Model filessafetensorsLoads model weights as plain data, with no code execution on load
InferenceCloudflare InfireServes LLMs on Cloudflare Workers AI; replaced vLLM for some models
InferenceHugging Face CandleMinimal machine learning framework for running models without Python
DataPolarsData frame library used as a faster alternative to pandas
Vector searchQdrantVector database for retrieval and AI search
Developer toolsuv, Ruff, ty (Astral)Python package manager, linter and type checker; now part of OpenAI’s Codex team
Coding agentsOpenAI Codex CLITerminal coding agent, rewritten from TypeScript to Rust in 2025

Reason 4: Agents and AI tools want single, sandboxed binaries

When OpenAI open-sourced its Codex CLI coding agent in April 2025, it was written in TypeScript on Node.js. By June it had announced a rewrite in Rust. Its stated reasons map neatly onto what AI agents need: no Node.js install for users, native access to operating system sandboxing (Landlock on Linux) so the agent cannot touch what it should not, lower memory use with no garbage collector, and an existing Rust implementation of the Model Context Protocol for connecting to tools. The npm package is now a thin wrapper that downloads the Rust binary.

In March 2026, OpenAI agreed to acquire Astral, maker of uv, Ruff and ty, and moved the team into Codex. All three are written in Rust and run many times faster than the older Python tools they replace. In the 2025 Stack Overflow survey, uv was the most admired technology tag. An AI agent that installs packages, lints and type-checks code thousands of times a day benefits directly from tools that finish in milliseconds.

Developers want to write it

Rust has topped Stack Overflow’s admired list for years, and the 2026 survey keeps it there among widely used languages. Its admired score has eased from 83% in 2024 and 72% in 2025 to 67% in 2026 as more people use it for everyday work, while its usage moved up to 12th place overall.

Most admired programming languages, 2026Rust67%Elixir62%Zig58%TypeScript53%SQL51%Python51%Go50%C++46%
Source: Stack Overflow Developer Survey 2026 (n = 14,099 answering this question). Admired = share of people who used the language this year and want to keep using it. Languages with fewer than 50 admiring respondents (Elm, Odin) are left out.

Inside companies, the 2025 State of Rust Survey of 7,156 developers found 48.8% of represented organizations make non-trivial use of Rust, up from 38.7% two years earlier. 55.1% of respondents use it daily, and 84.8% of those using it at work say it helped their company meet its goals.

What is slowing the move down

Rust is not taking over AI wholesale, and anyone planning a team around it should know the limits:

  • Training stays in Python, C++ and CUDA. PyTorch, GPU kernels and most training code are not moving. Rust’s gains are in serving, data handling and tooling.
  • vLLM and other Python servers still lead. Cloudflare built Infire for an unusual setup, a global edge network with tight security rules. Most teams running a few large GPU servers still use vLLM or similar engines.
  • The learning curve is real. Rust’s ownership rules take time to learn, and slow compile times are the top frustration in the State of Rust Survey.
  • The talent pool is small and senior. Most Rust developers are experienced engineers who learned it on top of C++, Go or Python. Survey respondents report it is much harder for junior developers to land Rust jobs, which also means fewer people coming up through the pipeline.

What it means for hiring

Rust skills are concentrated in a small group of senior engineers, and AI companies, cloud providers and security-focused teams all want the same people.

  • Hire for systems skills, not just the language. Strong C++, Go or performance-minded Python engineers can learn Rust; someone who knows Rust syntax but not memory, concurrency or networking will struggle.
  • Be clear about which layer the job is in. “AI engineer” can mean prompt work in Python or GPU batching in Rust. Name the actual work: inference serving, data pipelines, Python bindings, or agent tooling.
  • Expect longer searches and stronger offers for engineers who combine Rust with GPU, inference or Python packaging experience.
  • Consider training. The lead of the Rust for Linux project has urged companies to give their engineers time to learn Rust, and many teams grow Rust talent internally from their C++ and Go engineers.

Hiring engineers for AI infrastructure or systems work? See our software developer recruiters and IT recruiting pages, check pay with our software developer salary calculator, or read about the people building the facilities in our data center workforce report.

Interview questions for Rust infrastructure engineers

  1. Explain Rust’s ownership and borrowing rules to someone who writes Python. What bugs do they prevent?
  2. Tell me about a time you profiled a slow service. What did you measure, what did you change, and what did it save?
  3. Have you exposed Rust code to Python or another language? How did you handle errors and data passing across the boundary?
  4. When would you use async Rust, and when would you avoid it?
  5. Where have you used unsafe code, and how did you keep it contained and tested?
  6. How would you batch requests to a GPU-backed model so the GPU stays busy without making users wait?

Frequently asked questions

Is Rust replacing Python in AI?

No. Python remains the main language for model research, training and application code. Rust is replacing C, C++, Node.js and some Python in the layer underneath: tokenizers, model loaders, inference servers, data tools and developer tooling. Most of that Rust code is used through Python packages.

Why do AI companies choose Rust over C++?

Rust offers similar speed with memory safety built into the compiler, which removes the most common class of serious security bugs. It also has a modern package manager and good tools for building Python bindings. Government guidance from the NSA and CISA now encourages memory-safe languages for new code.

Which AI tools are written in Rust?

Public examples include Hugging Face tokenizers, safetensors and Candle, the core of OpenAI’s tiktoken, OpenAI’s Codex CLI, Cloudflare’s Infire inference engine, the Polars data frame library, the Qdrant vector database, and Astral’s uv, Ruff and ty Python tools.

How many companies use Rust?

In the 2025 State of Rust Survey, 48.8% of respondents said their organization makes non-trivial use of Rust, up from 38.7% in 2023. That survey reaches people already interested in Rust, so it overstates use across all companies, but the growth trend is clear.

For more on where AI work is heading, see our AI jobs statistics and our AI and machine learning interview questions. More stories like this are on our AI for Engineers hub.

Sources

Share it
Facebook
Twitter
LinkedIn
Email

Categories

Related Posts

YOUR NEXT ENGINEERING OR IT JOB SEARCH STARTS HERE.

Don't miss out on your next career move. Work with Apollo Technical and we'll keep you in the loop about the best IT and engineering jobs out there — and we'll keep it between us.

HOW DO YOU HIRE FOR ENGINEERING AND IT?

Engineering and IT recruiting are competitive. It's easy to miss out on top talent to get crucial projects done. Work with Apollo Technical and we'll bring the best IT and Engineering talent right to you.