GSoC 2025 Project #7 Brian Simulator :: Brian2Wasm: simulations in the browser (175/350h)

Mentors: Dan Goodman <d.goodman@imperial.ac.uk>, Marcel Stimberg <marcel.stimberg@inserm.fr>, Benjamin Evans <B.D.Evans@sussex.ac.uk>

Skill level: Novice/intermediate

Required skills: HTML, JavaScript, basic C++ and Python

Time commitment: Flexible (175/350 hours)

Forum for discussion

About: Brian is a clock-driven spiking neural network simulator that is easy to learn, highly flexible, and simple to extend. Written in Python, it allows users to describe and run arbitrary neural and synaptic models without needing to write code in any other programming language. It is built on a code-generation framework that transforms model descriptions into efficient low-level code. WebAssembly is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web.

Brian’s code generation pipeline can generate C++ code, and the emscripten toolchain can compile this code into WebAssembly. This makes it possible to run simulations directly in a web browser, requiring no installation on the client side. We have recently created a proof-of-concept, brian2wasm (GitHub - brian-team/brian2wasm), showing the feasibility of this approach.

Aims: The aim of this project is to turn this proof-of-concept into a convenient tool for the wider community. In particular, the aims of this project are to:

  • Improve the general workflow (e.g. detection/configuration of emscripten toolchain)
  • Implement efficient data transfer between the WebAssembly simulation and the JavaScript code that displays the results
  • Provide convenient tools for website customization and plot display
  • Document the package and its usage

Additional goals for a 350h project:

  • Set up an automatic test suite for brian2wasm
  • Provide convenient tools for setting parameters at the start of the simulation (big project)
  • Provide components for real-time interaction with Brian scripts, e.g. providing microphone or camera input to the Brian simulation and returning spikes or other data from the Brian simulation to the website (big project)

Project website: GitHub - brian-team/brian2wasm

Tech keywords: HTML, JavaScript, WebAssembly, emscripten, Python, C++

2 Likes

@d.goodman , @mstimberg , and @benjamin_evans

I am very interested in the brian2wasm project. The aims of the project, particularly improving the workflow and implementing efficient data transfer, align with my skills and interests. I have experience with HTML, JavaScript, and basic C++ and Python, and I’m eager to learn more about WebAssembly and emscripten.

I have reviewed the brian2wasm repository and I am excited by the potential of this project. I am available to commit [175/350] hours to this project, and I am confident that I can make a meaningful contribution.

I would welcome the opportunity to discuss my application and the project in more detail.

Thank you for your time and consideration.

Sincerely,

Vrushali

Dear @d.goodman, @mstimberg I hope you are doing well. My name is Sayan, and I am an AI Researcher at Jadavpur University and ex-Research Intern at IIEST with a strong background in Python, JavaScript, HTML, and basic C++. I am particularly interested in computational neuroscience and its applications in neural network simulations.

I came across the Brian2Wasm project for Google Summer of Code 2025 and found it highly fascinating. The idea of bringing Brian 2 simulations to the web using WebAssembly is an exciting challenge, and I would love to contribute to improving the workflow, optimizing data transfer, and enhancing visualization tools. Given my experience in machine learning, deep learning, and frontend development, I believe I can add value to the project.

I would appreciate any guidance on getting started. I have reviewed the brian2wasm repository and would love to discuss potential contributions, initial tasks, or any prerequisites you recommend. Please let me know if we can set up a call or if there are specific areas where I can begin contributing.

Looking forward to your response!

Hi @Sayan_Mandal1, hi @vrun. Thank you for the interest in our project! I am currently travelling and can not get into details at this time, but I will be back in the office coming Monday and will give you more information then. Until then, you can find some very general information on the website we put up for last year’s GSoC: GSoC 2024 | The Brian spiking neural network simulator The 2024 discussions on neurostars (links in the page linked above) should also give you some ideas. Apologies for not being more precise for now, but I’ll get back to you early next week.

Best,
Marcel

Hi @mstimberg,

Thank you for your response! I appreciate the pointers and will go through the GSoC 2024 page and Neurostars discussions in the meantime. Looking forward to your update next week.

Best,
Sayan

Dear @mstimberg,

I hope you are doing well. My name is Vinayak Kashyap, and I am a BTech student in Computer Science and Engineering at Indus University, India. I am highly interested in contributing to the Brian2Wasm project as part of GSoC and would love to learn more about how I can get involved.

I have experience in C++, Python, and the MERN stack, along with a understanding of Spiking Neural Networks (SNNs), Artificial neural networks (ANNs) and deep learning. I have worked with PyTorch for model development and have previously built a similar project using simpler machine learning models and smaller neural networks for linear regression. My experience with both web development and neural network simulations aligns well with the goals of Brian2Wasm, especially in integrating WebAssembly with Python-based neural network modeling.

