<?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: Akshit Sharma</title>
    <description>The latest articles on DEV Community by Akshit Sharma (@akshit_sharma_321b0b789a4).</description>
    <link>https://dev.to/akshit_sharma_321b0b789a4</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%2F2926598%2F03055afd-a7bc-455e-90af-8551ccae3132.jpg</url>
      <title>DEV Community: Akshit Sharma</title>
      <link>https://dev.to/akshit_sharma_321b0b789a4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/akshit_sharma_321b0b789a4"/>
    <language>en</language>
    <item>
      <title>HeadLess BAI</title>
      <dc:creator>Akshit Sharma</dc:creator>
      <pubDate>Sat, 13 Jun 2026 11:45:25 +0000</pubDate>
      <link>https://dev.to/akshit_sharma_321b0b789a4/headless-bai-4o0p</link>
      <guid>https://dev.to/akshit_sharma_321b0b789a4/headless-bai-4o0p</guid>
      <description>&lt;h1&gt;
  
  
  I Compiled a Custom Chromium Binary to Make AI Fix Bad UIs — Here's How It Works
&lt;/h1&gt;

&lt;p&gt;Most UI optimization tools work the same way: inject some JavaScript, watch click events, run A/B tests, wait months for results.&lt;/p&gt;

&lt;p&gt;I wanted something different. Something that could &lt;em&gt;see&lt;/em&gt; the DOM the way the browser actually sees it — at the geometry level — and use that to drive real layout decisions without guesswork.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;Headless BAI&lt;/strong&gt;: a behavioral AI pipeline that compiles a patched Chromium binary, intercepts DOM bounding box data in C++, clusters user behavior with K-Means, and routes layout patches through a Llama-3-8B LLM. The result: &lt;strong&gt;31.42% reduction in UI spatial friction&lt;/strong&gt; across 1,000+ user sessions.&lt;/p&gt;

&lt;p&gt;Here's exactly how it works, layer by layer.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem With JavaScript-Based DOM Inspection
&lt;/h2&gt;

&lt;p&gt;Every existing approach — Puppeteer, Playwright, even Chrome DevTools Protocol — has the same limitation: they're sitting &lt;em&gt;outside&lt;/em&gt; the rendering pipeline. When you call &lt;code&gt;getBoundingClientRect()&lt;/code&gt; in JS, you're asking the browser to compute and serialize layout data across a process boundary. That costs time, introduces CLS artifacts, and you still don't get the raw geometry the compositor is working with.&lt;/p&gt;

&lt;p&gt;I wanted native access. Which meant one thing: patch Chromium itself.&lt;/p&gt;




&lt;h2&gt;
  
  
  Layer 1: Custom Chromium Binary with C++ DOM Instrumentation
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;chromium-patches/&lt;/code&gt; folder contains the core of this — diffs applied directly to Chromium's rendering pipeline.&lt;/p&gt;

&lt;p&gt;The patch hooks into the layout engine at the point where bounding boxes are finalized for compositing. Instead of waiting for JS to request this data, we intercept it at the C++ level and serialize it to a shared memory buffer. The result: &lt;strong&gt;sub-100ms DOM geometry rehydration with zero CLS&lt;/strong&gt; (Cumulative Layout Shift).&lt;/p&gt;

&lt;p&gt;The compiled binary lives in &lt;code&gt;out/Default/&lt;/code&gt; — a full headless Chromium build with our instrumentation baked in.&lt;/p&gt;

&lt;p&gt;This is the layer most people skip. It's painful to set up (Chromium's build system is not forgiving), but it's what makes everything downstream actually meaningful.&lt;/p&gt;




&lt;h2&gt;
  
  
  Layer 2: sensor.js → FastAPI → Supabase Telemetry Pipeline
&lt;/h2&gt;

&lt;p&gt;Once you have clean geometry data, you need behavioral signal on top of it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sensor.js&lt;/code&gt; is a zero-dependency vanilla JS tracker that captures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mouse movement trajectories&lt;/li&gt;
&lt;li&gt;Scroll depth and velocity&lt;/li&gt;
&lt;li&gt;Click coordinates relative to element bounding boxes&lt;/li&gt;
&lt;li&gt;Hover dwell time per element region&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every event gets timestamped and batched. The FastAPI backend (&lt;code&gt;bai-final-year/backend/&lt;/code&gt;) ingests these, validates them against our bot filter, and writes to Supabase with Redis caching in front for burst tolerance.&lt;/p&gt;

