Skip to main content
AboutWorkExperienceLogHireResume

Bhargav Kr Nath

Data Scientist / Machine Learning Engineer

11 solo projects, from hand-written CUDA kernels to causal uplift on 14M ad impressions, plus a merged fix in Apple’s coreai-optimization and a fix landed in Bloomberg’s Memray.

About me

Patterns first. Precision always.

I am Bhargav Nath, a Data Scientist and Machine Learning Engineer with six years of programming experience, including a year and a half building production ML systems. My background spans high-impact forecasting, business experimentation, and data pipeline architecture, as well as low-level systems engineering with custom CUDA kernels and Rust engines.

Engineering decisions8 decisions from 11 projects

Every system is a series of trade-offs.

A running log of calls made under real constraints, what got kept, what got killed, and why.

decision_log.logauto
ML EngineeringMonitoringPraxis

Keep the pricing optimiser in shadow after it failed its held-out test

Context

A pre-registered evaluation on five fresh simulated worlds found the optimiser safe but not shown to beat static prices: mean +34.3 per day, 95% CI [-113.9, +203.9], one world losing 210.9 per day.

Trade-off
A headline profit number, and a variant a pre-written selection rule would have picked, because it loosened a guardrail (a 10% max step)An evaluation that still means something: the failure, its diagnosed cause (under-identified price-driven churn) and the evidence kept in the repo
Outcome

Zero constraint violations throughout, execution disabled, and the next step written down as an experiment design rather than more optimiser tuning.

Open source

Fixes that held up to upstream review.

A sampling-performance change in Apple's coreai-models, a correctness fix in Apple's on-device ML optimization stack, and a Memray memory profiler fix, each reviewed and merged upstream.

apple/coreai-models#524
MergedNov 18, 2026

CompositeSampler: avoid full-vocabulary sort for top-p/min-p without topK

Top-p and min-p sampling sorted all 262,144 logits of a Gemma 4 vocabulary on every generated token. I replaced the sort with a logit window, a bucketed mass scan and an exact scan over a small sorted prefix, then, through two review rounds, fixed Float accumulation drift and a +inf trap and softmax bug. On one M1 Air the sampler call went from about 31 ms to 2.2 to 2.5 ms for top-p and 0.20 ms for min-p. That is a sampler microbenchmark, not an end-to-end speedup.

+387−11·2 files changed
  1. Issue #499
  2. Merged as #524

"However this would trap when there is a +inf logit in topP, which would happen in an fp16 overflow."

PR reviewer, requesting the change that led to the +inf handling

Read the case studyView the merged PR
apple/coreai-optimization#71
MergedAug 21, 2026

fix(quantization): align shared-weight QAT schedule owner with dtype (graph mode)

Fixed a bug where a weight shared across modules could be quantized with one module's precision setting while following a completely different training schedule, a subtle correctness issue in Apple's on-device model optimization pipeline.

+115−19·3 files changed

"Thanks for contributing to fix this issue! Changes look good to me."

u-simha, Apple (PR reviewer)

View the merged PR
bloomberg/memray#1056
MergedOct 17, 2026

Split threads by default in memray transform csv

Memray's CSV export has tid and thread_name columns, but it always merged allocations across threads, so the same call stack hit on several threads collapsed into one row labelled with a single thread. I first built an opt-in --split-threads flag, then reworked it after maintainer review: CSV is meant to be machine-read, so it now keeps each thread on its own row by default, matching its documented schema, while the gprof2dot and speedscope formats still merge.

+64−2·5 files changed
  1. Issue #996
  2. My PR #1006
  3. Merged as #1056

"I'm leaving the commit attribution as you since you did basically all of the work here, and I just tweaked the tests and one exception check / message."

