No history yet

Architectural Decision Making

The Architect's Choice

Choosing an AI architecture is like picking the right tool for a job. A hammer is great for nails, but not for screws. Similarly, different AI models have built-in assumptions, or biases, that make them naturally good at some tasks and poor at others. This is the core of architectural decision-making: matching the model's strengths to the problem's demands.

The most fundamental of these assumptions is called . It's the set of rules a model uses to generalise from the data it has seen to new, unseen data. A strong inductive bias means the model makes very specific assumptions about the data's structure. This can be powerful, but also limiting if the assumptions are wrong.

Consider the Convolutional Neural Network (CNN). Its primary inductive bias is spatial locality. A CNN assumes that pixels close to each other are more related than pixels far apart. It processes an image by sliding small filters across it, looking for local patterns like edges, corners, and textures. This makes it incredibly efficient. It doesn't need to learn from scratch that a cat's eye is part of its face; its structure inherently focuses on these local relationships.

CNNs are data-efficient for image tasks because their spatial bias gives them a head start. They already 'know' to look for local patterns.

Global vs Local

Transformers, on the other hand, have a much weaker inductive bias. Originally designed for language, their core mechanism, self-attention, assumes nothing about the data's structure. It treats an image as a collection of patches and can, in theory, relate any patch to any other patch, no matter how far apart they are. This is a 'global' perspective.

This flexibility is a double-edged sword. A Transformer can discover complex, long-range relationships in an image that a CNN might miss. For example, it could learn the relationship between a person's reflection in a mirror on one side of an image and the person themselves on the other side. A CNN would struggle with this.

But this power comes at a cost. Without the built-in assumptions of a CNN, a Transformer starts from a place of ignorance. It needs to see an enormous amount of data to learn these fundamental spatial relationships for itself. This is why many successful vision Transformers are first pre-trained on massive, unlabelled datasets. The self-supervised pre-training helps the model learn these basics before it's fine-tuned on a specific task.

Hybrid Architectures

This trade-off has led to powerful hybrid models. Why not get the best of both worlds? Many state-of-the-art architectures use a CNN as a 'backbone' to efficiently extract local features from an image. The rich, localised feature maps are then fed into a Transformer 'head' for global reasoning.

A great example is DETR, or DEtection TRansformer. It uses a standard CNN to create a set of image features. Then, a Transformer decoder takes over to reason about the relationships between objects in the scene, outputting bounding boxes and labels. This combines the data efficiency of CNNs with the relational power of Transformers.

Lesson image

This hybrid approach is especially useful in multi-modal tasks, where you combine different types of data, like images and text. A CNN can process the image, a Transformer can process the text, and another Transformer can then fuse the information from both, understanding how the words in a caption relate to the objects in a picture.

So, how do you choose?

  • Small, specific dataset? A CNN, with its strong inductive bias, will likely perform better and train faster. It's the efficient, specialised tool.
  • Massive, general dataset? A Transformer has the potential to learn richer, more global representations, but only if you have the data and computational budget to feed it.
  • Complex reasoning about object relations? A hybrid often hits the sweet spot, leveraging the strengths of both.

A well-designed architecture can have a considerable influence on the model’s performance, training speed, and generalizability.

Time to test your knowledge.

Quiz Questions 1/5

What is the core concept that describes the built-in assumptions a model uses to generalise from seen to unseen data?

Quiz Questions 2/5

A key weakness of the Transformer architecture, when used for vision tasks without pre-training, is its need for a vast amount of data.

Understanding these architectural trade-offs is crucial. It moves you beyond simply using popular models and towards designing intelligent systems tailored to the specific problem at hand.