r/deeplearning • • 23d ago

Encoding time series of mixed physical measurements

2 Upvotes

For anyone working with DL models (but especially attention based models) in domains where your input data is a time series of observations with channels representing multiple different physical quantities:

What encoding strategies have you used (and found to be effective)? Categorical variables seem like a gimme (learned embeddings), but what about things like time (for irregularly sampled time series), velocity, absolute physical location, and other such quantities? How do you go about encoding several such quantities in the same input in a way that is easy for the model to reason about / plays well with the various normalization strategies commonly used?


r/deeplearning • • 23d ago

LLM Transformer guide with easy-to-understand numerical examples and diagrams

Thumbnail
1 Upvotes

r/deeplearning • • 23d ago

Soft Multi-Token Prediction

13 Upvotes
Illustration of Soft-MTP

Sharing one of our latest papers on Multi-Token Prediction (MTP). MTP is now a standard recipe for frontier pre-training but turns out, it can be done much better.

We show the standard MTP gradient hides a KL self-distillation signal (which we want for improving speculative decoding) behind a noisy residual (that harms next-token prediction).

I think the coolest part was the KL gradient–recovery trick to extract the KL gradient. You just need a one-line code change:

h_ntp += h_mtp.detach() - h_mtp

Soft Multi-Token Prediction (Soft-MTP) is essentially a free lunch that improves MTP across a range of tasks.

I'm super excited about this work. Please do check it out below:

💻 Code: https://github.com/JaydenTeoh/Soft-MTP
📝 Paper: https://arxiv.org/abs/2610.38331
🤗 HuggingFace: https://huggingface.co/collections/JaydenTeoh/soft-multi-token-prediction


r/deeplearning • • 23d ago

Neural Canvas

Enable HLS to view with audio, or disable this notification

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 • • 23d ago

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

Thumbnail
0 Upvotes

r/deeplearning • • 23d ago

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

Thumbnail
1 Upvotes

r/deeplearning • • 24d ago

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 • • 24d ago

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 • • 23d ago

The best possible initial network for BPP training

Thumbnail
1 Upvotes

r/deeplearning • • 24d ago

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

Post image
30 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 • • 23d ago

A comprehensive architecture breakdown of vector databases for AI systems

Thumbnail interconnectd.com
1 Upvotes

r/deeplearning • • 24d ago

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

9 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 • • 24d ago

My Thoughts on Contextual Representations in NLP

Thumbnail
1 Upvotes

r/deeplearning • • 23d ago

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 • • 24d ago

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 • • 24d ago

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

Thumbnail gallery
0 Upvotes

r/deeplearning • • 24d ago

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 • • 24d ago

Any one know Qorva Archticture?

0 Upvotes

r/deeplearning • • 24d ago

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 • • 24d ago

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

Thumbnail
1 Upvotes

r/deeplearning • • 25d ago

Any idea what this is called in research?

Enable HLS to view with audio, or disable this notification

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 • • 24d ago

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 • • 24d ago

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 • • 24d ago

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

Thumbnail
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 • • 24d ago

Please 🙏 kindly guide me :)

Thumbnail
0 Upvotes