Wednesday, 22 July 2026

🧠 Why Can't We Train ChatGPT on a CPU? Understanding CPU vs GPU vs TPU

 

Introduction

Every time we hear about ChatGPT, Gemini, Claude, or any modern AI model, another term appears alongside it:

GPU.

Sometimes we even hear about Google TPUs.

This made me wonder:

If my laptop already has a CPU, why do companies spend millions of dollars buying GPUs and TPUs?

The answer lies in how these processors are designed.

Although all three process information, they solve problems very differently.

Let's understand why.


Imagine Three Engineers...

Suppose a company receives 10,000 customer invoices that need to be verified.

Three engineers volunteer.

πŸ‘¨ Engineer 1 (CPU)

He is extremely intelligent.

He checks one invoice carefully.

Finishes.

Moves to the next.

His strength isn't speed.

His strength is decision making.


πŸ‘¨‍πŸ‘¨‍πŸ‘¨ Engineer 2 (GPU)

Instead of working alone...

He brings 5,000 assistants.

Each assistant verifies one invoice.

The work finishes much faster.


🏭 Engineer 3 (TPU)

Google hires a specialist.

Instead of hiring more people...

They build an assembly line where invoices continuously move through dedicated stations.

Each station performs exactly one mathematical operation.

No unnecessary decisions.

Only maximum throughput.


That is essentially the difference between CPU, GPU and TPU.

Now let's see what happens internally.


🧠 CPU — Built for Decisions, Not Repetition

A CPU (Central Processing Unit) is designed to execute many different kinds of instructions efficiently.

Internally it consists of:

  • Control Unit (CU)
  • Arithmetic Logic Unit (ALU)
  • Multiple CPU Cores
  • Cache hierarchy (L1 → L2 → L3)
  • Registers
  • Main Memory Interface



How a CPU Executes an Instruction

Every instruction follows a cycle.

Instruction

↓

Fetch

↓

Decode

↓

Execute

↓

Store

Let's understand each stage.

1. Fetch

The Control Unit fetches an instruction from RAM.

Example:

ADD A, B

2. Decode

The CPU determines:

  • What operation?
  • Which registers?
  • Which memory locations?

3. Execute

The ALU performs:

  • arithmetic
  • logical comparison
  • branching

4. Store

The result is written back into memory.

Then the CPU starts again.

Millions of times every second.


Why CPUs Are So Good

Because they optimize for:

✔ Low latency

✔ Branch prediction

✔ Context switching

✔ Complex operating systems

✔ Database transactions

✔ Application execution

This is why Oracle Database, Linux, browsers and web servers primarily run on CPUs.


But Then Deep Learning Arrived...

Training a neural network isn't about making complicated decisions.

Instead, it performs the same mathematical operation...

again...

and again...

and again...

Imagine multiplying two huge matrices.

A × B

Not once.

Millions of times.

A CPU quickly becomes the bottleneck.


GPU — Designed for Massive Parallelism

A GPU wasn't originally built for AI.

It was built for graphics.

Rendering a 4K image means calculating millions of pixels simultaneously.

To solve this problem...

NVIDIA designed GPUs with thousands of smaller cores.




How GPU Architecture Works

Instead of a few powerful cores...

A GPU contains:

  • Streaming Multiprocessors (SMs)

Each SM contains:

  • CUDA cores
  • Shared memory
  • Registers

Multiple SMs share:

  • L2 Cache
  • High Bandwidth Memory (HBM)

Thousands of threads execute simultaneously.


Imagine multiplying a matrix.

CPU:

1
↓

2

↓

3

GPU:

1 2 3 4 5 6 7 ...

All together

This is called SIMD/SIMT parallelism.


Why GPUs Changed AI

Almost every deep learning computation eventually becomes:

Matrix Multiplication

Examples:

  • Convolution
  • Attention
  • Embeddings
  • Transformers

GPUs excel at these operations.

This is why companies like OpenAI use thousands of NVIDIA GPUs for training.


Then Even GPUs Became a Limitation...

Although GPUs are excellent...

They still contain logic designed for graphics.

Google asked:

What if we removed everything unnecessary...

...and built hardware only for tensors?


TPU — Built Specifically for AI

TPU stands for:

Tensor Processing Unit

Unlike CPUs and GPUs...

A TPU is designed almost entirely around matrix multiplication.




Inside a TPU

Instead of CUDA cores...

A TPU contains:

  • Systolic Array
  • Multiply-Accumulate (MAC) Units
  • Weight Buffer
  • Activation Buffer
  • On-chip SRAM
  • High Bandwidth Memory

Rather than instructions moving around...

Data flows continuously through the array.

Think of it like an automobile assembly line.

Each station performs one operation.

The output immediately moves to the next station.