godlygeek, Memray maintainer (PR #1056)

View the merged PR
Selected work11 projects, each with a full case study

Systems that ship, not just notebooks.

Browse all 11 project case studies

Praxis leads, then nine more projects, in the order I would read them. Each page opens with a 30-second brief that includes the biggest caveat.

01ML SystemsRuns daily

Praxis

A revenue system that runs itself, and knows when not to act.

A closed decision loop that forecasts demand, measures price elasticity from randomised tests, prices inside hard guardrails, plans payment retries and retrains its own models, running daily on Cloud Run. Automation can stage a model in shadow; only a named person can promote it.

Decision science / ML engineering / Production systems on GCP

0.1288
Forecast vWAPE vs 0.1661 naive
0.15%
Error recovering hidden elasticity
61.1%
Payments recovered vs 54.6% fixed

The pricing optimiser failed its held-out evaluation and stays in shadow mode. The page says why.

Read the case study
Events inExactly-once stateModels learnOptimiser decidesDecision recordedBack onto the bus

6 of 6

scheduled daily ticks succeeded,
2026-11-05 to 11-10

Events in → Exactly-once state → Models learn → Optimiser decides → Decision recorded → Back onto the bus ↺

the decision loop · on Cloud Run since 2026-11-04 · explanatory animation

02
02

CoreAI sampler

ML Systems

Merged into Apple's open-source coreai-models: top-p and min-p sampling no longer sorts the whole 262,144-token vocabulary on every generated token. A logit window, a bucketed mass scan and an exact scan over a small sorted prefix replace the sort, and review hardened the numerics: Double accumulation and +inf handling.

155xmin-p sampler call, 30.6 to 0.20 ms
View case study
03
03

PageForge

Systems EngineeringLive

A from-scratch Rust and CUDA implementation of vLLM-style paged KV-cache memory, plugged into Hugging Face transformers with bit-identical logits and benchmarked against its own cache, cost included.

128 vs 15Sequences in one KV budget
View case study
04
04

Custom CUDA Kernels

Systems Engineering

12 hand-written CUDA kernels for LLM, MoE, and RAG workloads, wrapped in Rust and exposed to PyTorch as zero-copy ops, three of them proven inside a real Llama-3-8B block.

12CUDA kernels
View case study
05
05

Criteo Uplift

ML SystemsLive

A 14M-row randomized ad experiment that clears every statistical bar and still loses money, until an X-Learner and a profit-aware bandit find who to actually target.

13.98MRows processed
View case study
06
06

EMPAS

ML Systems

A genetic algorithm searches 3.1x10^10 layer-wise quantization configs for a real LLM. A proxy checked against 30 GPU measurements picks the genomes, and an exact optimiser is the baseline it has to beat.

3.1x10^10Search space
View case study
07
07

FinSight-Alpha

AI EngineeringLive

A LangGraph agent that plans, retrieves, and reasons over SEC filings and checks its own draft before answering. On 65 held-out questions over five 10-Ks it answers 86% of single-hop questions and declines all 18 unanswerable ones, but finds both passages of a two-part question only 25% of the time.

86%Single-hop questions answered (35 held out)
View case study
08
08

PricePoint Dynamics

ML SystemsLive

A 9.5M-row UK supermarket price pipeline rebuilt from a broken prototype into a forecasting model, an explainability layer, and a live dashboard.

9.5MRecords analysed
View case study
09
09

Andria Systems

ML SystemsLive

An institutional-grade SEC 13F research pipeline audited by actually running it on 120M real filings: 12 real bugs found and fixed, including a signal engine that could not run at all, then re-run for real, honestly-reported results.

120.2MReal SEC filings ingested
View case study
10
10

Customer Intelligence Platform

AnalyticsLive

A 109.95M-event e-commerce behavioral pipeline built to run on a laptop: DuckDB and Polars instead of a warehouse, RFM segmentation, a propensity model, and a static dashboard, then rebuilt for reproducibility after two silent non-determinism bugs surfaced under audit.

86.7%Disk compression
View case study

Earlier work

Fitness Tracker AnalysisBuilt on synthetic data, so it shows pipeline engineering rather than a modelling result.
My data-to-decision workflow

How I take data from raw input to a reliable decision.

The same six stages on every project, the tools I reach for at each one, and the principles that keep the result honest. Each principle links to the project that tests it.

$ trace --workflow --stages=6

Ingestion

Raw input, checked at the door

Exploration

Understand it before shaping it

Features

Inputs a model can rely on

Modelling

Baseline first, then earn complexity

Evaluation

Results that survive scrutiny

Delivery

From score to operated decision

Stage 01 · Ingestion

Bring external data into the system and establish that it can be trusted before anything downstream depends on it.

Tools
PythonPolarspandasSQLDuckDBPydantic
Principles
  • Data contracts

    Expected schema, types, and value ranges are defined and enforced at the point of entry.

    PricePoint Dynamics: Pandera schemas and a leakage test guard the pipeline.

  • Validation before processing

    Completeness, uniqueness, and consistency are checked before any transformation runs.

    Customer Intelligence Platform: Re-checking claims against the full data corrected three headline figures; real sessions were 23.0M, not the 15M claimed.

  • Lineage and provenance

    Every dataset carries a record of its source and how it was collected.

    Andria Systems: Six CUSIPs OpenFIGI could not resolve stayed unresolved; no identifier was guessed.

  • Reproducible ingestion

    Identical inputs and parameters produce identical output, and interrupted loads re-run safely.

    Customer Intelligence Platform: Two silent non-determinism bugs fixed; the numbers now match on a fourth rebuild.

The engineering journey

Every version shipped a better engineer.

A running record of the roles and coursework behind the work, what each one built, not just when it happened.

$ git log --oneline

v2.1.0HEAD
Oct 2026 to PresentRemote, USAEXPERIENCE

Implemented machine learning, data science, and algorithmic workflows live on screen, explaining the what, why, and when of each engineering decision in recordings required by a leading AI frontier lab. Engaged through Mercor as an independent contractor; role title: Odin Writer.

10
core ML workflows built live
Multi-million-row
datasets in ingestion walkthroughs
4
ML algorithms, data pipelines, RAG and data structures
Added
  • ·Implemented a transformer with attention mechanisms from first principles in a live coding session, writing the full algorithm by hand and explaining each design decision as it was built.
  • ·Coded backpropagation live, explaining how the algorithm works, why each step is needed, and how it fits within model training.
  • ·Implemented ensemble ML algorithms on screen, explaining the underlying mechanics, implementation choices, and when an ensemble is the right approach.
  • ·Built complex data structures live, explaining how each one works, why it was chosen, and when it is the right fit.
  • ·Designed end-to-end ML pipelines from data ingestion through to model evaluation, narrating the reasoning and trade-offs at each stage.
  • ·Demonstrated data ingestion workflows for multi-million-row datasets, explaining the design decisions required to work at that scale.
  • ·Developed ETL pipelines on screen, explaining how raw data was transformed into a form suitable for analysis and modelling.
  • ·Worked through model evaluation approaches, explaining what each result showed and when each method should be used.
  • ·Built a RAG workflow live, explaining how its components fit together and why each design choice was made.
  • ·Wrote orchestration scripts on screen, explaining how individual workflow stages connect and run together.
Changed
  • ·Wrote every implementation by hand in each recorded session.
  • ·Presented existing ML projects as structured technical walkthroughs, explaining what was built, why it was built that way, and when each approach applies.
Shipped
  • ·Delivered narrated, live-coded recordings across ML algorithms, data pipelines, RAG, and data structures.
  • ·Recorded technical walkthroughs of multiple independent ML projects, covering architecture, implementation decisions, and trade-offs.
  • ·Applied optimisation strategies within recorded pipeline work, explaining the trade-offs behind each choice.
v2.0.0
Sep 2024 to Nov 2025UKEDUCATION

Advanced machine learning, predictive modelling, data mining, and big data architecture, weighted toward evaluation and deployment over model fitting.

99.91%
mean CV accuracy, Task Fingerprint model
3 tasks
aiming, prehension, visual-illusion
Added
  • ·Advanced ML: supervised and unsupervised methods, model selection under cross-validation, regularisation and bias-variance, class imbalance, and interpretability.
  • ·Applied statistics: hypothesis testing, experimental design, confidence intervals, and significance versus practical effect size.
  • ·Data mining at scale: distributed computation, out-of-memory datasets, and batch-versus-streaming trade-offs.
  • ·End-to-end pipelines, real-time analytics, and MLOps: reproducibility, experiment tracking, model versioning, monitoring.
Shipped
  • ·MSc dissertation classifying motor and grip strategies from 3D motion-capture data (PCA and clustering for strategy discovery; Random Forest and XGBoost classifiers). Built a leakage-aware pipeline with subject-level GroupKFold, removed features encoding final hand positions after diagnosing inflated accuracy, and used SHAP for interpretation. A cross-dataset 'Task Fingerprint' model reached 99.91% mean CV accuracy across aiming, prehension, and visual-illusion tasks.
  • ·Coursework projects from raw data through cleaning, feature engineering, baseline comparison, and error analysis, written up around whether the method worked.
v1.3.0
Jul 2023 to Aug 2023Regional HQ, IndiaEXPERIENCE

  • ·Profiled 1,053+ IT asset records and found about 22% needed correction or exclusion.
  • ·Mapped SAP ERP data flows across 3 modules: HR, Finance and Procurement.

Analysed IT asset records and mapped ERP data workflows across a public-sector operation, identifying data-quality issues and assessing the feasibility of predictive maintenance.

1,053+
IT asset records analysed
~22%
records requiring correction or exclusion
3
ERP modules mapped
Added
  • ·Built Python and pandas preprocessing workflows for IT asset data, standardising free-text vendor and hardware-model fields, normalising dates, and deduplicating records using serial numbers and asset tags.
  • ·Performed data-quality profiling across 1,053+ asset records, identifying missing values, invalid date ranges, and orphaned records, with approximately 22% requiring correction or exclusion before reliable downstream analysis.
  • ·Formulated a predictive maintenance problem covering both binary hardware-failure classification and time-to-failure estimation, identifying candidate features including asset age, warranty status, site, device class, and historical repair count.
  • ·Evaluated target-definition and data-leakage risks arising from retrospective maintenance tickets and backfilled dates, documenting why the available data was insufficient to support reliable model training.
Changed
  • ·Replaced recurring manual export and spreadsheet cleaning with scripted Python preprocessing, making asset-data preparation more consistent and repeatable.
  • ·Evaluated GeM procurement records against the internal asset register to establish potential linkage keys. Where no shared identifier existed, developed candidate matching logic using vendor, hardware model, and purchase-date proximity, documenting match quality and remaining linkage limitations.
Shipped
  • ·Produced analytical dashboards covering asset lifecycle stages, site distribution, and maintenance history, helping identify asset classes experiencing greater replacement pressure.
  • ·Documented SAP ERP data workflows across HR, Finance, and Procurement, highlighting inconsistent entity representations and data relationships that complicated cross-module reconciliation.
  • ·Delivered a technical handover covering data-quality findings, recommended remediation, predictive maintenance feasibility, target-leakage risks, and record-keeping improvements required before model development.
v1.2.0
Jul 2022 to Aug 2022Guwahati, IndiaEXPERIENCE

  • ·Cut a common lookup from 1.8 seconds to 14 ms using EXPLAIN, composite and covering indexes.
  • ·Normalised the MySQL schema to 3NF across 15+ application modules.

Improved relational data architecture, query performance, and scheduling logic for a multi-module application.

1.8 sec → 14 ms
common lookup latency
15+
modules normalised to 3NF
Added
  • ·Redesigned the MySQL schema to Third Normal Form (3NF) across 15+ application modules, consolidating overlapping tables into a canonical relational model with defined relationships and enforced foreign-key constraints.
  • ·Profiled query execution using MySQL EXPLAIN and observed access patterns, introducing composite and covering indexes to reduce common lookup latency from 1.8 seconds to 14 milliseconds, a 99.2% reduction.
  • ·Developed data-processing workflows to aggregate raw interaction logs into session-level and user-level datasets, making structured analytical data available without repeatedly processing the underlying event records.
Changed
  • ·Used observed application usage patterns to inform schema refinements, removing planned fields with limited demonstrated use and simplifying the relational data model.
  • ·Consolidated scattered date-handling logic into a modular, rule-based scheduling component, separating business rules from application code to improve testability and maintainability.
Shipped
  • ·Implemented Node.js scheduling logic for holidays, leave, and conflicting bookings, adding unit tests for boundary conditions and scheduling scenarios associated with recurring defects.
  • ·Produced entity-relationship documentation covering table purpose, key relationships, integrity constraints, and indexing rationale to support ongoing development and database maintenance.
  • ·Prepared structured interaction datasets for downstream reporting and potential predictive modelling.
v1.1.0
Aug 2020 to Jun 2024IndiaEDUCATION

A foundation in software engineering, algorithms, databases, and the systems thinking behind my later data science work.

Added
  • ·Algorithms, data structures, and databases: complexity analysis, relational design, normalisation.
  • ·Operating systems, networks, system design, and software engineering practice (version control, testing, modular design).
  • ·Compiler design, assembly, and computer organisation for a working picture of how software runs.
  • ·Linear algebra, probability, and statistics as the maths base for machine learning.
Shipped
  • ·Software projects combining application architecture, data management, and problem-specific engineering.
  • ·Final-year project: a blockchain-based insurance system automating workflows through decentralised records and smart-contract logic.
v1.0.0
Jul 2020 to Nov 2021Guwahati, IndiaEXPERIENCE

  • ·Cut a full pipeline refresh from 35 minutes to 42 seconds, about 50 times faster.
  • ·Forecast 12–18% MAPE on high-volume product lines, chosen by rolling-origin backtests.
  • ·Brought weekly reporting down from 6–7 hours to 2–2.5 hours.

Engineered reproducible data pipelines, forecasting models, and anomaly detection workflows across sales and inventory operations, improving analytical throughput, forecasting reliability, and reporting efficiency.

500K+
sales and inventory records
12–18%
forecast MAPE on high-volume lines
~50× faster
full-refresh performance
64–71% less effort
weekly reporting effort
Added
  • ·Engineered end-to-end Python ETL pipelines using pandas, Polars, and NumPy to process 500K+ sales and inventory records across 100+ product variants and suppliers, reconciling inconsistent source layouts, SKU descriptions, and units into a canonical analytical schema.
  • ·Implemented data validation and ingestion controls covering schema conformance, data types, value ranges, and referential integrity, quarantining invalid records with traceable reason codes rather than silently discarding data.
  • ·Developed time-series feature engineering pipelines incorporating multi-horizon lags, rolling statistics, seasonal and festival indicators, supplier-level aggregates, and price changes to capture demand patterns and improve forecasting inputs.
  • ·Benchmarked seasonal naive, SARIMA, XGBoost, and PyTorch sequence models using rolling-origin backtesting, selecting models based on out-of-sample MAPE and MAE rather than random train-test splits that could introduce temporal leakage.
  • ·Built an Isolation Forest anomaly detection pipeline for 50K+ monthly transactions, identifying potential pricing errors, duplicate transactions, and quantity outliers, with top-ranked alerts assessed against a manually reviewed sample.
  • ·Containerised ETL and forecasting workflows using Docker, pinning Python dependencies and standardising runtime configuration to improve environment consistency across development and scheduled execution. Target impact: reduce environment setup from approximately 30 minutes to under 5 minutes.
  • ·Implemented a GitHub Actions CI/CD workflow to automate Python test execution, code-quality checks, data validation, Docker image builds, and smoke tests on code changes, establishing repeatable quality gates before releasing pipeline updates. Illustrative scale: 20+ automated checks per workflow run.
Changed
  • ·Introduced model-assisted demand forecasting for inventory and procurement decisions, achieving 12–18% MAPE on high-volume product lines; selected XGBoost where it outperformed baseline forecasts while retaining seasonal naive predictions for lower-volume products.
  • ·Replaced ad hoc Excel reporting with parameterised, version-controlled Python scripts, standardising recurring analytical transformations and reducing inconsistencies between reporting runs.
  • ·Optimised expensive joins and transformations by replacing row-wise pandas operations with vectorised implementations and Polars equivalents, reducing full-refresh runtime from 35 minutes to 42 seconds, approximately 50 times faster.
  • ·Established a repeatable pipeline execution process spanning data validation, feature preparation, model inference, and report generation, reducing dependence on manual intervention and making failures easier to isolate and reproduce.
Shipped
  • ·Reduced weekly reporting effort from 6–7 hours to 2–2.5 hours by automating data preparation and consolidating spreadsheet workflows into a review-focused reporting process.
  • ·Delivered a Streamlit application and Power BI dashboards spanning 40+ sales, inventory, supplier performance, and anomaly metrics, enabling interactive analysis without generating a new extract for every query.
  • ·Packaged forecasting models for repeatable inference and established scheduled retraining with monthly MAPE and MAE evaluations against historical backtesting results to monitor model performance over time.
  • ·Documented pipeline stages, validation rules, failure modes, quarantine reason codes, and recovery procedures in an operational runbook to support maintainability and troubleshooting.
Engineering log

Results and assumptions that did not hold up.

Write-ups of what I found when I checked my own numbers and designs: the evidence, what changed, and whether it is still open.

10 Nov 2026/Criteo Uplift

The bandit looked profitable because of how I scored it

+$0.0012bandit minus showing no one the ad, interval −$0.0008 to +$0.0030

9–10 Nov 2026/FinSight-Alpha

Hybrid retrieval did not beat BM25, and the reranker did the work

−2 pointshybrid minus BM25 at top 8, interval −15 to +11

9 Nov 2026/EMPAS

My genetic algorithm lost to a dynamic program

0.7 to 1.3 millinatsGA behind the exact optimum at 4 of 6 budgets

8–10 Nov 2026/PricePoint Dynamics

A forecast that scored near-perfect because it could see the answer

£0.053 vs £0.023model error vs repeating the last price, next day

Open the log (9 entries)/Shorter pieces for Leeds Financial Insights are listed there too.

Contact

Let's build something.

Open to ML engineering and applied research roles.

Leeds, UK·Usually replies within 24h
GitHubLinkedInEmailResume

or press ⌘K → Copy email address

HomeProjectsAboutExperienceLogHireContactResumeGitHubLinkedIn
© 2026 Bhargav Kr Nath