Skip to main content

Deep Learning: From Simple Linear Pieces to Powerful Models

Deep Learning: From Simple Linear Pieces to Powerful Models

Deep Learning — From Local Linearity to Compact Architectures

At its heart, deep learning is a function-approximation engine. The central intuition is simple: zoom in on a complex curve and it looks almost linear. Neural networks exploit that by composing many linear transformations with nonlinear activations — producing a highly expressive, piecewise-linear (or smooth) approximation of the target function.

1. Local Linearity — the basic building block

The basic operation in a neural network is a linear transformation followed by a nonlinearity:

$$ \mathbf{z} = W \mathbf{x} + b, \quad \mathbf{a} = \sigma(\mathbf{z}) $$

Repeated over layers:

$$ f(\mathbf{x}) = \sigma_n(W_n(\sigma_{n-1}(W_{n-1}(...\sigma_1(W_1 \mathbf{x} + b_1)...)+b_{n-1}) ) + b_n) $$
Notation:
\( W_i \), \( b_i \): learnable weights and biases
\( \sigma_i \): nonlinear activation (ReLU, GELU, etc.)
\( f(\mathbf{x}) \): deep network function mapping input to output

2. Problem: Many local linear pieces → huge model

Approximating a complex function with tiny locally-linear patches can explode the number of pieces and parameters. If each neuron or small subnetwork learns an independent region, you quickly end up with models too large to train or deploy.

Key idea: introduce assumptions (inductive biases) to share and reuse pieces across regions, compressing the representation.

3. How architectures compress the pieces

Here are practical strategies for compressing many local linear pieces into compact, efficient networks:

CNNs — spatial locality & weight sharing

Small kernels slide across images; weights are shared across locations, massively reducing parameters.

Transformers — attention & dynamic routing

Use attention to focus only where interactions matter. Conditional computation avoids modeling unnecessary pieces.

Patch-based models (ViT, MobileViT)

Split images into patches. Fewer tokens = fewer pieces. MobileViT mixes convolutions with attention for efficiency.

Depthwise separable convolutions

Separate spatial and channel mixing; reduces parameters ~8–9× (used in MobileNet).

Bottlenecks & residual connections

Compress features into smaller subspace and expand. Skip connections make learning corrections easier.

Sparsity, pruning & MoE

Only a subset of parameters activate per input (Mixture-of-Experts), keeping effective pieces low but global capacity high.

Compression & deployment tricks

  • Quantization: low-precision weights/activations (8-bit, 4-bit).
  • Pruning: remove unimportant weights post-training.
  • Knowledge distillation: train a smaller model to mimic a larger one.
  • Parameter-efficient fine-tuning: LoRA, adapters, prompt tuning.
  • Neural architecture search (NAS): find compact architectures automatically.

4. Newer ideas worth knowing

  • Equivariance / group convolutions: encode symmetries to reuse pieces across transformations.
  • Sparsely-gated models & routing: conditional compute per input.
  • Low-rank factorization: decompose weight matrices into smaller factors.
  • Attention approximations: Performer, Linformer, BigBird to reduce quadratic cost.
  • Mixture-of-Adapters & modular learning: compose small task-specific modules.

5. Putting it together — an intuition recipe

  1. Start with local linearity: think in terms of small linear pieces.
  2. Ask: what structure in data can you exploit? locality, symmetry, sequence, permutation.
  3. Choose architectural priors: convs for locality, attention for interactions, recurrence for sequences.
  4. Compress with math: bottlenecks, separable operations, low-rank, quantization.
  5. Use conditional compute: sparsity, MoE, routing for efficiency.

6. Short mathematical note

Piecewise-linear activations (like ReLU) allow deep networks to represent highly expressive functions. Each layer composes linear maps with “kinks” (breakpoints), and stacking layers multiplies these breakpoints, creating exponentially more linear regions as depth increases.

Rough 1-D example: each neuron adds a 'kink'; stacking layers generates combinatorial piecewise-linear regions.

7. Quick analogy

Imagine tracing a wavy shoreline. You could use a million tiny straight planks—but a smarter approach is to notice repeating patterns and reuse modular pieces. That’s what neural network architectures do: layers capture reusable structures, efficiently building complex functions.

Comments

Popular posts from this blog

The Mathematics Behind AGI: Foundational Concepts and the Road Ahead

The Mathematics Behind AGI: Foundational Concepts and the Road Ahead The Mathematics Behind AGI: Foundational Concepts and the Road Ahead I want to be upfront about something before we start. Nobody fully knows what AGI is going to look like, how it will be built, or whether the mathematical frameworks we have today are even the right ones. What we do have is a collection of deep, beautiful, and sometimes frustrating mathematical ideas that seem to point in the right direction. This blog is my attempt to trace those ideas — not as a checklist of solved problems, but as an honest map of where the thinking currently is. Some of this math is a century old. Some of it was written in the last decade. All of it is incomplete in one way or another when it comes to AGI. That tension is what makes this field interesting. 1. What is AGI, Formally? Before building something, it helps to define it. For most of AI history, nobody really tried to define intelligence ...

LeJEPA: Predictive Learning With Isotropic Latent Spaces

LeJEPA: Predictive World Models Through Latent Space Prediction LeJEPA: Predictive Learning With Isotropic Latent Spaces Self-supervised learning methods such as MAE, SimCLR, BYOL, DINO, and iBOT all attempt to learn useful representations by predicting missing information. Most of them reconstruct pixels or perform contrastive matching, which forces models to learn low-level details that are irrelevant for semantic understanding. LeJEPA approaches representation learning differently: Instead of reconstructing pixels, the model predicts latent representations of the input, and those representations are regularized to live in a well-conditioned, isotropic space. These animations demonstrate LeJEPA’s ability to predict future latent representations for different types of motion. The first animation shows a dog moving through a scene, highlighting semantic dynamics and object consisten...

MobileNet Backbone Versions: Designing Efficient CNNs for Real-World Deployment

MobileNet Backbone Architecture Versions MobileNet Backbone Versions: Designing Efficient CNNs for Real-World Deployment MobileNet is a family of efficient convolutional neural networks designed for real-time inference on resource-constrained devices such as smartphones, drones, and embedded IoT hardware. Over multiple versions, the MobileNet family introduced progressively refined design innovations — from depthwise separable convolutions to neural architecture search and transformer-style attention — while keeping computation minimal. Rather than treating MobileNet as a single model, this blog explores each version's motivation , the specific problem it addressed , and the architectural innovations it introduced to push the accuracy-efficiency frontier. 1. Why MobileNet? Motivation and Core Problem Standard convolutional networks like VGG and ResNet are accurate but computationally heavy. Deploying them on edge devices with limited memory, power, ...