&lt;p&gt;In practice: &lt;strong&gt;10,800+ behavioral events processed&lt;/strong&gt; across the test sessions, in real time.&lt;/p&gt;




&lt;h2&gt;
  
  
  Layer 3: Behavioral Cohort Discovery via K-Means Clustering
&lt;/h2&gt;

&lt;p&gt;Raw events are noisy. Before you can do anything useful, you need to segment users by how they actually move through the UI.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;mass_evaluation/&lt;/code&gt; module runs nightly batch jobs that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Featurize sessions: friction score per zone, scroll abandonment depth, click dispersion radius&lt;/li&gt;
&lt;li&gt;Run K-Means with WCSS optimization (final WCSS: &lt;strong&gt;23.24&lt;/strong&gt;, 3 cohorts)&lt;/li&gt;
&lt;li&gt;Apply EMA weighting to smooth temporal drift in behavior patterns&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Three cohorts emerged consistently across sessions: high-friction explorers, direct navigators, and scroll-heavy skimmers. Each one needs a different layout strategy.&lt;/p&gt;




&lt;h2&gt;
  
  
  Layer 4: Llama-3-8B LLM Layout Routing (T=0.1)
&lt;/h2&gt;

&lt;p&gt;Here's where it gets interesting.&lt;/p&gt;

&lt;p&gt;Once cohorts are identified, we don't hardcode layout rules. Instead, we prompt &lt;strong&gt;Llama-3-8B&lt;/strong&gt; with the cluster's behavioral fingerprint and the current DOM geometry, and ask it to generate a JSON layout patch.&lt;/p&gt;

&lt;p&gt;Temperature is set to &lt;strong&gt;0.1&lt;/strong&gt; — near-deterministic. This is intentional. We're not using the LLM for creativity; we're using it as a structured reasoning engine that can translate "cohort 2 users consistently abandon at the 340px scroll depth near the CTA block" into a concrete spatial adjustment.&lt;/p&gt;

&lt;p&gt;Output format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"target_element"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"#hero-cta"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"adjustment"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"translate_y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"delta_px"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;-48&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"rationale"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"High scroll-abandonment cohort loses CTA visibility before natural pause point"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Patch generation runs in &lt;strong&gt;under 500ms&lt;/strong&gt; per session cohort.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Metric: 1D Kinematic Friction Score
&lt;/h2&gt;

&lt;p&gt;Standard UX metrics (bounce rate, time-on-page) are too coarse for layout-level optimization. I needed something that could quantify &lt;em&gt;spatial&lt;/em&gt; friction — how much a layout fights the user's natural movement patterns.&lt;/p&gt;

&lt;p&gt;The Kinematic Friction Score models user cursor/scroll behavior as a 1D kinematic system. High friction = layout elements that interrupt natural movement trajectories. Low friction = elements aligned with how users are actually moving.&lt;/p&gt;

&lt;p&gt;After applying AI-generated layout patches across 1,000+ sessions:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Session-weighted friction reduction: 31.42%&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's not a vanity metric. It's computed per-session, weighted by engagement depth, and aggregated across all three behavioral cohorts.&lt;/p&gt;




&lt;h2&gt;
  
  
  Tech Stack Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;DOM Extraction&lt;/td&gt;
&lt;td&gt;C++ (Chromium internals, custom patches)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Event Ingestion&lt;/td&gt;
&lt;td&gt;FastAPI + Redis + Supabase&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Frontend Tracking&lt;/td&gt;
&lt;td&gt;Vanilla JS (zero dependencies)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Clustering&lt;/td&gt;
&lt;td&gt;scikit-learn K-Means + EMA weighting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LLM Routing&lt;/td&gt;
&lt;td&gt;Llama-3-8B via Groq (T=0.1)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Infrastructure&lt;/td&gt;
&lt;td&gt;Docker Compose&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  What I'd Do Differently
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Bot filtering is harder than it looks.&lt;/strong&gt; Our current filter uses statistical heuristics (event timing distributions, movement entropy). A dedicated ML classifier here would be more robust.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Chromium build pipeline is brutal.&lt;/strong&gt; 8+ hour compile times on a standard machine. If I were doing this again, I'd look at intercepting at the DevTools Protocol level first to validate the concept before going full custom binary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cohort stability across sessions needs work.&lt;/strong&gt; K-Means doesn't guarantee stable cluster assignments between runs. Moving to an online clustering approach (something like BIRCH or a streaming K-Means) would make the behavioral model genuinely continuous rather than batch-nightly.&lt;/p&gt;




