raven
modern scientific computing for OCaml
raven
Raven is an ecosystem of composable libraries for numerical computing in OCaml. Tensors, automatic differentiation, neural networks, dataframes, plotting, tokenization, computer vision, reinforcement learning, and interactive notebooks — each library does one thing well, and they compose cleanly together.
Built on OCaml 5's effect system, Raven uses function transformations — grad, vmap, jit — that compose freely because they are nested effect handlers. The same code that runs a training loop on your laptop can target Metal or CUDA. Types catch shape and dtype mismatches at compile time.
see it in action
Tokenize text, build a classifier, and train it — three libraries working together:
open Kaun
(* Tokenize text with Brot *)
let tokenizer = Brot.from_file "tokenizer.json" |> Result.get_ok
let encode text = Brot.encode_ids tokenizer text
(* Build a model with Kaun *)
let model = Layer.sequential [
Layer.embedding ~vocab_size:30522 ~embed_dim:128 ();
Layer.relu ();
Layer.linear ~in_features:128 ~out_features:2 ();
]
(* Train with automatic differentiation — Rune under the hood *)
let trainer = Train.make ~model
~optimizer:(Optim.adam ~lr:(Optim.Schedule.constant 1e-3) ())
let st = Train.init trainer ~dtype:Nx.Float32
let st = Train.fit trainer st train_data
the ecosystem
foundation
machine learning
data and visualization
tools
get involved
Raven is built in public. We need your help:
- Try it out — install the libraries, run the examples, tell us what breaks
- Report issues — found a bug? Missing a feature? Let us know
- Join the conversation — API decisions happen in GitHub discussions
- Contribute — check out good first issues
support the project
Building a scientific computing ecosystem takes time and focus. Your sponsorship helps us deliver on our roadmap — GPU backends, performance parity, and comprehensive documentation.