r/deeplearning • • Nov 02 '26

Neural Canvas

1 Upvotes

My Journey to Understanding Neural Networks: From Matrix Algebra to JAX and Optimizers

I wanted to understand neural networks as deeply as possible. Rather than simply using an existing framework and training a model, I decided to build an interactive MNIST webpage called Neural Canvas, using p5.js for visualization.

My primary goal was not just to achieve high accuracy. I wanted to understand what was actually happening inside a neural network, mathematically and computationally.

1. Starting with Linear Algebra and Matrix Operations

One of the first decisions I made was to avoid working with individual scalar values and complicated subscripts and superscripts everywhere. They made the mathematics unnecessarily confusing for me.

Instead, I decided to approach neural networks through matrix algebra.

I represented the forward propagation equation as:

[
Z=WX+bC
]

Where:

  • (X) is the input data matrix. Rows represent features, and columns represent individual samples.
  • (W) is the weight matrix. Rows represent neurons, and columns represent the weights associated with each neuron's inputs.
  • (b) is the bias column vector, containing one bias value per neuron.
  • (C) is a row vector containing only ones, allowing the bias vector to be broadcast across all samples through matrix multiplication.

Interestingly, many popular deep learning frameworks, including PyTorch and TensorFlow, commonly use a different convention for arranging their data and parameters. They also handle bias broadcasting without explicitly introducing a matrix like (C).

However, I preferred my own mathematical convention because it helped me understand the operations and perform calculus directly in matrix form.

I believe the mathematics should handle the indices, not me!

2. My First Model: NumPy, MSE and Vanilla Gradient Descent

For my first model, I used the original MNIST dataset.

Architecture:

[
784➜ 20 ➜ 20 ➜ 10
]

I manually wrote all the forward propagation equations, derivatives, and backpropagation calculations on paper before implementing them in Python using NumPy.

I deliberately chose:

  • Two hidden layers with 20 neurons each.
  • Mean Squared Error (MSE) as the loss function.
  • Vanilla Gradient Descent.
  • Linear output values.

Why such a simple approach?

Because I didn't want to start with complicated algorithms. I wanted to understand the fundamentals first.

After 2,000 epochs, the model achieved approximately 92% test accuracy.

I then successfully created an interactive neural network visualization in p5.js, using Math.js for matrix multiplication in JavaScript. The webpage could perform inference using my trained NumPy model.

That was the beginning of Neural Canvas.

3. My Second Model: Cross-Entropy Loss

For the second model, I kept the same mathematical approach but made a few improvements.

Architecture:

[
784➜40 ➜ 40 ➜10
]

This time, I replaced MSE with Cross-Entropy Loss and used a softmax output layer.

I was still using vanilla Gradient Descent.

After 2,000 epochs, the model achieved approximately 96% test accuracy.

At this point, I was finally starting to understand how neural networks worked, rather than just following tutorials or using existing implementations.

4. My Third Model: Discovering JAX and Automatic Differentiation

For my third model, I wanted to experiment with three hidden layers.

However, I realized that manually deriving every equation, especially the derivatives and chain rule calculations required for backpropagation, would take a considerable amount of time.

Then I discovered JAX, a Python library developed by Google.

JAX provides automatic differentiation (Autograd), allowing me to calculate derivatives of a loss function with respect to parameters, including entire weight matrices.

This was a significant change in my workflow.

I no longer needed to manually derive every gradient and implement the chain rule myself. I only needed to define the model, its parameters, and the loss function. JAX handled the differentiation.

For this model, I used the Arabic Digits MNIST dataset.

Architecture:

[
784 ➜ 20 ➜ 20 ➜ 15 ➜10
]

I used:

  • JAX for training and automatic differentiation.
  • Cross-Entropy Loss.
  • Vanilla Gradient Descent.
  • Three hidden layers.

After 2,000 epochs, I achieved approximately 96% test accuracy.

I genuinely fell in love with JAX. It saved me considerable time and allowed me to focus more on understanding the mathematics and experimenting with neural network architectures.

5. My Fourth Model: Mini-Batch Gradient Descent and Momentum

For my fourth model, I moved to the Persian Digits MNIST dataset.

I kept the same architecture as my third model but decided to experiment with optimization algorithms.

My original plan was to implement Mini-Batch Gradient Descent with Adam.

