Intro to Neural Networks + Overview of AI Architectures AI Architecture for Different Data Modalities

Lesson Objectives

By the end of this lesson, students will be able to:


Understanding Data Modalities in AI

AI models are designed to process different types of data, referred to as data modalities. The effectiveness of an AI system depends on selecting an architecture that aligns with the characteristics and constraints of the underlying data.

Common Data Modalities and Their Challenges

graph TD; A[Structured Data] -->|Tabular, Databases| B[Feedforward Neural Networks - FNNs]; C[Image Data] -->|Pixel-Based| D[Convolutional Neural Networks - CNNs]; E[Text Data] -->|Sequences of Words| F[Transformers]; G[Sequential Data] -->|Time-Series, Audio| H[RNNs, Transformers];

Key Challenges by Data Type:


Choosing the Right AI Model

Each AI architecture is optimized for specific data types:

Data Type Best AI Architecture Example Use Cases
Structured Data Feedforward Neural Networks (FNNs) Credit scoring, fraud detection
Image Data Convolutional Neural Networks (CNNs) Object recognition, medical imaging
Text Data Transformers (e.g., BERT, GPT) Sentiment analysis, chatbots
Sequential Data RNNs, Transformers Speech recognition, stock price forecasting

Key Takeaway: The success of an AI system depends not only on model complexity, but on how well the chosen architecture aligns with the data modality and problem constraints.


Exploring Multimodal AI Systems

What is Multimodal AI?

Multimodal AI systems combine multiple types of input data, such as text, images, and audio, to improve predictions and decision-making. These systems leverage different AI architectures for each modality and fuse their outputs.

Example Applications:


Coding Walkthrough: Implementing a Multimodal AI System

Let’s implement a basic multimodal model that:

Python Code:

import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from transformers import TFAutoModel

# Define image processing branch (CNN)
image_input = keras.Input(shape=(64, 64, 3))
x = layers.Conv2D(32, (3,3), activation='relu')(image_input)
x = layers.MaxPooling2D((2,2))(x)
x = layers.Flatten()(x)
image_features = layers.Dense(128, activation='relu')(x)

# Define text processing branch (Transformer)
text_input = keras.Input(shape=(128,))  # Assume we have tokenized text
text_model = TFAutoModel.from_pretrained("distilbert-base-uncased")
text_features = text_model(text_input)[0][:, 0, :]
text_features = layers.Dense(128, activation='relu')(text_features)

# Combine both modalities
combined = layers.concatenate([image_features, text_features])
output = layers.Dense(1, activation='sigmoid')(combined)

# Create and compile model
multimodal_model = keras.Model(inputs=[image_input, text_input], outputs=output)
multimodal_model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])

# Summary of the multimodal model
multimodal_model.summary()

Discussion Questions:


Summary & Key Takeaways