zain babar
i’m zain, a math student at waterloo. i’m interested in how machine learning works, from the math behind it to what happens when you put it to use.
i like building the pieces myself and testing them against real problems.
projects
Lecture RAG
retrieval over my linear algebra notes
Pathshift
shift detection on pathmnist
Chess LLM Reasoning
a study on distillation and reward hacking
Autograd Engine
reverse-mode autodiff in c++
GPT-2 Inference Engine
a transformer from scratch, with a kv cache
Used-Car Prices
sql cleaning and gradient boosting
ChamberCrawler3000
a c++ roguelike for cs 246
experience
machine learning engineering intern
vaporvm2025
built a retrieval component that grounds llm answers in company data, and python pipelines to clean and prepare text.
programming instructor
code ninjas2023–25
taught programming to kids, mentored a first lego league team, and wrote python exercises.
education
honours mathematics
university of waterloo 2025–
:+*xxx?*+-, :!XOOOOOOXx**?+: ..,,,,,. ;?oOOOOooXXx?*+=~~-, .,:;;;;;;;:, :*OOOOOOoooXXXxx*!=~~~; .:-~~~~~~~---;:. ,!oOOOOOOoooXXx?*!=~~~~~~-, ,;~====~~~~~~----:. :!oOOOOOOOOoooXx?*!+=~~~~----: ,;-~~=: ,-=+++==~~~~~~~-----;:;:;=*####oXxXOOoooXXx?*!=~~~-------;. ,-=+!*!!!?==; .:-=+!!++=~~~~~~~~~~~~~==%%%%####OXX?*x?oXXx?*!+=~----------;,. :-=!**!!*??=~~~~ .;~+!!!!++==~~~~~~~~~~~%%%%%%##OOooooXx?!~~!x?*+=~-------------:,. ,-+*xXxx?!+==~=!~~~- ,;=+!***!!!++===~~~~==~%%%%%###O#OoXXx?*!+=~~!+~!+=---------------;:,. .:~=!!!!++===!**~~~=~~--~*+!******!!!!+++++===%%%%####OOOooXooXXXxx?**+~~~=~--------------~-~~-:,. ,;~+*****!!=~~~~~~!+~~~~--~=+*xXXXxxxxxxxXXX%%%%####OOOoooXXxx?*!!+=~~~~==~~---------------~~==~-;;:,... .:-~+++++==~~~=+++~~~~==~~~~~~=x!***???xxXo%%%%####OOOOoooXXxxxx??*!!!!!+~~~~----------------~=+!++=~--;;;:::::,,.. Oo?+ .:-=++++==~~~~~~~~~~==~~~=~~~~~=*!*?xXooO%%%%####OOOOooooXXxx??**!+=~~~~~~~~~----------------~=!****!!+++====~~~-;;:,. %%%%%%%OX?+-:. ,:-=+++==~~~~~~~~~~~~~~~=~~~=~~!+x*xXO%%%%%####OOOOOooooXXXxx??**!!+=====~~~~~---------------~=!*?xxxxx?????****!!+=*o&&&%%%%%OX*+-:. ,;-=====~~~---~~~~~~~~~~~~~=~~~**!?XO#%%%####OOOOOOooooXXXxx??**!++=~~~~~~~~~~---------------~=!*?XXooooooooooooxx.**&&&%%%%#Oox*+~;, .,;-~===~~~-------------~~~~~~=*!=!?Xo######OOOOOOoooooXXXxxx??*!!++=~~~~~~~------------------~=!?xXooOO####%xxx..*.&&&%%%%%##oX?+~;,. .,;-~==~~~-----------------~~~~~~=!?XoOOOOOOOOOOOoooooXXXXxx??**!!+==~------~~----------------~+!?xXoOO##%xxxx...&&&%%%%%###OOox*+~;,. .:;-~~~~~--------------------~~=!*?xoOoOOOOOOOOoooooooXXXxxx??**!!+==~~~~~-------------*------=+*xXoO#xxxxx....&&&%%%%%%###OOox*+~;:. .:;-~~~~----------------------~~~~+*?XooooOOOooooooooXXXXxxx??**!++==~-----------------***----=!?Xxxxxx%....&&&%%%%%%%####OOoX?*+-;,. ,:;--~~~-----------------------~~=+*?xXooooooooooooooXXXXxxx??**!++==~~~-------------~~******..?xxx%*....&&&&%%%%%%%####OOOoXx*+~;:. .,:-~~~~~------------------------~+!?xXXoooooooooooooXXXXxxx??**!++==~------~~~----~~~~~~*..******...%&%%%%%%%%%%%#####OOOoox?!=-:,. .,:;;--~~~------------------------~+!?xXXooooooooooooooXXXxxx??*!!++==~~~--------~~~~~~~~~.**=xxXo#%#%%%%%%%%%%%######OOOOooXx*+~;:. .,:;~==~~~-----------------------~+!?xXXoooooOOOooooooXXXxxx??**!++==~~--~~~~~~~~~~~~~~~~.*xxxX?XO###%%%%%%%%#######OOOOooXx?!=-:,. ..;----~~~~-----------------------~+!?xXXoooOOOOOOOoooooXXXxx??**!++==~~~~~~~~~~~~~=~~~~=+.A**?**xXO#####%##########OOOOOooX?*+~;,. .,,:;-==~~~~----------------------~+!?xXXooOOOOOOOOOOoooXXXxxxx?*!!+==~~~~~~~===~~~~~~=+~~~=*!=+*?Xoo##############OOOOOooXx*!=-:, ..,:-~-~~~~~----------------------~+*?xXooOOOO###OOOOOooooXxx??**!!++==~~~~~~~~~~~=++=~~~~!!~~~+!?xXoOO###########OOOOOOooX?!=-;,. ..,:;--~=~~~~---------------------~+*?XXoOO###########OooXXooXX?*!!++===~~~==++!!+~~~~~=*!~~~~!?xXoOOOOOO#########OOOOOOoXx*+=-:. ..,:;;-~~~~~~---------------------=!*xXoO###%%%%%%######ooXXx??****!!!++==~~~~~~~~~~=**!~~~~!**!!*?xXO##OO#########OOOOOoX?!=-:,. .,::;--~~~~~~----------------#oXXx???******?X!!%%%##OOO#OoXxx?**!!+++=======+!*????*+=====??+=+!*?xXooO#############OOOXx*+~;,. .,,:;---~~~~~------------Xx*!++==~~~~~~~~~~~=+*==+=OOoooXooooXXXxxxx?????**!!!++!!!!!!!!+?x!+++!*?xXooOOO#############oX?!=-:, .,::;---------------o?+=~-;;::::,,,,,::::::;-~~;--*~=oooxx??***!!!++++++++!!!***?????????X*!!!!*?XoOOOO###%%###%%%##Oox*=-:, .,:;-----------x+~-::,... ....,,::,::;-+-~~**X?**!!!!!+!!*??xxxXXXXXxxXXXXXXxxXo?***?xoOOOO####%%%%%%%%Oox*+~;,. .,;--------!~;:,. ...,,;~;;~=~=+x!++++?xx??****??xxXoOOOoooooooXXXxxoX??xXXoOO##%%%%%%%#ox*+-;,. .:;-~~-:,. .,:,::=----~*==*?!+!!!**??xxXXooO##OOOOOOOOoooooXxxxXOOO##OOO##OX?!=~;,. ..:-:;+-=-~~~?+++!!*??xXXooOOO#%######%%#OOOOOOoOO##OoXx*~ .,,,---=~-~~*=++!*?xxXooOO###%%#%%%%%%###%%####OX*+; .:::--~-~=~=+!*xoOOOOO####%%%%%%%%%%%%%%#Ox*=: ...:;;=--~~*=!*XoOOOO###%%%%%%&%%%&%#OX*=;. .,,;;--=~~?!*?XoOO##%%%%%%&&%%%OX?+-, .,::-;+~~=!x?XoOO#%%%%%&%%#o?+~:. ..,;:=-!=x!?XoOO##%%#OX?!~;. ...,-:;!=!xooooXx?*+~;, ,,,,-~~~===~~;:. ..,,,,,.
zain babar
w1 —w2 —loss —|∇L| —
loss landscape
static view · final paths shown. keyboard: arrow keys rotate, r picks a new start, space pauses or resumes. in study view, alt and arrow keys move the probe, enter starts a run, f switches between levels and flow, and escape returns to the portfolio.
optimizer details
three optimizers train the same small network. the terrain is its loss; o marks their shared start.
| marker | optimizer | loss ↓ | result |
|---|---|---|---|
| G | •gradient descent | 0.0035 | lowest |
| M | *momentum | 0.0033 | lowest |
| A | xadam | 0.0033 | lowest |
step 335 · best found 0.0033
f(x) = sin(w1 x) + sin(w2 x), fit to 24 fixed, noisy samples. the ground is weight space; height is proportional to the square root of mean squared error. all three use the full batch. dim trails continue behind the terrain.
gradient descent: lr=0.004; momentum: lr=0.004, momentum=0.9; adam: lr=0.03. adam uses β1=0.9, β2=0.999, ε=10⁻⁸. each run stops when all updates stay below 0.0002 for 20 steps, or at 900 steps. “lowest” means within 0.001 of the best loss found by a grid search and refinement.