Writing ·

Mirror, mirror on the wall, which is the best programming language (for AI/ML) of them all?

Originally on LinkedIn

Ask a room of practitioners which language is “best” for AI/ML and you will get confident answers that mostly mean “best for my constraints.” The mirror does not lie so much as it reflects the job: research velocity, production latency, safety, ecosystem, hiring, and the shape of the problem.

This post expands on a simple map I shared on LinkedIn: Python as the default, C++ when performance and realtime matter, Rust as a serious challenger, and a set of niche languages that still earn their keep in the right corners.

The problem with “best”

Language wars waste time because they pretend the objective function is singular. In AI/ML work it is not.

You might be:

One language rarely wins all of those. Architecture usually looks like a polyglot pipeline: productive languages at the edges of experimentation, systems languages on the hot path, and clear contracts between them.

Python: the default for good reasons

Python remains the centre of gravity for AI/ML—and not only because of hype.

Why it wins so often:

Where it hurts:

Practical stance: use Python as the default for training, experimentation, orchestration, and many serving paths—especially when backed by native kernels. Do not treat it as a religion when the hot path needs more.

C++: when performance and control are the product

C++ still matters where you own the metal: custom operators, high-performance inference engines, realtime systems, game/simulation loops, robotics-adjacent stacks, and low-level library development.

Why it remains relevant:

Trade-offs:

If your differentiator is milliseconds and resource efficiency, C++ (often with Python bindings) is not nostalgia—it is strategy.

Rust: the challenger with a point

Rust has been earning attention in infrastructure, and AI systems are infrastructure-heavy: tokenisers, servers, data pipelines, agent runtimes, safety boundaries around tools.

What Rust offers:

What to watch:

Rust is a strong choice when you are building durable platforms around models—not always when you are still discovering the model.

Niche languages that still matter

Not every useful tool sits in the Python/C++/Rust triangle.

These are not “obsolete.” They are specialised instruments. Forcing everything into Python can destroy domain productivity; refusing to modernise interfaces can isolate teams. Bridge thoughtfully.

How to choose without self-mythology

Use a decision lens:

  1. Stage — exploring vs scaling vs hardening
  2. SLO — latency, throughput, memory, determinism
  3. Risk — safety, compliance, side-effectful tools
  4. Team — skills you have vs skills you can hire
  5. Boundary — what must be a library vs a service vs a notebook

A healthy pattern: prototype in Python, extract hot paths to C++/Rust (or highly optimised libraries), serve behind stable APIs, and keep evaluation harnesses language-agnostic where possible.

Practical recommendations

Closing

The best language for AI/ML is the one that minimises time-to-correct-learning for your current stage—and does not box you in for the next. Python is the mirror most of us see first. C++ still owns hard performance. Rust is a credible challenger for safe systems around intelligence. Niche languages remain rational in their domains.

Choose deliberately. Bridge with contracts. Keep the argument about outcomes, not identity.

← All writing