PyCon DE & PyData 2025

What's inside the box? Building a deep learning framework from scratch.
2025-04-25 , Ferrum

Explore the inner workings of deep learning frameworks like TensorFlow and PyTorch by building your own in this workshop. We will start with the fundamental automatic differentiation mechanics and proceed to implementing more complex components like layers, modules and optimizers. This workshop is mainly designed for experienced data scientists, who want to expand their intuition about lower level framework internals.


Data scientists typically concentrate on the mathematical foundations when designing and training neural networks, often treating the process by which deep learning frameworks link high-level code with lower-level mathematical operations as a black box. As a result, the internal workings of these frameworks are frequently overlooked.

This workshop is aimed to open the black box by letting the participants construct a small deep learning framework from scratch. We will begin with creating a simple automatic differentiation engine, followed by more advanced elements such as modules, and optimizers.

As a result, the participants will be able to construct and train a neural networks architecture using the framework they have built in just 1.5 hours.

The detailed text guide and solutions for all of the exercises are going to be provided as a public GitHub repository.

After constructing the framework from scratch, the participants will gain a comprehensive understanding of:
- the inner workings of deep learning frameworks;
- the mapping of high-level framework components to lower-level operations;
- the operational principles of autograd engine and dynamic computational graphs;
- higher-level abstractions such as modules, and their mechanisms of automatic parameters tracking;

Target audience

This workshop is primarily intended for those with some experience in building deep learning models using popular frameworks like PyTorch, TensorFlow, or JAX. However, prior experience is not absolutely mandatory, as essential fundamentals will be briefly covered.

Outline

Introduction, motivation and essential theory [15 min]
Implementation [60 min]
Tensors + autograd engine [25 min]
Modules and layers [25 min]
Optimizers [10 min]
Using the framework to build and train the model [10 min]
Concluding remarks + sharing bonus exercises [5 min]


Expected audience expertise: Domain:

Intermediate

Expected audience expertise: Python:

Intermediate

I am a Data Scientist primarily focused on Deep Learning and MLOps. In my spare time I contribute to several open-source python libraries.

This speaker also appears in: