RSSAmplifier

Blog

Home on Nathaniel Thomas

Recent content in Home on Nathaniel Thomas

nathom.devRSS feed ↗28 posts

Latest posts

Continual Learning is not Continual Midtraining

Many have caught onto the truth that AGI-through-pure-LLM-scaling is probably
not going to happen. And many have identified continual learning as the key
difference between LLMs and a generally intelligent agent. If you’ve ever used
Claude Code, you will be acutely aware of how effective context length limits
LLMs’ general utility, and if only we had something that…

Advent of Code 2025 in Haskell

It&rsquo;s that time of year again. &#xA; You can try out the solutions here . &#xA; Day 1 &#xA; module Main where &#xA; &#xA; import Common ( parseFile ) &#xA; import Control.Applicative (( <|> )) &#xA; import Data.List ( foldl' , scanl ) &#xA; import Data.Text qualified as T &#xA; import Data.Void ( Void ) &#xA; import Text.Megaparsec &#xA; import Text.Megaparsec.Char &#xA; import…

Comparing Structured Data Formats for LLMs

As we start training LLMs as Agents, we must think about how to best pass&#xA;information to and from the real-world environment. If it calls an external&#xA;function, how should arguments be passed? How should data from the environment&#xA;be fed to the model? The simplest (and most general) solution uses structured&#xA;data formats , such as JSON. These formats can encode arbitrarily…

The best T-Shirt

I recently bought Bryan Johnson&rsquo;s&#xA; Super Veggie T-Shirt ,&#xA;in order to fully immerse myself in his protocol. &#xA; &#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA; &#xA;&#xA; &#xA; &#xA; &#xA;&#xA; &#xA; &#xA; It was $37—not a terrible price—and I think it looks cool. But once I receieved&#xA;it, I noticed that the quality was markedly better than any other t-shirts I&#xA;own,…

How to use $\LaTeX$ in Excalidraw

Excalidraw currently doesn&rsquo;t support &#xA; L A T E ​ X , which sucks. The workaround is to&#xA;generate an SVG for whatever math you want to render, and paste that in. &#xA; You can use this script to generate the SVG: &#xA; import matplotlib.pyplot as plt &#xA; &#xA; # use svg backend &#xA; plt . switch_backend ( 'svg' ) &#xA; &#xA; # enable latex rendering &#xA; plt . rcParams […

Sharpe Ratio Based Portfolio Simulator

The Sharpe Ratio measures the quality of an equity or hedge fund by showing the&#xA;return per unit of risk, calculated as &#xA; σ μ − r ​ , where &#xA; μ &#xA;is the expected return, &#xA; r is the risk-free rate, and &#xA; σ is the&#xA;standard deviation (volatility). A higher ratio indicates better performance for&#xA;the risk taken—more return without excessive variability. In the simulator,…

Entropy from First Principles

I find entropy to be extremely fascinating. But, matching the formula&#xA;&#xA; ∑ p i ​ lo g p i ​ 1 ​ to its &ldquo;intuitive&rdquo; explanations related to prefix&#xA;free codes and information content is not obvious. Here, I want to go over a&#xA;couple ways to independently arrive at the idea.

Advent of Code 2024 in Haskell

I&rsquo;m doing AoC in Haskell to learn the language. These are my solutions. &#xA; Day 1 &#xA; import Data.List &#xA; import qualified Data.Map as Map &#xA; &#xA; f xs = &#xA; let x1s = sort $ map fst xs &#xA; x2s = sort $ map snd xs &#xA; diff x y = abs ( x - y ) &#xA; in sum $ zipWith diff x1s x2s &#xA; &#xA; counter = Map . fromListWith ( + ) . map (, 1 ) &#xA; &#xA; sim xs = &#xA; let c =…

This Website

This entire site is static. All the visualizations are running completely in the&#xA;browser. &#xA; I use Hugo to build the site. It&rsquo;s pretty neat, since its&#xA;template language lets me program a lot features statically, without any&#xA;JavaScript. Even the &#xA; L A T E ​ X on this site is statically rendered! &#xA; The theme is based off of Typo by tomfran ,&#xA;but I&rsquo;ve made a…

Interactive Gaussian Mixture Models

Goal &#xA; Suppose we have a dataset of features, but no labels. If we know (or guess) that&#xA;there are &#xA; K classes in the dataset, we could model the dataset as the weighted&#xA;average of &#xA; K class–conditional Gaussians. This is what Gaussian Mixture Models&#xA;do. &#xA; We assume that the model is parameterized by&#xA;&#xA; θ = { π k ​ , μ k ​ , σ k 2 ​ } k = 1 K ​ , where &#xA; π k ​…

The Zed Text Editor

I am a Neovim diehard, but it is impossible to use over SSH. Since I do ML&#xA;research, all my code runs on a remote server with high power GPUs. Reluctantly,&#xA;I have been using VSCode, for its excellent remote-ssh plugin. But even with its&#xA;half-baked Vim mode, it is still the same sluggish Electron app. &#xA; Zed may the the editor that changes this game. It is extremely fast,…

Local Approximation

Training a deep neural network is essentially a compression task. We want to&#xA;represent our training data distribution as a function parameterized by a bunch&#xA;of matrices. The more complex the distribution, the more parameters we need. The&#xA;rationale for approximating the entire distribution is so that we can forward&#xA; any valid point at inference using the same model, with the same…

Bayesian Parameter Estimation

