Jan Ypma

Independent software architect | Senior Developer | Coach
Ypma Consulting ApS
Denmark

About

Jan Ypma is an independent software architect and coach, with specializations in distributed systems, the JVM, functional programming, open source, and Domain-Driven Design. His broad experience across technologies, sectors, and company sizes gives him a creative approach to finding solutions, using a blend of people and technology. This is further fueled by his personal interests in home automation and modular synthesizers. He is a regular conference speaker and facilitator.
Talk

Jan Ypma | Type-safe tensors to help human learning

Machine Learning, Tensor Computation, Type Safety, Scala
The field of machine learning often uses Python and its PyTorch library by default for both education and real-world industry projects, due to the perceived friendliness of the language and its ability to run on GPU hardware. However, the inability to track tensor dimensions and data types has resulted in most practical code being littered with comments that hopefully explain the current shape of the calculation. There should be a better way.In this presentation, Jan Ypma first gives an introduction to tensors and the role they play in machine learning. Then, he presents an approach that uses the Scala type system to track all dimensions, the data type, and the device of a PyTorch tensor. He shows how concepts like matrix multiplication and broadcasting rules are applied in a type-safe manner, and how it is possible to refer to specific dimensions by their type, rather than by their index, all while preserving the same GPU performance that PyTorch normally offers.A typical “transformer” neural network architecture is shown, with an exploration of how having strong types tremendously improves code discoverability. Nice examples also demonstrate how Scala-specific syntax can further improve the legibility of neural network code.