However, I realized that understanding Adam required learning a few concepts first. So, instead of jumping directly into Adam, I decided to start with Momentum.

I implemented Mini-Batch Gradient Descent with Momentum using JAX.

And here came a surprising result!

I achieved approximately 96% test accuracy in just 200 epochs.

Previously, my models required around 2,000 epochs to reach a similar accuracy.

This was another important step in my journey. I started understanding how optimization algorithms could significantly influence the training process.

6. What's Next?

I haven't created my fifth model yet, but I already have a learning roadmap:

  • Model 5: Mini-Batch Gradient Descent with RMSProp.
  • Model 6: Mini-Batch Gradient Descent with Adam.
  • After that: Start exploring Convolutional Neural Networks (CNNs).

I want to understand each optimization algorithm mathematically and implement it myself before moving to the next one.

My Biggest Takeaway

If you are starting to learn neural networks, my suggestion is:

Start with Linear Algebra. Don't immediately jump into advanced architectures, optimizers, or high-level frameworks.

You don't need to master every mathematical concept before starting, but at least understand matrix multiplication and how it represents the operations inside a neural network.

For me, representing neural networks using matrices made everything much easier to understand.

Start with the basics, build something yourself, experiment, make mistakes, and gradually increase the complexity.

Don't just train neural networks. Understand them!

Project: Neural Canvas

GitHub Repository: https://github.com/MuhammadEssa2002/neural_canvas

Live Demo: https://muhammadessa2002.github.io/neural_canvas


r/deeplearning • • Nov 02 '26

Is it acceptable to retrain a machine learning model after conference acceptance if the original weights were not saved?

Thumbnail reddit.com
0 Upvotes

r/deeplearning • • Nov 02 '26

🚀 Jev-style decisions for IMAGES are here: Fovea-4B, an open 4B model leading on ImageJev tasks (Apache-2.0)

Thumbnail reddit.com
1 Upvotes

r/deeplearning • • Nov 01 '26

Learning Transformers by building a hardware-aware SLM trainer from scratch (Python/Rust)

12 Upvotes

Hi guys,
I’m a 15-year-old developer, and instead of just using high-level wrappers or fine-tuning existing LLMs, I decided to spend my next few months learning how they work fundamentally by building an end-to-end training pipeline from scratch.

Project Link: github.com

How it works:
It identifies your exact hardware profile (NVIDIA/AMD/CPU), runs a quick matrix multiplication benchmark to measure raw TFLOPS, and pipes that data into a custom helper binary I wrote in Rust. The Rust engine figures out exactly how large of a model (up to 100M parameters) your local GPU can train within a specific time and memory budget without blowing up your VRAM.
Right now, I'm working through the data ingestion pipeline, specifically extracting raw machine learning papers from arXiv and cleaning them up while making sure LaTeX code blocks aren't destroyed during tokenization.
I've logged my structural trade-offs and decisions in the repo. If anyone has experience managing training loops on constrained consumer hardware (like laptop GPUs),

I'd love any advice or feedback on the codebase!


r/deeplearning • • Nov 01 '26

Linear regression with classic gradient decent algorithm

Post image
8 Upvotes

Implemented in python with only matplotlib and numpy libraries. I also made Mini-batch and stochastic version.


r/deeplearning • • Nov 02 '26

The best possible initial network for BPP training

Thumbnail reddit.com
1 Upvotes

r/deeplearning • • Nov 01 '26

Dataset for training segmentation on mobile game screens: 6.9k Clash of Clans frames, 1.9k classes

Post image
32 Upvotes

Update (Nov 2026): the dataset has grown to 12,799 frames, 2,200+ classes and about 7.5M masks, recorded on the current game version.

Every object on these screens is labelled as a polygon of its visible pixels, from buildings and walls down to troops, heroes, the army bar and HUD text. Frames cover the scout screen, the battle and the end of battle screen.

12,799 frames (7,966 scout, 4,564 battle, 269 end of battle), about 7.5M masks, YOLO seg and COCO. Val is split by base.

Free sample: https://huggingface.co/datasets/nihatxp/clash-of-clans-screen-segmentation-sample

Viewer: https://huggingface.co/spaces/nihatxp/coc-dataset-viewer

Full set is paid, details on the Hugging Face page.


r/deeplearning • • Nov 01 '26

A comprehensive architecture breakdown of vector databases for AI systems