&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;→ &lt;a href="https://github.com/Aksharma127/Headless_BAI_orignal" rel="noopener noreferrer"&gt;github.com/Aksharma127/Headless_BAI_orignal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The repo includes the Chromium patches, full backend, clustering pipeline, and evaluation outputs. Still under active development — the architecture is solid but there's cleanup to do.&lt;/p&gt;

&lt;p&gt;If you've worked on browser internals, behavioral analytics, or LLM-driven UI systems, I'd genuinely like to hear what you think.&lt;/p&gt;




&lt;h1&gt;
  
  
  machinelearning #webdev #cpp #ai
&lt;/h1&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>ux</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Everyone is using LLMs wrong........</title>
      <dc:creator>Akshit Sharma</dc:creator>
      <pubDate>Sat, 09 May 2026 19:19:18 +0000</pubDate>
      <link>https://dev.to/akshit_sharma_321b0b789a4/everyone-is-using-llms-wrong-18hp</link>
      <guid>https://dev.to/akshit_sharma_321b0b789a4/everyone-is-using-llms-wrong-18hp</guid>
      <description>&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.amazonaws.com%2Fuploads%2Farticles%2F1bs5s6j22ukstdltyubq.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.amazonaws.com%2Fuploads%2Farticles%2F1bs5s6j22ukstdltyubq.png" alt=" " width="800" height="436"&gt;&lt;/a&gt;---&lt;/p&gt;

&lt;h1&gt;
  
  
  Can an LLM "See" a Room Just by Listening?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Everyone is using LLMs wrong.&lt;/strong&gt; We are obsessed with Speech-to-Text. We take audio, flatten it into text, and feed it to a chatbot.&lt;/p&gt;

&lt;p&gt;But what happens if you bypass the text entirely?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What if you feed the &lt;em&gt;raw acoustic tensor data&lt;/em&gt; directly into a native multimodal LLM and ask it to connect the physical dots?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I am running an experiment to see if an AI can blindly "see" a room just by listening to it.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Experimental Setup
&lt;/h3&gt;

&lt;p&gt;I am blasting a 3kHz–6kHz broadband frequency chirp (a mathematical "bell ping") inside a highly reverberant, non-rectangular tile box.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Bounds:&lt;/strong&gt; Tight. &lt;code&gt;X=104"&lt;/code&gt;, &lt;code&gt;Y=101"&lt;/code&gt;, &lt;code&gt;Z=97"&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Geometry:&lt;/strong&gt; It is a geometric nightmare. There’s a 21.5-inch inward offset on one wall acting as a diffuser.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Obstacles:&lt;/strong&gt; A urinal sitting at coordinate &lt;code&gt;(0, 45, 32)&lt;/code&gt; and a toilet at &lt;code&gt;(0, 76, 0)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Target:&lt;/strong&gt; My primary test target is located precisely at &lt;code&gt;(0, 23, 15)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Traditional Approach
&lt;/h3&gt;

&lt;p&gt;Normally, calculating this requires hardcore Synthetic Aperture Sonar (SAS) math. You sweep a directional emitter, capture the sound from multiple microphone edges (&lt;code&gt;M1&lt;/code&gt;, &lt;code&gt;M2&lt;/code&gt;, etc.), and calculate the Time Difference of Arrival (TDOA).&lt;/p&gt;

&lt;p&gt;For my target object, the acoustic shadow hits at exactly &lt;strong&gt;~1.92 ms&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The "Crazy" Idea
&lt;/h3&gt;

&lt;p&gt;Instead of writing a manual C++ or Julia script to subtract the empty room baseline ($\Delta R(t)$) and plot intersecting hyperbolas, what if we just feed the raw, overlapping multipath reflection audio directly into an LLM as native tokens?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No text. No pre-processing. Just raw environmental interaction data.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the model can understand the hidden sequential context of a billion text parameters, can it implicitly learn the physics of sound propagation? Can it identify that the localized energy redistribution at 1.92 ms is an 8-inch object, while the dense tail after 10 ms is just the tile ceiling?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can an LLM act as a biological auditory cortex and map a 3D coordinate system entirely in the dark?&lt;/strong&gt;&lt;/p&gt;




</description>
      <category>ai</category>
      <category>showdev</category>
      <category>discuss</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
