freenode
Languages & Toolchains

OCaml LLVM compiler draws LGPL accusations over LLM rewrite

Samuel Marks's Apache-licensed olang claims OCaml 5.5 parity, but core developers say it tracks upstream internals the literature does not specify.

Samuel Marks has published olang 0.0.1, an OCaml compiler written in Rust that lowers through MLIR to stock LLVM 23, and licensed the compiler and a replacement standard library under Apache-2.0 with the LLVM exception. On the OCaml Discourse, that license choice immediately drew a charge that the project is a derived work of the LGPL OCaml compiler libraries, whether or not a language model did the writing.

Florian Angeletti, of the OCaml team, wrote that delegating a copyright violation to LLM agents does not change the result: a product derived from the compiler libraries is "henceforth compelled to be LGPL." He rejected Marks's claim that the typechecker, pattern compiler, module system, and runtime were rebuilt from published papers and black-box tests against ocamlopt. The academic literature, he wrote, does not exhaustively specify the typechecker. "If you are reproducing its behaviour, you are translating the only specification existing, in other words the LGPL code."

Daniel Bünzli supplied a concrete example. The bit-packing scheme olang uses for Uchar.utf_decode matches one he says he invented for upstream OCaml and that is not described in the public interface. He said he would not stop anyone from reusing the trick, but that the match "suggests that your LLM had a closer look to the OCaml implementation that you seem to want to admit."

Marks conceded that his first defense overstated how much of the typechecker is in the literature, and that frontier models were almost certainly trained on the OCaml repository. He maintained that olang does not link, embed, or translate compiler-libs, that its semantic analyzer is a smaller Rust implementation that will reject some valid programs, and that matching observable behavior is not copying protected expression. He said the utf_decode layout was weight recall, not a lifted file, and that he would change the packing. He also likened the project to Clang, Flang, and PyPy, independent implementations that did not inherit the reference compiler's license.

Early numbers Marks posted, nine microbenchmarks on an Apple M3 Pro against OCaml 5.5.2, show ahead-of-time compile-and-link sometimes faster than ocamlopt and warmed execution far slower on most tests. He attributed the runtime gap to shadow stacks, a bring-up choice for fiber and multicore parity on unpatched LLVM, and said a later move to LLVM stackmaps is contained in the backend.