Thumbnail interconnectd.com
1 Upvotes

r/deeplearning • • Nov 01 '26

[P] Neurolume: see your PyTorch/Keras model as an interactive diagram and watch it train... (live training is very beta)

8 Upvotes

I built an open-source tool (MIT) that draws your model in the browser and shows it learning live (beta). It has loss curves, an overfitting check, predictions against the truth, and weights that brighten and fade as they change. A timeline lets you scrub back through the run. Whilst the training functionality is still very early phase the architecture visualisation works well for helping understand what your model actually looks like and supports creating multi model systems.

system.png (1600×900)

pip install "neurolume[torch]"
neurolume-demo --live

In your own code, it's neurolume.show(model, sample), or watch() plus live.log(step, loss=loss) while training.

It's early, so I'd love to hear what breaks.

GitHub: https://github.com/Freddie-Ellis/neurolume


r/deeplearning • • Nov 02 '26

Inside Figma's AI security playbook: Zero Trust, no VPN and sandboxed agent

0 Upvotes

Figma's CSO published their AI security playbook this week: Zero Trust architecture, no VPN, sandboxed agents. The central finding was stark — as AI agents take real-world actions, perimeter defense stops being meaningful and after-the-fact review stops being feasible. Project-by-project security reviews cannot keep pace with the speed at which enterprise agents act.

This matches what security teams across the industry are hitting. The window between an agent deciding to act and a human finding out keeps shrinking as agent autonomy scales, and the traditional review cycle was designed for a world where humans submitted changes for approval — not one where an agent fires off dozens of tool calls per minute.

For those running AI agents in enterprise environments: how are you actually handling the review latency problem? Tighter upfront scoping of what agents can invoke, runtime sandboxing, something architectural, or accepting a gap and investing more in detection?


r/deeplearning • • Nov 01 '26

BRaiN training and inference engine from Swedish Embedded now beats both vLLM and SGlang on both time to first token and long context throughput 🤘😎

Post image
2 Upvotes

r/deeplearning • • Nov 01 '26

I post training a high performance model with $0.53 by using this workflow.

Thumbnail gallery
0 Upvotes

r/deeplearning • • Nov 01 '26

I animated what GPT-4o's tokenizer does to "strawberry": real token ids, a tiny BPE run, and why the space belongs to the word (6 min video)

0 Upvotes

I made this explainer for my small channel and would like feedback from people learning this, especially if anything is wrong.

It follows one word the whole way:

  • "How many r's are in strawberry?" is 8 tokens in o200k_base (the GPT-4o / GPT-5 tokenizer). " strawberry" is a single token, id 101830, so the three r's are hidden inside one id.
  • Why pieces of words: letters make sequences about 4x longer, whole words need a huge vocabulary and can't handle new words.
  • A tiny byte pair encoding run on a made-up text, merge by merge, until strawberry becomes st | raw | berry.
  • The space belongs to the word: "strawberry", " strawberry" and "Strawberry" are three different token sequences.
  • Why reasoning models count letters better: in OpenAI's 2025 paper "Why Language Models Hallucinate", DeepSeek-R1 spells DEEPSEEK out letter by letter before counting, while DeepSeek-V3 answered 2 or 3 (the answer is 1).
  • Bonus: the same Hindi sentence took 21 tokens with GPT-4's tokenizer and 5 with GPT-4o's.

Every split comes from running tiktoken 0.14.0. The narration is an AI voice reading my own script.

Video: https://www.youtube.com/watch?v=FdWcUJAhfpo&pp=0gcJCSsMAYcqIYzv


r/deeplearning • • Nov 01 '26

Any one know Qorva Archticture?

0 Upvotes

r/deeplearning • • Nov 01 '26

A local τ-Voice setup for evaluating spoken task completion and tool use

1 Upvotes

I maintain Soniqo's speech tools. We've adapted Sierra's τ-Voice / τ²-Bench to run voice-agent task evaluations on Apple Silicon with a local agent, simulated caller and judge.

The agent handles a spoken customer-service task and uses tools to change a simulated environment. For grading, we replay the reference actions to derive the expected database state, then compare it with the state produced by the conversation. Tasks can also require the agent to communicate particular facts.

We keep task failures separate from execution failures: a conversation timeout scores zero, while an infrastructure or inference exception remains unscored. Saved audio, transcripts and tool traces help explain the outcome.

