Skip to content
 
 

Repository files navigation

raven

modern scientific computing for OCaml

docs · install · issues


Raven is an ecosystem of OCaml libraries for numerical computing, machine learning, and data science. Everything you know from Python — NumPy, JAX, PyTorch, Matplotlib, Jupyter — rebuilt with type safety.

Raven is alpha. APIs will change. Feedback welcome.

(* nx — n-dimensional arrays *)
let x = Nx.linspace float32 0. 10. 100
let y = Nx.sin x

(* rune — automatic differentiation *)
let grad_f = Rune.grad' (fun x -> Nx.sum (Nx.mul x x)) x

(* brot — tokenization *)
let tokenizer = Brot.from_file "tokenizer.json" |> Result.get_ok
let ids = Brot.encode_ids tokenizer "The meaning of life is"

(* kaun — neural networks *)
let layer = Kaun.Linear.init ~inputs:768 ~outputs:10
let logits = Kaun.Linear.apply layer x

(* talon — dataframes *)
let df = Talon.create [
  "name", Talon.Col.string_list [ "Alice"; "Bob"; "Charlie" ];
  "score", Talon.Col.float64_list [ 85.5; 92.0; 78.5 ];
]

(* hugin — plotting *)
let () = Hugin.(figure () |> subplot |> Plotting.plot ~x ~y |> ignore; show ())

Packages

Package Like What it does
nx NumPy N-dimensional arrays with linear algebra operations
ᛏ tolk tinygrad Minimal ML compiler for GPU tensor computation
ᚱ rune JAX Automatic differentiation and functional transformations
ᚲ kaun Flax Neural networks and training
ᚹ vega Optax Composable gradient-based optimizers
ᚾ norn BlackJAX MCMC sampling with automatic gradients
ᚨ brot HF Tokenizers Fast, HuggingFace-compatible tokenization
ᛃ talon Polars Fast and elegant dataframes with type-safe operations
ᛞ hugin Matplotlib Publication-quality plotting
ᛈ quill Jupyter + IPython Interactive REPL and markdown notebooks
ᚠ fehu Gymnasium Reinforcement learning environments
ᛋ sowilo OpenCV Differentiable computer vision
ᛗ munin W&B / MLFlow Local experiment tracking with live TUI dashboard

Getting started

opam install raven

This installs the full ecosystem. You can also install only what you need — e.g. opam install kaun for neural networks, or opam install nx for just arrays.

Add to your dune file:

(executable
 (name main)
 (libraries raven))

See the installation guide for system dependencies and editor setup.

Support

Building a scientific computing ecosystem takes sustained effort. Sponsorships help us ship JIT compilation, distributed training, better developer tooling, and production deployment through MirageOS.

Support Raven →

Thanks to our sponsors Ahrefs and Tarides.

License

ISC

About

Modern scientific computing for OCaml

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages