ravencoming soon

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:

Raven Python equivalent Description
nx NumPy N-dimensional arrays with CPU and Metal backends
hugin Matplotlib 2D plotting with Cairo and SDL backends
quill Jupyter Notebooks as markdown files
rune JAX Automatic differentiation (JIT coming post-v1)
kaun PyTorch/Flax Neural network layers and optimizers
sowilo OpenCV Differentiable computer vision operations

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 →