This dramatically reduces memory movement.

And memory movement is often slower than computation itself.


Why TPUs Are So Fast

Because neural networks mostly perform:

Tensor × Tensor

↓

Matrix Multiplication

↓

Activation

↓

Repeat

TPUs optimize exactly this workload.

Nothing more.

Nothing less.


Python Example

TensorFlow automatically uses available GPUs.

import tensorflow as tf

print(tf.config.list_physical_devices("GPU"))

If a compatible GPU exists...

TensorFlow offloads tensor operations automatically.


Quick Comparison

CPUGPUTPU
Few powerful coresThousands of smaller coresThousands of MAC units
SequentialParallelTensor optimized
Operating systemsGraphics & AILarge-scale AI
Low latencyHigh throughputMaximum AI efficiency

So... What Happens When You Ask ChatGPT Something?

Prompt

↓

CPU
(Tokenization,
Networking,
Scheduling)

↓

GPU
(Matrix multiplication,
Transformer inference)

↓

Generated Response

For Google Gemini:

Prompt

↓

TPU

↓

Tensor Operations

↓

Response

Final Thoughts

When I first learned about CPUs, GPUs, and TPUs, I thought the difference was simply "more cores."

But the real difference lies in how they are architected to solve problems.

  • CPUs are designed for decision making.
  • GPUs are designed for parallel computation.
  • TPUs are designed for tensor computation.

Understanding this also explains why modern AI became possible.

It wasn't just because algorithms improved.

It was because hardware evolved alongside them.

Wednesday, 10 June 2026

🏞️ Data Lake vs Data Warehouse vs Lakehouse: Understanding Modern Data Architectures

When I first started learning about modern data architectures, I used to get confused between:

  • Data Warehouse
  • Data Lake
  • Lakehouse

Because honestly, all three involve storing data, analytics, and large-scale systems.

At one point, everything started sounding like:

“Just different names for storing data.”

But after exploring them gradually, I realized the difference is actually easier to understand if we think about:

what kind of data is stored
how organized it is
what we want to do with it

So this blog is my attempt to explain these concepts in the simplest way I understood them.


🏒 1️⃣ Data Warehouse — Highly Organized Business Data

The easiest way I think about a data warehouse is:

A highly organized storage system built mainly for reporting and business analysis.

Imagine a company generating:

  • sales records
  • customer transactions
  • billing information

This data is usually:

  • structured
  • cleaned
  • validated

before entering the warehouse.

So the warehouse stores:
✅ trusted data
✅ organized tables
✅ business-ready information


Simple Real-Life Analogy

A data warehouse feels like:

A well-organized corporate file room.

Everything has:

  • labels
  • structure
  • fixed locations

You can quickly generate reports because the data is already prepared properly.


Typical Usage

Business teams use warehouses for:

  • dashboards
  • monthly reports
  • KPI tracking
  • trend analysis




🏞️ 2️⃣ Data Lake — Store Everything First

Now this is where things started becoming clearer for me.

A data lake works very differently.

Instead of organizing data first,

it stores data first.

And that data can be:

  • structured
  • semi-structured
  • completely unstructured

Examples:

  • JSON logs
  • videos
  • images
  • clickstream data
  • IoT sensor data

The idea is:

“We may need this data later, so let’s store it.”


Simple Analogy

A data lake feels like:

A huge storage warehouse where different kinds of items are dumped together.

Not messy intentionally — but flexible.

You can store almost anything.


Why Companies Need Data Lakes

Modern applications generate massive amounts of raw data.

For example:

  • Netflix-like platforms generate viewing logs
  • apps generate clickstream events
  • AI systems generate embeddings and vectors

Not all of this fits nicely into traditional tables.

That’s where lakes become useful.





⚠️ Why Data Lakes Sometimes Become ‘Data Swamps’

One thing I found interesting is:

If companies keep storing data without:

  • governance
  • naming standards
  • quality checks

then eventually nobody knows:

  • which data is useful
  • which version is correct
  • which dataset can be trusted

That situation is called:

Data Swamp

And honestly, this analogy makes sense πŸ˜„

Because now the “lake” becomes difficult to navigate.





🏑 3️⃣ Lakehouse — Trying to Combine Both Worlds

This was the easiest concept to understand once I understood the first two.

A lakehouse basically tries to combine:

✅ flexibility of data lakes
with
✅ structure and reliability of data warehouses

So instead of maintaining:

  • separate warehouse systems
  • separate AI data platforms

organizations try to build:

one unified platform.


Simple Analogy

If:

  • warehouse = organized office records
  • lake = huge raw storage area

then:

lakehouse = smart storage system with both flexibility and organization.


Why Lakehouses Became Popular

