raven

modern scientific computing for OCaml

raven

Raven is a comprehensive ecosystem for scientific computing in OCaml.

Everything you know from Python, rebuilt with type safety and functional programming:

Core Libraries:

Raven Project Python Equivalent Description
nx NumPy N-dimensional arrays with pluggable backends
saga Tokenizers/spaCy Text processing and tokenization for NLP
talon pandas/Polars DataFrames with heterogeneous columns and rich API
hugin Matplotlib Publication-quality data visualization and plotting
quill Jupyter A love letter to scientific writing

Rune Ecosystem:

Raven Project Python Equivalent Description
rune JAX Autodiff with multi-device support and JIT compilation
kaun PyTorch/Flax Deep learning framework built on Rune
fehu Gymnasium/Stable Baselines3 Reinforcement learning environments and algorithms
sowilo OpenCV Computer vision framework built on Rune

why raven?

Python's monopoly on scientific computing forces an impossible choice: use Python for everything, or prototype in Python then rewrite for production.

We think there's a better way. OCaml lets you prototype as quickly as Python, but the same code scales to production. Strong typing catches bugs before they crash your ML pipeline. JIT compilation matches NumPy/PyTorch performance. Pluggable backends let you run the same code on CPU, Metal, or CUDA.


see it in action

Here's what scientific computing looks like with type safety:

(* Load and plot some data *)
open Nx
open Hugin

let x = linspace float32 0. (2. *. Float.pi) 100
let y = Nx.map Float.sin x
let noise = randn float32 (shape x) |> mul_scalar 0.1
let y_noisy = add y noise

let fig = figure ()
let ax = subplot fig
let _ = 
  ax
  |> Plotting.scatter ~x ~y:y_noisy ~alpha:0.5 ~label:"data"
  |> Plotting.plot ~x ~y ~color:Artist.Color.red ~label:"true"
  |> Axes.legend
in
show fig

(* Type error at compile time, not runtime: *)
(* let z = add x (ones float64 [|50|])  -- Won't compile! *)

The compiler catches shape and dtype mismatches before they crash your pipeline.


join us

Raven is pre-alpha. Things will break. APIs will change. But the foundations are solid.

We're building in public and need your help:

View on GitHub →


support the project

Building a complete scientific computing ecosystem takes time and focus. We're raising funds to work on Raven full-time and deliver on our roadmap.

Your sponsorship helps us release a stable V1 with GPU backends, achieve NumPy/PyTorch performance parity, and build comprehensive documentation and tutorials.

Support Raven →