Blog posts

2026

Constraining LLMs for Perfect Monospace Text Formatting

Typesetting is notoriously hard to do well. This is especially true when typesetting fully justified text, i.e., text that is aligned to both the left and right margins of a column. It’s all too easy to end up with large spaces between words, giving an ugly appearance, for example:

2025

Crinkled Arcs And Brownian Motion

A crinkled arc is a continuous curve that appears as if it is making right-angle turns at every point along its trajectory. Additionally, if you draw a straight line between two recent points and compare that line to a line drawn between any two points in its more distant past, you will find that these two lines are also perpendicular.

Faster Siamese Network Training and Inference

In this post, I look at a couple of ways you can dramatically speed up training of Siamese neural networks. These are two relatively simple tricks that I’ve not seen anywhere else which, when combined, can give a ~2.5x speed-up when training Siamese networks on GPU in PyTorch.

2023

Visualising the Legendre Transform

The Legendre transform is incredibly useful in a wide range of areas including physics, economics, statistics and machine learning. However, its definition can be somewhat opaque. In this post, we look at how we might gain intuition for how the definition works by constructing it from scratch in a visual way.