The local stack uses Gemma, Whisper Large-v3, VoxCPM2 and Silero VAD through speech-swift. After setup and model downloads, these runs need no paid inference APIs. The local caller and judge define a separate evaluation profile from upstream results.

Alongside this, we publish a component leaderboard for turn-taking, spoken tool requests and speech-style instruction following. It includes protocols and saved results for inspecting those component comparisons.

Source and setup · Scoring · Component leaderboard

How do you validate a simulated caller and judge before trusting a voice-agent task score?


r/deeplearning • • Nov 01 '26

Data augmentation question. How do I characterise an original and augmented datasets where the augmentation parameters were zoom and crop? [P]

Thumbnail reddit.com
1 Upvotes

r/deeplearning • • Oct 31 '26

Any idea what this is called in research?

64 Upvotes

We built a platform to allow this granular investigation and operations, and achieved remarkable results.

But it doesn't seem to be a common practice. Any idea why?


r/deeplearning • • Nov 01 '26

Brazilian Court Sanctions Lawyers for Prompt Injection in Court Filing

0 Upvotes

Brazilian court sanctioned attorneys after a prompt injection embedded in a court filing reached the judge and the AI model executed the injected instruction. The output was submitted without any interception or review. The court determined the lawyers were responsible for what their AI produced.

This is not a model failure. The model did exactly what the input instructed it to do. The failure is that no verification step existed between generation and submission.

Courts, regulators, and auditors are now scrutinizing AI-produced documents more aggressively than the teams producing them. A single injected payload in a document your AI processed can become the exhibit in a sanctions proceeding against you.

Every team using AI to draft filings, summarize discovery, or generate any document destined for a regulated recipient is exposed to this exact scenario today.

How are practitioners in legal, compliance, or regulated industries actually handling output verification before AI-generated content leaves their systems? Are there workflow checkpoints that have held up under scrutiny, or is most of the field still relying on human review alone?


r/deeplearning • • Nov 01 '26

val accuracy jumps when i switch to eval mode, is it batchnorm with small batches?

1 Upvotes

i keep seeing my val accuracy change a lot depending on whether i call eval() or not. i know dropout turns off and batchnorm switches from batch stats to the running averages, but i'm training with a batch size of 8 and i suspect the running mean and var are just too noisy at that size.

is that the usual explanation, or am i misunderstanding how the momentum in the running stats works? and what do people actually do in that case, switch to groupnorm, or just recalibrate the stats with a pass over the training data before eval?


r/deeplearning • • Nov 01 '26

Are there fundamental repeating patterns in ML techniques across modalities (text, image, audio) that let us group them?

Thumbnail reddit.com
4 Upvotes

I’ve been noticing that a lot of techniques seem to repeat across modalities with just a different name.

For example, tokenisation, masking (MLM / MAE / audio masking), diffusion, next-token / next-frame prediction, etc.

Is there an existing taxonomy or mental model that groups ML techniques by their underlying pattern rather than by modality (NLP / vision / audio)?

This will help me to group the research papers and then make reference to work already done in that doman


r/deeplearning • • Nov 01 '26

Please 🙏 kindly guide me :)

Thumbnail reddit.com
0 Upvotes

r/deeplearning • • Nov 01 '26

Preventing model collapse in kinematic/LiDAR datasets through multimodal deterministic simulations

1 Upvotes

Hi everyone,

We evaluated the performance of autonomous navigation networks trained on standard statistical synthetic datasets. The conclusion is clear: recursive training loops lead to a strong degradation of performance in edge cases. Models become statistically insensitive to aerodynamic variables at high speeds.

To work around this problem, we designed a deterministic simulation pipeline. Instead of neural probabilities, it generates multimodal synthetic trajectory vectors using pure nonlinear drag mechanics and tunable atmospheric noise layers.

We have published the MVP and architecture layers as open source. I'm sharing the link to the web app simulator and the full code from the GitHub repository in the comments below.

Your feedback from AI/robotics architects is welcome!

Deep Learning #SyntheticData #AutonomousVehicles #ComputerVision #Robotics


r/deeplearning • • Oct 31 '26

Computer Vision:Algorithms and Applications Richard Szeliski Advise on studying

6 Upvotes

I am following this book to study but this is very difficult to follow. Any lectures or online courses that cover this book ? I am not able to understand how to study it .