💡 Inspiration
It started with a frustrating reality: training AI is incredibly wasteful.
I were staring at my GPU utilization during a standard fine-tuning run, watching it burn through memory just to update a few weights. It felt wrong. Biology doesn't work this way. Your brain doesn't re-wire every single synapse just to learn a new fact; it grows specific, sparse connections (dendrites) exactly where they are needed.
I asked myself: "What if I could treat a massive model like BERT less like a matrix of numbers and more like a biological brain?"
I didn't just want to compress a model; I wanted to change how it learns. That led us to Dendritic-LoRA—an attempt to prove that smart, sparse growth beats dense, brute-force calculation.
⚙️ How I built it
I knew I couldn't build a new LLM from scratch in 48 hours, so we decided to perform "brain surgery" on an existing one.
- The Patient: I took
bert-base-uncased(a standard 109M parameter model) and froze it completely. No gradients, no updates. - The Surgery: I used the Perforated AI library to inject "Dendritic Adapters" into the model. Instead of adding heavy linear layers (like standard LoRA), we used
UPA.initialize_pai(model)to wrap the frozen attention blocks with sparse, trainable masks. - The Growth: I swapped out the standard optimizer for the
GPA.pai_tracker. This was crucial because standard optimizers treat all weights the same. The PAI tracker actually manages the topology of the network, allowing our dendrites to "grow" and "prune" dynamically during training.
We essentially tricked a frozen BERT model into learning new sentiment patterns using only 1% of its capacity.
🚧 Challenges we faced (The "Panic" Moment)
Midway through this project and hit a massive wall.
I started by training on a small "test" subset of data to save time. The result? Disaster. The model stalled at 56% accuracy—barely better than a random coin flip. We thought the dendritic approach was too fragile. I thought I had failed.
It turns out, sparse networks are like seeds—they need a strong initial signal to sprout. When I fed it the full dataset and tuned the learning rate scheduler, the difference was night and day. The model didn't just start learning; it rocketed. Seeing that accuracy curve suddenly spike from 50% to 88% was the highlight of the weekend.
🏆 Accomplishments that we're proud of
- The "99% club": I reduced the trainable parameters from 109 Million down to 1.18 Million. That is a 98.9% reduction.
- Beating the Baseline: The most satisfying part wasn't just matching the standard performance—it was beating it. The "Green Line" (Dendritic) converged 3x faster than the standard dense LoRA method.
- It actually works: This isn't just theory. I have a working script that takes a heavy industry-standard model and fine-tunes it on consumer-grade hardware with minimal memory overhead.
🧠 What we learned
We learned that sparsity is the future of efficiency.
For a long time, I assumed that "more parameters = better." This project proved that better connections are more important than more connections. I also gained a deep appreciation for the perforatedai library; handling sparse gradients manually is a nightmare, and the library abstracted the hardest parts away so we could focus on the architecture.
🚀 What's next for Dendritic-LoRA
We proved this works on BERT. Now we want to go bigger.
My next goal is to apply Dendritic-LoRA to Llama-3 (8B). If we can achieve similar compression ratios (99% reduction) on a 70B model, we could theoretically fine-tune massive LLMs on a single MacBook or even a high-end phone. The future of AI is at the edge, and we believe dendritic optimization is the key to getting there.
It's one day or day one
Built With
- hugging-face
- numpy
- perforated-ai
- python
- pytorch
- scikit-learn
Log in or sign up for Devpost to join the conversation.