Modern companies want:

  • AI workloads
  • analytics
  • dashboards
  • machine learning
  • raw data storage

all in one ecosystem.

Lakehouses try to solve exactly that problem.





🧠 The Simplest Way I Finally Understood It

ArchitectureSimplest Understanding
Data WarehouseOrganized business reporting system
Data LakeStore all raw data for future use
LakehouseCombine flexibility + analytics together

🌱 Final Thoughts

The interesting thing is:

modern systems are gradually moving toward architectures that support both analytics and AI together.

That’s why concepts like:

  • vector search
  • AI databases
  • lakehouses
  • hybrid analytics platforms

are becoming increasingly important.

And once I stopped trying to memorize definitions and instead focused on:

  • purpose
  • data type
  • usage pattern

these architectures started making much more sense.



Tuesday, 14 April 2026

☁️ Cloud Service Models Explained: IaaS, PaaS, SaaS, DBaaS and More

When working with cloud technologies, we often hear terms like IaaS, PaaS, SaaS, and DBaaS.

At first, they sound similar. But in reality, they represent different levels of responsibility and abstraction in how systems are built and managed.

Understanding these models helps answer a simple question:

Who is responsible for what — you or the cloud provider?


🧠 The Core Idea

All cloud service models are about sharing responsibilities between:

  • You (developer / engineer / organization)
  • Cloud provider (AWS, Azure, OCI, GCP)

As we move from IaaS → SaaS,
πŸ‘‰ your responsibility decreases
πŸ‘‰ provider responsibility increases


🧩 1️⃣ IaaS (Infrastructure as a Service)

What it means

You get:

  • Virtual machines
  • Storage
  • Networking

But you manage:

  • OS
  • Middleware
  • Applications
  • Data

Example

Using a cloud VM:

  • Launch an Oracle Linux VM on OCI
  • Install Oracle Database manually
  • Configure everything yourself

Real-world tools

  • AWS EC2
  • Azure Virtual Machines
  • OCI Compute



🧩 2️⃣ PaaS (Platform as a Service)

What it means

You get:

  • Platform (runtime, OS, middleware)

You manage:

  • Application
  • Data

Provider handles:

  • OS
  • patching
  • scaling

Example

Deploying an application without managing servers:

  • Upload code to platform
  • Platform handles environment setup

Real-world tools

  • Oracle APEX
  • Google App Engine
  • Azure App Services



🧩 3️⃣ SaaS (Software as a Service)

What it means

Everything is managed by the provider.

You just:

  • Use the application

Example

  • Gmail
  • Microsoft 365
  • Oracle Fusion Applications

No installation, no maintenance.



🧩 4️⃣ DBaaS (Database as a Service)

This is especially relevant for your background πŸ‘Œ

What it means

The cloud provides a fully managed database.

You don’t worry about:

  • installation
  • patching
  • backups
  • scaling

Example

  • Oracle Autonomous Database
  • Amazon RDS
  • Azure SQL Database

You just:

  • create database
  • run queries

SQL Example

SELECT * FROM employees;

You don’t care:

  • where DB runs
  • how backups happen





🧩 5️⃣ FaaS (Function as a Service / Serverless)

What it means

You write small functions, and the cloud runs them.

You don’t manage:

  • servers
  • runtime scaling

Example

  • AWS Lambda
  • Azure Functions
  • OCI Functions

Use Case

Run code when:

  • file uploaded
  • API called
  • event triggered



🧩 6️⃣ CaaS (Container as a Service)

What it means

You deploy applications using containers.

You manage:

  • container images

Cloud manages:

  • orchestration
  • scaling

Example

  • Kubernetes (OKE, EKS, AKS)
  • Docker-based deployments



πŸ“Š Comparison Summary

ModelYou ManageProvider Manages
IaaSOS, apps, datainfra
PaaSapp, dataOS + infra
SaaSusage onlyeverything
DBaaSdata + queriesDB infra
FaaSfunction codeexecution
CaaScontainersorchestration

🧠 Simple Analogy

Think of cloud models like food services:

  • IaaS → cooking at home
  • PaaS → using a kitchen setup
  • SaaS → ordering food
  • FaaS → ready-made instant meals

🌱 Final Thoughts

Cloud service models are not just definitions — they define how systems are designed and managed.

Choosing the right model depends on:

  • control needed
  • scalability
  • operational effort

Understanding these layers helps you build efficient and scalable cloud architectures.

Thursday, 2 April 2026

🧠 Feature Engineering: Turning Data into Better Signals

In data science, it’s easy to focus on algorithms.

But in practice, model performance often depends more on how data is prepared and represented than on the choice of algorithm.

This step is called feature engineering.


πŸ” What is Feature Engineering?

Feature engineering is the process of:

