Members-Only
Recent Talks & Demos are for members only
You must be an AI Tinkerers active member to view these talks and demos.
Rust Compiler Autodiff Hacking
Learn how to build a Rust compiler with automatic differentiation, inspect LLVM IR rewrites, replace manual backpropagation, and train a Rust-translated LLM model.
I will start by showing everyone how simple it is to compile your own Rust compiler with support for automatic differentiation enabled.
Due to time constraints, I will just show the commands, and not run the actual build.
Next, we want to see it working, so I will compile some Rust code into the LLVM Intermediate Representation (IR) and show how our tool for automatic differentiation rewrites the IR to compute derivatives. I will show the different IR rewrite steps to explain why LLVM is usually very efficient here, and what is currently the best way to crash it.
As a final, bigger example I will introduce a Rusty version of Karpathy’s llm.c model which was auto-translated by rust2c.
With git show I will go through a diff which deletes hundreds of lines from Karpathy that implemented backpropagation manually, since we can replace them with a single line of std::autodiff. I will then run the code to train the model.
Adds automatic differentiation to Rust for differentiable programming and optimization.
Enzyme automatically computes high-performance gradients from existing LLVM IR code.
- RustRust is a high-performance systems programming language that guarantees memory and thread safety via its compile-time ownership model.Rust is a statically-typed systems language engineered for performance and reliability, directly challenging C/C++ in speed. Its core innovation is the ownership model and 'borrow checker,' which enforces strict memory and thread safety at compile-time, eliminating data races and null pointer dereferences without a conventional garbage collector. Rust achieves near-native speed through 'zero-cost abstractions,' allowing high-level features to compile into highly optimized code. Major industry players, including Microsoft and Cloudflare, leverage Rust for critical infrastructure, and it is now officially supported for development in the Linux kernel.
- LLVMLLVM is a modular compiler and toolchain infrastructure, providing reusable, language-agnostic components for high-performance compilation and optimization.LLVM is a collection of modular compiler and toolchain technologies, designed for maximum reusability and performance. Its core is the Intermediate Representation (IR), a portable, high-level assembly that acts as the optimization target between the frontend and backend stages. This three-part architecture allows projects like Clang (for C/C++) and compilers for Swift and Rust to share a single, powerful optimization and code generation engine. This flexibility enables efficient, cross-platform compilation for diverse architectures: from x86 and ARM to GPUs, making LLVM a foundational component in modern operating systems and development toolchains.
- EnzymeProtein biocatalysts: accelerating specific chemical reactions (EC 1 to EC 6) for sustainable, high-efficiency industrial and medical applications.Enzyme technology leverages biocatalysts, typically proteins, to accelerate specific chemical reactions with superior efficiency. This field is critical, spanning industries from food processing (e.g., using Renin for cheese) to pharmaceuticals and biofuels. By employing engineered enzymes, often produced via recombinant DNA technology, processes become more sustainable, requiring less energy and producing less toxic waste than traditional chemical synthesis. For instance, the use of proteases and lipases in modern detergents allows for effective cleaning at lower wash temperatures, a direct energy-saving benefit. The objective is clear: design innovative, competitive, and environmentally sound products.
- rust2cC2Rust is the high-efficiency transpiler that automatically migrates C99-compliant codebases to functionally equivalent, though initially unsafe, Rust.This is C2Rust: the essential tool for migrating legacy C code to a safer Rust environment. Developed by Galois and Immunant, the core `c2rust transpile` utility converts C99 code into semantically identical Rust, primarily using `unsafe` blocks to maintain functionality. The primary objective is to automate the costly first step of migration, providing a functional Rust codebase that passes original test suites. The broader C2Rust project includes a refactoring component and cross-checking tools: this allows development teams to incrementally lift the auto-translated code into safe, idiomatic Rust, effectively eliminating memory corruption vulnerabilities at scale.
- LLMLarge Language Models (LLMs) are deep learning models, built on the Transformer architecture, that process and generate human-quality text and code at scale.LLMs are a class of foundation models: massive, pre-trained neural networks (often with billions to trillions of parameters) that leverage the self-attention mechanism of the Transformer architecture (introduced in 2017) to predict the next token in a sequence. Trained on vast datasets (e.g., Common Crawl's 50 billion+ web pages), these models—like GPT-4, Gemini, and Claude—acquire predictive power over syntax and semantics. They function as general-purpose sequence models, enabling critical applications such as complex content generation, language translation, and automated code completion (e.g., GitHub Copilot). Their core value: generalizing across diverse tasks with minimal task-specific fine-tuning.
Related projects
CrustyCrab: An Experimental LLM-based C-to-Rust Translator
New York City
This talk explores using large language models to translate legacy C code into safe, idiomatic Rust, improving memory…
Working with AI: Code Conversion (Delivered by Dwayne Forde)
Toronto
Learn how an LLM‑driven workflow automates bulk code conversion, preserving context, and frees engineers to tackle critical project…
Chat with your codebase using Rust and Candle
Amsterdam
Learn to build a Rust CLI using Candle ML to create a local, hardware‑agnostic code‑assistant that lets you…
The fastest cold starts in the world - a new type of docker registry and kubernetes written in rust
London
Learn how a Rust‑based Docker registry and rebuilt containerd reduce AI model cold start times by 3‑6×, with…
AI-Guided RISC-V Datapath Visualization
Toronto
Learn how an AI‑driven RAG chatbot integrates with a RISC‑V single‑cycle and 5‑stage pipeline visualizer to explain execution…
Automated Documentation: Bridging the Documentation Void
Toronto
The demo shows how a pipeline of fine‑tuned LLMs converts a recorded terminal session into structured events and…