---
abstract: large language models will probably be the most important piece of technology in the 21st century
date: '2024-02-07'
description: a mathematical framework for intelligence
id: LLMs
layout: technical
modified: 2026-10-22 11:36:15 GMT-04:00
seealso:
  - '[[thoughts/mechanistic interpretability]]'
  - '[[thoughts/Alignment|Alignment]]'
slides: true
tags:
  - ml
  - llm
  - philosophy
  - technical
  - evergreen
title: LLMs
created: '2024-02-07'
published: '2024-02-07'
pageLayout: technical
slug: thoughts/LLMs
permalink: https://aarnphm.xyz/thoughts/LLMs.md
generator:
  quartz: v4.6.0
  hostedProvider: Cloudflare
  baseUrl: aarnphm.xyz
full: https://aarnphm.xyz/llms-full.txt
---
Large language models builds on top of [[thoughts/Autoregressive models|autoregressive]] [[thoughts/Transformers|transformers]] to predict the [[thoughts/Autoregressive models#next token prediction|next token]].

This is often because these models are trained to “hillclimb” this specific objective, and with the recent advancement in [[thoughts/Reinforcement learning|RL]] we’ve basically achieved _pseudo-intellectualism_

There are also a whole genre of language model built on top of diffusion blocks, where it learns to reconstruct masked tokens, then generates text through repeated {{sidenotes[unmasking]: diffusion is an alternate approach to AR, but if anything it lacks the coherency formed via [[thoughts/mechanistic interpretability#superposition hypothesis|superposition]] to those of AR models (_i suspect_)}} \[@nie2025largelanguagediffusionmodels\].

[[thoughts/Speculative decoding|Speculative decoding]] techniques such as DFlash uses a lightweight block-diffusion draft model to produce a block of draft tokens in one forward pass for an autoregressive target model to verify \[@chen2026dflashblockdiffusionflash\].

> \[!note\]- GPTs and friends
>
> Most variants of LLMs are decoder-only \[@radford2019language\]. There are bi-directional encoder-decoder models, though their application are more domain-specific, whereas decoder-only models generalized a lot better, per recent history.

Have “capabilities” to understand [[thoughts/NLP|natural language]].

Exhibits [[thoughts/emergent behaviour]] of [[thoughts/intelligence|intelligence]]. ^emergent

One way or another is a form of [[thoughts/Behaviourism|behaviourism]], through [[thoughts/Machine learning|reinforcement learning]]. It is being “told” what is good or bad, and thus act accordingly towards the users. However, this induces [[thoughts/confirmation bias]] where one aligns and contains his/her prejudices towards the problem.

### Scalability

Incredibly hard to scale, mainly due to their [[thoughts/large models|large]] memory footprint and tokens memory allocation.

### [[thoughts/optimization|Optimization]]

- [[thoughts/quantization|Quantization]]: reduce computational and memory costs of running inference with representing the weight and activations with low-precision data type
- [[thoughts/Continuous batching]]: update the batch after each decoding step so finished requests leave and waiting requests can join. [Orca](https://www.usenix.org/conference/osdi22/presentation/yu) introduced iteration-level scheduling. [[thoughts/paged attention|PagedAttention]] manages KV-cache memory in blocks; it can support this scheduling by reducing wasted memory.
- Different [[thoughts/Attention|Attention]] variants, for better kernels and hardware optimisation (Think of [[thoughts/flash attention|Flash Attention 3]], [[thoughts/radix attention|Radix Attention]], [[thoughts/tree attention|TreeAttention]], etc.)
- [[thoughts/Transformers#Byte-Latent Transformer]]: group bytes into variable-length patches using next-byte prediction entropy. The large transformer processes patches, while a smaller decoder generates bytes autoregressively. [^blt]

[^blt]: A small byte-level model estimates how uncertain the next byte is. High uncertainty starts a new patch; predictable byte sequences can share longer patches, reducing the number of steps run by the large transformer. Entropy determines patch boundaries. Byte generation still uses the decoder’s next-byte predictions. See [2412.09871](https://arxiv.org/html/2412.09871v1) \[@pagnoni2024bytelatenttransformerpatches\] .

### on how we are being [[thoughts/education#teaching|taught]].

> \[!question\] How would we assess thinking?
>
> Similar to calculator, it _simplifies_ and increase accessibility to the masses, but in doing so _lost_ the value in the _action of doing_ math.
>
> We do math to internalise the concept, and practice to thinking coherently. Similarly, we [[thoughts/writing|write]] to help crystalised our ideas, and in the process improve through the act of putting it down.

The process of rephrasing and arranging sentences poses a challenges for the writer, and in doing so, teach you how to think coherently. Writing essays is an exercise for students to articulate their thoughts, rather than testing the understanding of the materials.

### on [[thoughts/ethics|ethics]]

There are ethical concerns with the act of “hallucinating” content, therefore alignment research is crucial to ensure that the model is not producing harmful content.

For [[thoughts/university/twenty-four-twenty-five/engineer-4a03/finals|medicare]], ethical implications requires us to develop better [[thoughts/mechanistic interpretability|interpretable models]]

### as philosophical tool.

To create a better [[thoughts/representations|representations]] of the world for both humans and machines to understand, we can truly have assistive tools to enhance our understanding of the world surround us

### AI generated content

Don’t shit where you eat, **[[thoughts/Garbage in Garbage out|Garbage in, garbage out]]**. The quality of the content is highly dependent on the quality of the data it was trained on, or model are incredibly sensitive to data variances and biases.

Bland doublespeak

See also: [All the better to see you with](https://www.kernelmag.io/2/all-the-better-to-see-you)

<article class="twitter-post" data-twitter-source="https://twitter.com/paulg/status/1761801995302662175"><span class="twitter-post-badge" role="img" aria-label="Twitter post" title="Twitter post"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="64 64 896 896" fill="currentColor" stroke="none" stroke-width="0" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M928 254.3c-30.6 13.2-63.9 22.7-98.2 26.4a170.1 170.1 0 0075-94 336.64 336.64 0 01-108.2 41.2A170.1 170.1 0 00672 174c-94.5 0-170.5 76.6-170.5 170.6 0 13.2 1.6 26.4 4.2 39.1-141.5-7.4-267.7-75-351.6-178.5a169.32 169.32 0 00-23.2 86.1c0 59.2 30.1 111.4 76 142.1a172 172 0 01-77.1-21.7v2.1c0 82.9 58.6 151.6 136.7 167.4a180.6 180.6 0 01-44.9 5.8c-11.1 0-21.6-1.1-32.2-2.6C211 652 273.9 701.1 348.8 702.7c-58.6 45.9-132 72.9-211.7 72.9-14.3 0-27.5-.5-41.2-2.1C171.5 822 261.2 850 357.8 850 671.4 850 843 590.2 843 364.7c0-7.4 0-14.8-.5-22.2 33.2-24.3 62.3-54.4 85.5-88.2z"></path></svg></span><header class="twitter-post-header"><span class="twitter-post-author">@paulg</span><time datetime="2024-02-25">2024-02-25</time><a class="twitter-post-source" href="https://twitter.com/paulg/status/1761801995302662175" target="_blank" rel="noopener noreferrer" aria-label="Open original post (opens in a new tab)" title="Open original post" data-skip-icons="true"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M7 17 17 7M7 7h10v10"></path></svg></a></header><div class="twitter-post-body">
			
				
					<p>Here's a real problem though. Most people find writing hard and will get AIs to do it for them whenever they can get away with it. Which means bland doublespeak will become the default style of writing. Ugh.</p>
				
			
			
		</div></article>

### machine-assisted [[thoughts/writing]]

source: [creative fiction with GPT-3](https://gwern.net/gpt-3)

Idea: use [[thoughts/mechanistic interpretability#sparse autoencoders]] to guide ideas generations

The idea from [writing for LLMs](https://gwern.net/llm-writing) means once your writing/thoughts were embedded within the models’ [[thoughts/latent space]]

### Good-enough

<article class="twitter-post" data-twitter-source="https://twitter.com/jachiam0/status/1598448668537155586"><span class="twitter-post-badge" role="img" aria-label="Twitter post" title="Twitter post"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="64 64 896 896" fill="currentColor" stroke="none" stroke-width="0" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M928 254.3c-30.6 13.2-63.9 22.7-98.2 26.4a170.1 170.1 0 0075-94 336.64 336.64 0 01-108.2 41.2A170.1 170.1 0 00672 174c-94.5 0-170.5 76.6-170.5 170.6 0 13.2 1.6 26.4 4.2 39.1-141.5-7.4-267.7-75-351.6-178.5a169.32 169.32 0 00-23.2 86.1c0 59.2 30.1 111.4 76 142.1a172 172 0 01-77.1-21.7v2.1c0 82.9 58.6 151.6 136.7 167.4a180.6 180.6 0 01-44.9 5.8c-11.1 0-21.6-1.1-32.2-2.6C211 652 273.9 701.1 348.8 702.7c-58.6 45.9-132 72.9-211.7 72.9-14.3 0-27.5-.5-41.2-2.1C171.5 822 261.2 850 357.8 850 671.4 850 843 590.2 843 364.7c0-7.4 0-14.8-.5-22.2 33.2-24.3 62.3-54.4 85.5-88.2z"></path></svg></span><header class="twitter-post-header"><span class="twitter-post-author">@jachiam0</span><time datetime="2022-12-01">2022-12-01</time><a class="twitter-post-source" href="https://twitter.com/jachiam0/status/1598448668537155586" target="_blank" rel="noopener noreferrer" aria-label="Open original post (opens in a new tab)" title="Open original post" data-skip-icons="true"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M7 17 17 7M7 7h10v10"></path></svg></a></header><div class="twitter-post-body">
			
				
					<p>"How did we get AI art before self-driving cars?" IMHO this is the single best heuristic for predicting the speed at which certain AI advances will happen. https://t.co/yAo6pwEsxD</p>
<img src="https://pbs.twimg.com/media/Fi7UTNpUoAAPndO.jpg?name=orig" alt="" loading="lazy" decoding="async">
				
			
			
		</div></article>

This only occurs if you only need a “good-enough” item where value outweighs the process.

However, one should always consider to put in the work, rather than being “ok” with good enough. In the process of working through a problem, one will learn about bottleneck and problems to be solved, which in turn gain invaluable experience otherwise would not achieved if one fully relies on the interaction with the models alone.

### as [[thoughts/Search|search]]

These models are incredibly useful for summarization and information gathering. With the [[thoughts/taxonomy]] of [[thoughts/RAG]] or any other CoT tooling, you can pretty much augment and produce and improve search-efficiency bu quite a lot.

notable mentions:

- [perplexity.ai](https://perplexity.ai/): [[thoughts/RAG|RAG]]-first search engine
- [explorer.globe.engineer](https://explorer.globe.engineer/): tree-based [[thoughts/information retrieval]]
- [Exa labs](https://twitter.com/ExaAiLabs)

### Programming

Overall should be a net positive, but it’s a double-edged sword.

#### as end-users

[Source](https://www.geoffreylitt.com/2023/03/25/llm-end-user-programming.html)

> I think it’s likely that soon all computer users will have the ability to develop small software tools from scratch, and to describe modifications they’d like made to software they’re already using

#### as developers

Tool that lower of barrier of entry is always a good thing, but it often will lead to probably even higher discrepancies in quality of software

Increased in productivity, but also increased in technical debt, as these generated code are mostly “bad” code, and often we have to nudge and do a lot of **[[thoughts/prompt engineering|prompt engineering]]**.

### Truthfulness

Preference data to train against dense (model)

Judges <span>&rarr;</span> evaluator models

Dense models <span>&larr;</span> (reasoning)

UX <span>&rarr;</span> how to get in front of users?

Data provenance and governance ?

<article class="twitter-post" data-twitter-source="https://x.com/leonardtang_/status/1927396709870489634"><span class="twitter-post-badge" role="img" aria-label="Twitter post" title="Twitter post"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="64 64 896 896" fill="currentColor" stroke="none" stroke-width="0" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M928 254.3c-30.6 13.2-63.9 22.7-98.2 26.4a170.1 170.1 0 0075-94 336.64 336.64 0 01-108.2 41.2A170.1 170.1 0 00672 174c-94.5 0-170.5 76.6-170.5 170.6 0 13.2 1.6 26.4 4.2 39.1-141.5-7.4-267.7-75-351.6-178.5a169.32 169.32 0 00-23.2 86.1c0 59.2 30.1 111.4 76 142.1a172 172 0 01-77.1-21.7v2.1c0 82.9 58.6 151.6 136.7 167.4a180.6 180.6 0 01-44.9 5.8c-11.1 0-21.6-1.1-32.2-2.6C211 652 273.9 701.1 348.8 702.7c-58.6 45.9-132 72.9-211.7 72.9-14.3 0-27.5-.5-41.2-2.1C171.5 822 261.2 850 357.8 850 671.4 850 843 590.2 843 364.7c0-7.4 0-14.8-.5-22.2 33.2-24.3 62.3-54.4 85.5-88.2z"></path></svg></span><header class="twitter-post-header"><span class="twitter-post-author">@leonardtang_</span><time datetime="2025-05-27">2025-05-27</time><a class="twitter-post-source" href="https://x.com/leonardtang_/status/1927396709870489634" target="_blank" rel="noopener noreferrer" aria-label="Open original post (opens in a new tab)" title="Open original post" data-skip-icons="true"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M7 17 17 7M7 7h10v10"></path></svg></a></header><div class="twitter-post-body">
			
				
					<p>You don’t need frontier lab resources for frontier lab automated LLM evaluation.</p>
<p>To prove this, we’re open-sourcing j1-nano and j1-micro: two absurdly tiny (600M &#x26; 1.7B parameters) but mighty reward models competitive with orders-of-magnitude larger peers.</p>
<p>j1-nano and j1-micro were trained in &#x3C;1 day on a single A100 GPU.</p>
<img src="https://pbs.twimg.com/media/Gr97BmiWEAAeMzq.jpg?name=orig" alt="" loading="lazy" decoding="async">
				
			
			
		</div></article>

_outperform opus and gpt-4o_