I would like to understand more about the user interface design for this project. Will users write their Python code in a built-in code editor in the browser, or will they upload Python files for execution? Additionally, do you envision an interface where users can only modify simulation parameters interactively (similar to the LIF neuron simulation I implemented in a Python Colab notebook with widgets), or should it support both parameter tuning and custom code execution? Clarifying this would help me plan my contributions more effectively.

example:

I am eager to contribute, learn, and collaborate with the community. Please let me know how I can get started and any specific areas where contributions are most needed. Looking forward to your guidance!

Best regards,
Vinayak Kashyap

Hi everyone,
Thanks again everyone for your interest in the project. As I promised last week, here is some more information about the application process and about what we expect from you – I will answer the specific questions you had in separate messages. Here’s a general write-up about the application process and what we would like to see in your application: GSoC 2025 | The Brian spiking neural network simulator

For the brian2wasm project specifically, I’d like you to include two more things:

  1. A write-up of the steps you took to run the examples from the brian2wasm repository (dependency installation, emsdk setup, etc.). In case that you ran into any issues, what these issues were and how you overcame them.
  2. Please provide a new example, consiting of a .py and a .html file, as a pull request to the brian2wasm directory. This could simply be a different example network (e.g. from Examples — Brian 2 2.8.0.4 documentation), a different presentation of the results in the HTML page (see brian2wasm/examples/brunel_hakim1999_style.html at main · brian-team/brian2wasm · GitHub for the general approach), or a different way of setting parameters at the start of a simulation (see brian2wasm/examples/brunel_hakim1999_change_params.html at main · brian-team/brian2wasm · GitHub for one example), or a mix of all of them or something else entirely :slight_smile:

Obviously, please do not hesitate to ask in case anything is unclear.

Good questions, it is always a bit tricky to exactly convey the “niche” we want to fill with brian2wasm. The brian2wasm project is not meant to provide a way to interactively upload or edit code for a model in the browser. For this, you’d either have to have a running server (like Colab provides) or use something like jupyter-lite or pyodide which is comparatively slow. Instead, our target audience would be researchers that have created a Brian2 model and want to share this specific model with the community (e.g. alongside a publication). With brian2wasm, they can use the same code they used for their research and can quickly turn it into a HTML page that can run their model, without the need for a server (since the code runs in the client’s browser), so it can be hosted on a simple web hoster such as github pages. By customizing their HTML page, they can alllow visitors to try out different parameters, or even (this would be related to the goals of the “full-time” project) upload their own inputs or use input from the webcam or the microphone. So in sum, the aim is to enable researchers to provide demos, like you sometimes see in the ML community (e.g. see the IPOL journal: IPOL Journal · Image Processing On Line), but 1) for Brian2 models and 2) without needing to provide a server infrastructure (as IPOL does).

Hope that clears things up a bit?

Thank you @mstimberg for your response. Based on my understanding, we are going to use emscripten toolchain that converts Brian2 model code into WebAssembly along with a JavaScript wrapper. This will allow researchers to compile their Brian2 models into a web-compatible format and upload them to a website. Other users can then modify model parameters and test different configurations directly in their browser.

Currently, Brian2 supports C++ code generation using set_device('cpp_standalone'). My task is to implement a similar approach, something like wasm_standalone, which would first convert the model into C++ and then use Emscripten to compile it into a .wasm file along with a .js wrapper. This would enable researchers to easily share interactive model demonstrations without requiring server infrastructure.

Does this align with the intended goals of the project? Looking forward to your feedback.

Yes, exactly, except for the fact that the wasm_standalone device already exists in the brian2wasm repository :blush: This project is (at least for the 175h “part-time project”) mostly about polishing/testing/documenting the existing code and writing convenience functions (mostly on the JavaScript side) to make this tool easy and pleasant to use.

So my role will be:

:one: Improving the toolchain workflow – Enhancing the detection and configuration of the Emscripten toolchain, ensuring smooth installation, and improving error handling.
:two: Optimizing data transfer – Making WebAssembly-JavaScript communication more efficient for better performance, particularly for large-scale neural models.
:three: Enhancing usability – Developing JavaScript wrapper functions and UI components that allow users to interactively modify model parameters and visualize results in real-time.
:four: Testing and documentation – Writing clear usage guides, tutorials, and improving test coverage to make brian2wasm more accessible to researchers.

Additionally, I plan to develop a working prototype within the next 10 days to demonstrate the initial improvements and validate the approach. This will help identify key areas that require further optimization and refinement.

Looking forward to your guidance as I begin working on this.