This story starts on June 12, 2017. Some amazing engineers in Google published a white paper, "Attention is all you need", and this changed the whole game of writing code and developing softwares.
Working on this same principal Open Ai launched an amazing product ChatGPT on November 30, 2022, this day shook the whole world to its core. Some were afraid, some were in panic, some were enthusiastic everywhere on media across the geography this was being discussed and talked about.
Many firms and orgs we shut, millions were laid off or fired, but, millions were hired also. That day invented a whole new dynamic of Software Development.
The way we think about code softwares and the way we write code, everything changed drastically.
Now people still think that now software developers will have to learn and uderstand AI to its very core, in order to stay relevant in software development industry.
However I think this is not the case, Ai is an amazing tool who can help us do wonders. Simply putting it, think of it like this, when you go out to eat at a resturatnt, until you get healthy nutiritious fresh and tasty food you dont actually care where this returant is getting its ingredients from or who and what is the qualification or natinality of chefs there, or whatever. You are only concerened with enjoying your meal.
In the similar way to use Ai to make it you advantage it doesnot need to be your expertise. You dont learn to make an car engine yourself to use a car.
Software is much more than just Ai, like a resturant needs a good ambience or crockery waiters to serve food to manage everything else. But that doesnt also mean you can run a restrant without a kitchen or chef, similary Ai is an integral part of software development now.
Generative Pretrained model - GPT
Ai works on GPT - Generative Pre-trained Transformer. Reading it from right to left it makes it more simple to understand, this means a Transformer that is Pretrained on some large amount of data and it Generates the results in real time, doesn't just fetches something like from an API or a database.
Tranformer here simply means that a logic to predict the next best token.
Q Count from 1 to 5:
1 -------------------> 2
1,2 ------------------> 3
1,2,3 ----------------->4
.......and so on, until the best answer is generated.
To do this LLM follows the following steps:
- Tokenization
User asks a question in natural language and LLM model gives the answer in Natural Language. This question is converted into "Tokens" and similary answer is also converted to "Tokens". This conversion is done according to the vocabulary of LLM model, each LLM model for eg chatGPT, Claude, Gemini etc etc have different vocabulary. For the exact same question asked to different LLMs can result is completly different usage of tokens used. The input and output tokens generated, both are calculated to calculate the final cost of a question asked.
- Embedding
The things in LLMs are stored in a 3D space all the tokens, words, media etc are stored in a 3D data model, this is called embeddings. Here's an app to help you understand these visualizations better:
https://projector.tensorflow.org/
Now to traverse and find and calculate the words in this huge 3D space we need relations and matrices between things and concepts for example:
Suppose there are 2 words present there Delhi and India, suppose token "India" is present in 4th quadrant and "Delhi" is present in second quadrant. Now if we were to embeed "Tokyo" we first would try to find token "Japan" in 4th Quadrant and from there we would calculate the distance in degrees from India to Japan suppose its 5 degrees North East. Now similarly we will calculate the distance of token Delhi from token India suppose its 10 degrees North West from India now to find Tokyo we would try to move from India towards Japan and calclulate distance, then we will move in the same direction North East from Delhi for the same 5 degrees distance and would place Tokyo there. So this is how we make vector embeddings. All this is done using matrices in mathematics.|
- Positional Encoding
In this step we add some more positional data to make vector embeddings through which we tell LLM, where each token is and how tokens relate to each other's positions.
For example take two sentences here:
I love my wife.
My wife love me. (ignore grammar)
These two sentences have same words but different meanings. So LLM postion these tokens with other tokens in the same sentences and then try to make sense of these sentences together using postions of each words.
- Self Attention
Here we allow tokens to talk to each other so they are context aware, this allows models to look at different words in a sequence and determine which one's make more sense with each other. For example to find differnece between a "River Bank & SBI Bank".
- Feed Forward Layer
Here is actually where neural netwroks come into picture. Now in this step a very big loop executes and a probability distribution of the next best token is created. Each predicted token is assignes a weight and according to pits probability. When we set settings in the LLM that give me Truthful logical or creative answers. The LLM send those answers according to this probability distribution. If you asked for truth it'll give you the highest probabilty answer and vice-versa.
Phases in Transformer Model
Training:
To pretrain data think of it like when to try to teach a child. You point your finger at a dog and then tell the child that is a dog. This is a similar strategy with Ai models. When training them we lable an image "Dog" then feed that image to Ai model and checks its repsonse, if the image is detected correctly that means the Ai is learned or trained. Now this excercise takes place with huge data sets, millions of images or content is labeled and fed into Ai model, and then checked for another million times that if the model is able to detect the image correctly.
If the model fails during training then we need to push this model into "Back propogation" and retrain the Ai model with better labelling.
This is a very costly and time consuming process hence only large companies undertake these.
Inferencing:
This simply means using the LLM, either we can again keep on training the model with user inputs. Or we can ask actual users to use the trained LLM model.
Inferencing is almost similar we just dont "back propogate" here.
Final Thoughts
This is basically how the engine works, an overview. As a software or applicaiton developers we dont need to deep dive into these concepts we need to focus more on application layer, where the business lies.
AI is no longer just a technology of the future, it is already changing the way we work and live. Learning how to use AI effectively can help us stay competitive, productive, and ready for new opportunities.
The best time to start learning is not tomorrow itβs today. So, pick any one AI tool, experiment with it, and take your first step toward becoming AI-ready.
The acutal game lies how to use the tool to your advantage. Not exactly how to make the tool, so dont be fooled or demotivated by that.
Another intresting read: Sarvam Ai - Evaluating Indian Language ASR
feel free to reach out to me on:
linkedin : https://www.linkedin.com/in/devansh-bataan-488453189/
email me on : devanshbataan.dev@gmail.com
Devansh
Bengaluru, India

Top comments (0)