A Wasm New Year! trip report

Background

The WebAssembly meetup in Munich has a history that reaches back to 2018. After a long Covid-related hiatus and a lack of organizers to pick up the ball again, A Wasm New Year! was the first event under the new organizing team. Google always had a strong presence at the events, so to continue the tradition I happily agreed to offer a talk at the first post-Covid meetup.

image

Compiling to and Optimizing Wasm with Binaryen

Speaker: Thomas Steiner

In the first half of the talk, I showed at the example of a toy programming language that I called ExampleScript how to write a compiler with Binaryen that compiles the toy programming language to WebAssembly. In the second half, I then demonstrated various optimization techniques in Binaryen and ways to use them from JavaScript with Binaryen.js and from the command line with tools like wasm-opt and wasm-merge.

Resources:

LLM inference with WebAssembly

Speaker: Sven Pfennig

In this talk, Sven showed three ways of how Wasm helps with interacting with large language models (LLM): in the browser, on the command line, and in the cloud. His running example was the task of creating a bedtime story from the PAW Patrol ecosystem for his daughter. First, the speaker demonstrated WebLLM running variants of Llama 2 and Mistral-7B right in the browser. He mentioned the challenges of keeping large models cached, and also showed how these models have trouble with seemingly simple tasks like creating a list of the PAW Patrol members, where the model would plain hallucinate a member that never existed. Second, Sven showed how to use the run-llm.sh script to get an LLM running on-device with WasmEdge. He noted the usefulness of this approach to mock an OpenAI API response due to the compatibility of the responses. Finally, he showed Fermyon’s Spin solution to create serverless WebAssembly apps, run them locally, and finally deploy them to the Fermyon cloud.

Resources:

There was huge interest for Wasm on the server. People were particularly curious about WASI, the WebAssembly System Interface. It’s an API in the process of standardization that provides access to several operating-system-like features, including files and filesystems, Berkeley sockets, clocks, and random numbers. (There’s also a proposal for wasi-nn, a WASI API for performing ML inference modeled closely after WebNN.)

The company that hosted the meetup, Liquid Reply, is pitching WebAssembly as a solution for creating production-grade Wasm apps on Kubernetes and hosting a workshop titled Create Production-Grade Wasm Applications on Kubernetes at the upcoming Wasm I/O conference in March 2024 (where Thomas Nattestad and I are going to present on WebAssembly at Google, alongside with Kevin Moore, who’s going to present Flutter, Dart, and WASM: Shipping a new model for Web applications).

I also got a fair amount of questions on WasmGC and what it means for compiling new programming languages to Wasm. The strategy of writing a higher-level article (WebAssembly Garbage Collection (WasmGC) now enabled by default in Chrome) and a lower-level article (A new way to bring garbage collected programming languages efficiently to WebAssembly) really paid off and I could point developers at either of the two, dependent on how deep they wanted to go.