<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Devansh Bataan</title>
    <description>The latest articles on DEV Community by Devansh Bataan (@devanshbataan_dev).</description>
    <link>https://dev.to/devanshbataan_dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4091230%2Faf85c3d7-c9be-49db-829c-cc470b715ee8.jpg</url>
      <title>DEV Community: Devansh Bataan</title>
      <link>https://dev.to/devanshbataan_dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devanshbataan_dev"/>
    <language>en</language>
    <item>
      <title>BDSM - Behavioural Detection Sequence Model</title>
      <dc:creator>Devansh Bataan</dc:creator>
      <pubDate>Tue, 01 Sep 2026 14:01:52 +0000</pubDate>
      <link>https://dev.to/devanshbataan_dev/bdsm-behavioural-detection-sequence-model-1f1</link>
      <guid>https://dev.to/devanshbataan_dev/bdsm-behavioural-detection-sequence-model-1f1</guid>
      <description>&lt;p&gt;What did you thought ? 😈&lt;/p&gt;

&lt;p&gt;I want to share an intresting take about X (Twitter). Recently twitter was facing a lot of backlash about the impressions and visibility any post was getting. People were calling out on it that this algorithm is rigged &amp;amp; even racist.&lt;/p&gt;

&lt;p&gt;BDSM is an algorithm from Twitter to manage feeds and reach for anything that we post on Twitter. Due to this backlash they open sourced an algorithm for how they rank posts.&lt;/p&gt;

&lt;p&gt;This algorithm rank tweets, how impressions are generated, which tweet will go viral and which wont. All these things are open sourced now to increase transparency.&lt;/p&gt;

&lt;p&gt;This is the repository opensourced by twitter : &lt;a href="https://github.com/xai-org/x-algorithm" rel="noopener noreferrer"&gt;https://github.com/xai-org/x-algorithm&lt;/a&gt; This is not the exact algorithm for obvious reasons but it contains all the things that we need to know.&lt;/p&gt;

&lt;p&gt;Home Mixer&lt;br&gt;
This repo has many different services exposed like "Home Mixer" : this service manages the user feeds, what the end user sees how the tweets are visible and ranked on his Twitter home or feed screen. It manages feeds using a mix of current trends, with people you've followed, some recommendations and some more things like new related accounts or advertisements.&lt;/p&gt;

&lt;p&gt;The Home Mixer mixes up things and shows on your feed, trying to make a perfect balance of everything.&lt;/p&gt;

&lt;p&gt;It also uses another service "Thunder Client" that runs aggregation pipelines for your feed.&lt;/p&gt;

&lt;p&gt;Home mixer uses 'Hydraters', to decide if you want to pre compute tweets or fetch them on demand.&lt;/p&gt;

&lt;p&gt;How are tweets scored:&lt;br&gt;
This image shows you how does each tweet gets scored, better the score better goes the reach.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foy3d1sl43vaxh2ras49m.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foy3d1sl43vaxh2ras49m.jpeg" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we can see here, the highest score goes to the tweet when someone clicks on the copy link to share your tweet across other apps, this signifies that your tweet is so good that people from other apps want to join twitter due to content of your tweet. So nice! And in the bottom we can see penalties also if someone reported your tweet you loose 234 points ! that's it done for the day. Be careful when and what you tweet.&lt;/p&gt;

&lt;p&gt;BDSM - Behavioural Detection Sequence Model :&lt;br&gt;
Now lets talk about my favourite BDSM (just cant stop laughing), this is a simple service, made in python, that is used to detect if you are a bot or an real user, it has a very simple architecture. All the things sent to spam are done using this service. The intresting part here is this service never reads a single words in your tweet, never sees any content. This service just looks at how and when you post ot use twitter and then make patterns out of it. That's it.&lt;/p&gt;

&lt;p&gt;The biggest challenge for this service is to detect "Bot farms" or "Follow Farms". Reading content of tweets here doesnot make much sense because lot of bots are just there to increase followers of people. The bots hardly posts anything they mostly follows people and wait for follow back, it doesnot post even a single word. The next problem is 'Zero Content Signal', the content is easy to change, just ask ai to rewrite the flagged content and boom that's it, some post marked as spam ? Run it through ai and you are back in an hour.&lt;/p&gt;

&lt;p&gt;Hence twitter updated its algorithms to detect usage patterns, this servcei BDSM checks around last 512 actions and compare this with the actions of how an actual human uses twitter, it checks actions like scrolls, likes, follows, views, reposts, replies etc. Then these action and logs run through BDSM algorithm and it assigns a bot detection score, based on a probabilty distribution if its a bot or not. Based on this score you may get a captcha to do some actions like reporting, posting, following etc. Twitter just does not block anyone immediately, they check for usage rhythm, timestamps and patterns.&lt;/p&gt;

&lt;p&gt;There can be instances when a bot or you may have done some actions in past and you also may get categorised as a bot according to BDSM. These concepts and solutions comes very handy when you are designing systems.&lt;/p&gt;