Bayesian Parameter Estimation (BPE) is fundamentally different compared to&#xA; MLE or MAP . Whereas the latter two solve for an&#xA;optimal set of parameters &#xA; θ ^ for the model, BPE treats&#xA;&#xA; θ as a random variable with a distribution&#xA;&#xA; p ( θ ) . &#xA; Setup &#xA; We are given a dataset &#xA; D , which contains &#xA; n i.i.d. features&#xA;&#xA; x j ​ . Given a new feature…

Hario V60 Recipes

This is a collection of V60 recipes that I have used. &#xA; Emi Fukahori (1 cup) &#xA; Source video. &#xA; This recipe is specific to the Hario switch, my current brewer. It gives a&#xA;consistent and bright cup. &#xA; &#xA; Filtered Water: 200g &#xA; Coffee: 14g &#xA; Grind: Medium-coarse, 7.5 on Fellow Ode 2 &#xA; Ratio: 14.28 &#xA; Water temp: 95º C &#xA; &#xA; &#xA; Close the switch (no flow),…

The Ten Armed Testbed

This is a method of evaluating strategies for the multi-armed bandit problem&#xA; 1 . The testbed works as follows: &#xA; &#xA; Generate &#xA; 10 reward means &#xA; μ i ​ associated with &#xA; 10 actions &#xA; a i ​ &#xA; On each iteration allow the agent to take some action &#xA; a j ​ , and receive a&#xA;reward &#xA; r t ​ ∼ N ( μ j ​ , 1 ) . &#xA; &#xA; We repeat this for &#xA; 100 randomly…

Maximum A Posteriori (MAP) Estimation

The goal is essentially the same as MLE . We have an assumed model&#xA;for &#xA; p ( x j ​ ∣ ω j ​ ) parameterized by &#xA; θ . We want to classify&#xA;a feature &#xA; x into some class &#xA; ω j ​ based on a labeled dataset&#xA;&#xA; D . In MLE, we were trying to maximize the likelihood : &#xA;&#xA; θ ^ MLE ​ = ar g θ max ​ p ( D ∣ θ ) In MAP, we instead maximize the a posteriori :

Maximum Likelihood Estimation

Goal &#xA; We are given a dataset &#xA; D , which contains feature vectors&#xA;&#xA; x k ​ and class labels &#xA; ω k ​ . Denote &#xA; D i ​ as the set of&#xA;features of class &#xA; ω i ​ . We assume the following: &#xA; &#xA; That&#xA;&#xA; p ( x ∣ ω j ​ ) ∼ N ( μ j ​ , Σ j ​ ) .&#xA;That is, given a class label, the distribution of features belonging to that&#xA;class forms a Gaussian with mean…

The Mechanics of Causal Self Attention

Causal self-attention is the mechanism underpinning most of the advances in AI&#xA;since 2017. In this article, I will step through the computation and hopefully&#xA;gain a better intuition of how it works. &#xA;&#xA; SelfAttention ( Q , K , V ) = softmax ( mask ( d ​ Q K T ​ ) ) V At a high level, this function takes one sequence and transforms it into&#xA;another. A sequence is a list of token…

Building and Deploying Rust to a Hugo Site

We&rsquo;re going to go through a minimal example that will let you run Rust code on&#xA;the client side of a Hugo site. We are going to compile the Rust code into&#xA;WebAssembly (wasm), which will give us near-native performance on the browser!

An Expert–Level 2048 Bot

Explore different methods to win, and beat expert humans in 2048 interactively!

Interactive MNIST Explorer

Draw digits on the canvas and watch an AI guess what it is!

Switching to Obsidian

One of the most striking elements of Silicon Valley to outsiders is&#xA; productivity culture . Whereas most people in most places live in complete&#xA;satisfaction doing their job as they would, Silicon Valley people won&rsquo;t find&#xA;peace without optimizing their every habit and system to extract that extra iota&#xA;of productivity per unit time. I am one of those people, and this article…

Hammerspoon Wizardry on macOS

If you&rsquo;re a nerd, and you&rsquo;ve been around Macs for a while, you might remember&#xA;Applescript. It was a language developed by Apple to allow&#xA;intermediate–to–advanced users to write simple scripts that could control Mac&#xA;applications. It was actually created to resemble the English language, so&#xA;accessing a pixel would be written as &#xA; pixel 7 of row 3 of TIFF image 'my…

Not–so–casual Performance Optimization in Python

My previous post (which was honestly created to test out the&#xA;theme for this site), provided a few code snippets that computed &#xA; N terms of&#xA;the sum of inverse squares. I wrote the code in my 4 favorite languages—Python,&#xA;C, Rust, and Haskell—but when I ran the Python code, it was embarrassingly slow.&#xA;Compared to the &#xA; ≈ 950 ms it took sequential Rust, Python took…

The Basel Problem (Hello, World!)

Hello, World! This is my first post, and it&rsquo;s exclusively used to test out this&#xA;website&rsquo;s functionality. &#xA; Here are some code snippets in various languages that compute the&#xA; Basel Problem :

Author

I&rsquo;m a Master&rsquo;s student at UCSD working on reinforcement learning for Large&#xA;Language Models, advised by Prof. Xiaolong Wang . &#xA; I got started with programming through open source &#xA;in high school. Since then I&rsquo;ve interned at Anduril, Stanford AI Lab, Keysight,&#xA;SDSC, and Yahoo. &#xA; When I&rsquo;m not programming, I&rsquo;m brewing specialty coffee, lifting weights,…

Books

My digital bookshelf, in no particular order.

Curriculum Vitae