Post2 min read

Hello, AokanaLab

Why this site exists, what will show up here, and a tour of what a post can contain, including a demo you can play with.

AokanaLab is my lab notebook, kept in public. I learn something most days. Usually it ends up scattered across scratch files and half-finished repos. From now on it goes here.

You’ll find three kinds of things on this site:

  • Posts: longer write-ups of a project or an idea, with the numbers and the dead ends.
  • Notes: short “today I learned” entries. They’re small and unpolished, and they keep the habit going.
  • Lab: proof-of-concepts you can try in your browser, not just read about.

What a post can hold

This first post is also a test page, so here’s the inventory.

Text, code and math

Code is highlighted at build time, so your browser doesn’t have to:

import numpy as np

def softmax(logits, temperature=1.0):
    z = np.asarray(logits) / temperature
    z -= z.max()               # numerical stability
    p = np.exp(z)
    return p / p.sum()

Math is typeset at build time too. The function above is

and as it collapses onto the single most likely token. As grows, it flattens toward uniform.

Images

Images sit in the same folder as the post and are resized and compressed automatically:

Diagram: write a post, git push, Cloudflare builds it, and it goes live on the CDN

Things you can try

This is the part I care most about. A post can embed a live component. Below is a toy language model’s next-token distribution. Drag the sliders and watch what temperature and top-p do to it, then sample a few completions.

temperature-playgroundinteractive
  • mat47.1%
  • floor23.4%
  • sofa14.2%
  • windowsill7.8%
  • keyboard4.3%
  • roof2.6%
  • moon0.5%
  • spreadsheet0.2%
Logits are made up for illustration; the maths is the real thing.

A few things worth noticing:

  1. At temperature ≈ 0.1, “mat” wins almost every time. That’s close to greedy decoding.
  2. At temperature ≈ 2, “spreadsheet” starts to show up. That’s why high temperatures go weird.
  3. Top-p doesn’t reshape the distribution. It cuts the tail and renormalises what’s left, so lowering it removes options instead of flattening them.

The same demo has its own page in the Lab.

Comments

There’s a comment box at the bottom of every post and demo. It runs on GitHub Discussions, so you sign in with GitHub. Questions, corrections and “this broke on my phone” reports are all welcome.

中文?

Most things here will be in English. Some posts will also have a Chinese version. When one does, a “阅读中文版” link appears at the top, like the one on this post.