I am broadly interested in programming languages, compilers, verification and concurrency.
I'm particularly motivated by methods that empower programmers to write correct and efficient
software in the real world, bridging theory and practice.
For my master's dissertation, I worked with
Maximillian Doré
on designing and implementing a new programming language that combines algebraic effect types
and quantitative types using a behavioural effect type system.
For my bachelor's dissertation, I worked with
Nobuko Yoshida and
Joe Paulus on developing the syntax,
semantics and model-checking procedure for probabilistic multiparty session types. I was awarded the
Department of Computer Science Prize for Best Project in Part B
for this work.
Model Checking Probabilistic Multiparty Session Types
Aleksander Junge*, Leo Seojun Lee*, Joseph Paulus, Nobuko Yoshida, David Parker
POPL 2027 (to appear)
Preprint
Code
Abstract
Distributed systems increasingly rely on randomisation; yet, verification techniques for such systems remain separate from the programming abstractions used to build them. This paper proposes the first probabilistic extension of general multiparty session types - typing sessions bottom-up, with no global specification - deriving quantitative properties of a multiparty session from its session types alone. Our types combine probabilistic choice with nondeterministic choice that abstracts data-dependent control, and allow separated choices, where each branch of a selection or branching may involve a different participant - a combination beyond previous probabilistic multiparty session type systems. To achieve this, we develop a novel probabilistic subtyping relation and merge operator, using which we prove type soundness and session fidelity. The semantics of typing contexts separates nondeterministic resolution, probabilistic choice, and synchronisation, so that every typing context induces a finite Markov decision process. On it, we derive sound lower bounds, holding under every fair adversarial scheduler, on the probability that a session is deadlock-free and live - the first behavioural property guarantees, partial or otherwise, for a probabilistic session calculus. To connect session types with probabilistic model checking, we introduce the first translation from session types into the PRISM modelling language, and prove it sound and complete with respect to our operational semantics. We implement the framework in the toolchain Prose, which translates probabilistic multiparty session typing contexts into PRISM and checks safety, deadlock-freedom, and liveness.
About Tyme: Reconciling Algebraic Effects and Linearity Through Behavioural Effect Types
Leo Seojun Lee
Master's dissertation
PDF
Code
Abstract
Linear type systems statically guarantee that resources are used the right number of times. However, they break down in the presence of multi-shot algebraic effect handlers, which can invoke their captured continuations more than once and cause linearly-bound resources to be used more times than the type system permits. Existing approaches to this tension forbid multi-shot effects in linear contexts, sacrificing expressivity. In this project, we design and implement Tyme, a functional programming language with a novel type system that instead scales resource usage by the exact number of continuation invocations. We do this by designing a behavioural effect type system, inspired by session types and related behavioural type systems, that tracks the possible sequences of effect invocations. The resulting precision, together with a quantitative type system based on a non-dependent fragment of Atkey’s quantitative type theory, allows us to support precise resource annotations on functions using a resource algebra forming an ordered semiring, even in the presence of multi-shot effects. We prove our system to be sound, and give a semantic justification using a typed CPS transform of a fragment of our core calculus to a calculus without effects. To our knowledge, Tyme is the first language in which a function may be linear in its arguments while invoking multi-shot effects that can capture the arguments.
Verification of Probabilistic Distributed Protocols with Multiparty Session Types
Leo Seojun Lee
Bachelor's dissertation
PDF
Code
Abstract
Multiparty session types (MPST) ensure that distributed systems correctly implement error-free communication protocols. However, many real-world protocols exhibit probabilistic behaviour, which MPST cannot capture. To address this, we propose the first probabilistic extension to bottom-up MPST and implement a verification procedure using the PRISM model checker. We define a translation from types into PRISM and prove its soundness and completeness with respect to their operational semantics. Moreover, we evaluate the practicality of our implementation through case studies and measuring its performance across a diverse set of examples.
Mind the Abstraction Gap: Bringing Equality Saturation to Real-World ML Compilers
Arya Vohra*, Leo Seojun Lee*, Jakub Bachurski, Oleksandr Zinenko, Phitchaya Mangpo Phothilimthana, Albert Cohen, William S. Moses
OOPSLA 2025
PDF
Code
Abstract
Machine learning (ML) compilers rely on graph-level transformations to enhance the runtime performance of ML models. However, performing local transformations on individual operations can create effects far beyond the location of the rewrite. In particular, a local rewrite can change the profitability or legality of hard-to-predict downstream transformations, particularly regarding data layout, parallelization, fine-grained scheduling, and memory management. As a result, program transformations are often driven by manually-tuned compiler heuristics, which are quickly rendered obsolete by new hardware and model architectures.
Instead of hand-written local heuristics, we propose the use of equality saturation. We replace such heuristics with a more robust global performance model, which accounts for downstream transformations. Equality saturation addresses the challenge of local optimizations inadvertently constraining or negating the benefits of subsequent transformations, thereby providing a solution that is inherently adaptable to newer workloads. While this approach still requires a global performance model to evaluate the profitability of transformations, it holds significant promise for increased automation and adaptability.
This paper addresses challenges in applying equality saturation on real-world ML compute graphs and state-of-the-art hardware. By doing so, we present an improved method for discovering effective compositions of graph optimizations. We study different cost modeling approaches to deal with fusion and layout optimization, and tackle scalability issues that arise from considering a very wide range of algebraic optimizations. We design an equality saturation pass for the XLA compiler, with an implementation in C++ and Rust. We demonstrate an average speedup of 3.45% over XLA’s optimization flow across our benchmark suite on various CPU and GPU platforms, with a maximum speedup of 56.26% for NasRNN on CPU.
* equal contribution