&lt;p&gt;Summary&lt;br&gt;
Twitter/X finally open-sourced parts of its recommendation system, giving us a peek behind the curtain at why one tweet gets millions of views while another dies quietly with 17 impressions and emotional damage.&lt;/p&gt;

&lt;p&gt;From Home Mixer, which decides what appears on your feed, to tweet scoring signals that reward engagement and punish negative feedback, the system is basically a giant ranking machine constantly asking: “Is this interesting, useful, spammy… or are you just desperate for followers?”&lt;/p&gt;

&lt;p&gt;And then there’s the wonderfully named BDSM — Behavioural Detection Sequence Model. Instead of obsessing over what you write, it studies how you behave: likes, follows, scrolls, reposts, timing, and hundreds of recent actions to figure out whether you’re a human or a suspiciously enthusiastic script running from somebody’s basement.&lt;/p&gt;

&lt;p&gt;The bigger lesson is actually about system design: when content can easily be rewritten or manipulated, behaviour and patterns often become much stronger signals than the content itself.&lt;/p&gt;

&lt;p&gt;So yes, come for the unfortunate acronym. Stay for recommendation systems, ranking algorithms, bot detection, and some genuinely useful engineering ideas. 😈&lt;/p&gt;

&lt;p&gt;Feel free to reach out to me on : &lt;br&gt;
linkedIn - &lt;a href="https://www.linkedin.com/in/devansh-bataan-488453189/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/devansh-bataan-488453189/&lt;/a&gt;&lt;br&gt;
email me at - &lt;a href="mailto:devanshbataan.dev@gmail.com"&gt;devanshbataan.dev@gmail.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Devansh&lt;/p&gt;

&lt;p&gt;Bengaluru, India&lt;/p&gt;

</description>
      <category>twitter</category>
      <category>socialmedia</category>
      <category>systemdesign</category>
      <category>microservices</category>
    </item>
    <item>
      <title>AI Writes Code. Engineers Build Software.</title>
      <dc:creator>Devansh Bataan</dc:creator>
      <pubDate>Tue, 01 Sep 2026 13:57:38 +0000</pubDate>
      <link>https://dev.to/devanshbataan_dev/ai-writes-code-engineers-build-software-3bbc</link>
      <guid>https://dev.to/devanshbataan_dev/ai-writes-code-engineers-build-software-3bbc</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;br&gt;
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.&lt;br&gt;
The way we think about code softwares and the way we write code, everything changed drastically.&lt;/p&gt;

&lt;p&gt;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.&lt;br&gt;
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.&lt;br&gt;
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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Generative Pretrained model - GPT&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Tranformer here simply means that a logic to predict the next best token.&lt;/p&gt;

&lt;p&gt;Q Count from 1 to 5:&lt;/p&gt;

&lt;p&gt;1 -------------------&amp;gt; 2&lt;/p&gt;

&lt;p&gt;1,2 ------------------&amp;gt; 3&lt;/p&gt;

&lt;p&gt;1,2,3 -----------------&amp;gt;4&lt;/p&gt;

&lt;p&gt;.......and so on, until the best answer is generated.&lt;/p&gt;

&lt;p&gt;To do this LLM follows the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tokenization&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Embedding&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;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:&lt;br&gt;
&lt;a href="https://projector.tensorflow.org/" rel="noopener noreferrer"&gt;https://projector.tensorflow.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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:&lt;br&gt;
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.|&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2cic5116youjlrakkaom.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2cic5116youjlrakkaom.png" alt=" " width="349" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Positional Encoding&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;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.&lt;br&gt;
For example take two sentences here:&lt;br&gt;
I love my wife.&lt;/p&gt;

&lt;p&gt;My wife love me. (ignore grammar)&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Self Attention&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;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 &amp;amp; SBI Bank".&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Feed Forward Layer&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Phases in Transformer Model&lt;/p&gt;

&lt;p&gt;Training:&lt;br&gt;
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.&lt;br&gt;
If the model fails during training then we need to push this model into "Back propogation" and retrain the Ai model with better labelling.&lt;br&gt;
This is a very costly and time consuming process hence only large companies undertake these.&lt;/p&gt;

&lt;p&gt;Inferencing:&lt;br&gt;
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.&lt;br&gt;
Inferencing is almost similar we just dont "back propogate" here.&lt;/p&gt;

&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;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.&lt;br&gt;
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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Another intresting read: Sarvam Ai - Evaluating Indian Language ASR&lt;/p&gt;

&lt;p&gt;feel free to reach out to me on:&lt;br&gt;
linkedin : &lt;a href="https://www.linkedin.com/in/devansh-bataan-488453189/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/devansh-bataan-488453189/&lt;/a&gt;&lt;br&gt;
email me on : &lt;a href="mailto:devanshbataan.dev@gmail.com"&gt;devanshbataan.dev@gmail.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Devansh&lt;br&gt;
Bengaluru, India&lt;/p&gt;

</description>
      <category>ai</category>
      <category>software</category>
      <category>softwaredevelopment</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