Transforming raw data into meaningful inputs that help models learn better patterns.

A "feature" is simply a variable used by a model.

But not all features are equally useful.


🧠 Simple Example

Suppose you are predicting house prices.

Raw data:

  • Area
  • Number of rooms
  • Year built

Engineered features:

  • Price per square foot
  • House age = Current year – Year built
  • Rooms per area ratio

These new features often capture real-world relationships better.




🧩 Why Feature Engineering Matters

Even a simple model can perform well if features are strong.

But even a complex model may fail if features are weak.

Better features → better patterns → better predictions


πŸ”§ Common Feature Engineering Techniques


1️⃣ Creating New Features

Combine or transform existing data.

Example:

df['house_age'] = 2025 - df['year_built']

2️⃣ Encoding Categorical Data

Convert text into numbers.

df = pd.get_dummies(df, columns=['city'])

3️⃣ Binning (Discretization)

Convert continuous data into groups.

Example:

  • Age → young, middle, senior
df['age_group'] = pd.cut(df['age'], bins=[0,30,60,100])

4️⃣ Feature Scaling

Normalize values for better model performance.

from sklearn.preprocessing import StandardScaler

scaler = StandardScaler()
df[['income']] = scaler.fit_transform(df[['income']])

5️⃣ Handling Date & Time Features

Extract useful components from dates.

df['year'] = pd.to_datetime(df['date']).dt.year
df['month'] = pd.to_datetime(df['date']).dt.month

6️⃣ Interaction Features

Combine multiple variables.

df['rooms_per_area'] = df['rooms'] / df['area']



πŸ“Š Real-World Example

Let’s say you are building a customer churn model.

Raw data:

  • subscription duration
  • number of complaints
  • monthly usage

Engineered features:

  • complaints per month
  • usage trend
  • customer tenure category

These features help the model understand behavior patterns, not just raw values.


⚠️ Common Mistakes

  • Creating too many irrelevant features
  • Ignoring domain knowledge
  • Data leakage (using future information)
  • Overcomplicating features

🧠 Feature Engineering vs Feature Selection

  • Feature Engineering → creating new features
  • Feature Selection → choosing important features

Both are important steps in building good models.




🌱 Final Thoughts

Feature engineering is where data understanding meets creativity.

It requires:

  • domain knowledge
  • intuition
  • experimentation

In many cases, improving features leads to better results than switching algorithms.


πŸ”— Explore related blogs

Tuesday, 24 March 2026

πŸ“Š Data Preprocessing in Data Science: Why Cleaning Data Matters

When we talk about data science, most people immediately think of machine learning models.

But in reality, a large portion of the work happens before the model is even built.

This step is called data preprocessing.


🧠 What is Data Preprocessing?

Data preprocessing is the process of:

  • cleaning data
  • transforming data
  • preparing it for analysis or modeling

Raw data is rarely usable in its original form.

It often contains:

  • missing values
  • inconsistent formats
  • duplicate records
  • irrelevant features



πŸ” Why Preprocessing is Important

Even the best algorithm cannot fix poor-quality data.

For example:

  • Missing values can break models
  • Inconsistent formats lead to wrong analysis
  • Outliers can distort predictions

A simple model on clean data often performs better than a complex model on messy data.


🧩 Common Steps in Data Preprocessing




1️⃣ Handling Missing Values

Missing data is very common.

Options include:

  • removing rows
  • filling with mean/median
  • using interpolation

Example (Python)

import pandas as pd

df = pd.read_csv("data.csv")

# Fill missing values with mean
df['age'].fillna(df['age'].mean(), inplace=True)

2️⃣ Removing Duplicates

Duplicate data can bias results.

df.drop_duplicates(inplace=True)

3️⃣ Encoding Categorical Variables

Machine learning models work with numbers, not text.

Example:

df = pd.get_dummies(df, columns=['city'])

4️⃣ Feature Scaling

Some algorithms require data to be on similar scales.

from sklearn.preprocessing import StandardScaler

scaler = StandardScaler()
df[['salary']] = scaler.fit_transform(df[['salary']])

5️⃣ Handling Outliers

Outliers can distort models.

Example:

  • remove extreme values
  • cap values
  • use robust methods



πŸ“Š Real-World Example

Suppose you are building a model to predict house prices.

Raw dataset may have:

  • missing values in price
  • inconsistent formats
  • duplicate entries
  • extreme outliers

After preprocessing:

  • missing values handled
  • clean numerical data
  • standardized features

Only then is the data ready for modeling.

🧠 Why Can't We Train ChatGPT on a CPU? Understanding CPU vs GPU vs TPU

  Introduction Every time we hear about ChatGPT, Gemini, Claude, or any modern AI model, another term appears alongside it: GPU. Sometime...