# The Hidden Life of Embeddings

Linus Lee, Notion

AI Engineer Summit 2023

[Talk page](https://ai.engineer/talks/YvobVu1l7GI-hidden-life-embeddings) · [Video](https://www.youtube.com/watch?v=YvobVu1l7GI)

## The Hidden Life of Embeddings

Embedding vectors can become an interface for editing text and images: reconstruct an input, move its representation, and inspect what changes when it is decoded.

Familiarity with text embeddings and basic vector operations is helpful; no model-training experience is required.

### Getting closer to the controls

[0:32](https://www.youtube.com/watch?v=YvobVu1l7GI&t=32s)

How can a reading or writing interface give people more control over a language model? Linus Lee’s experiments began with language models and traditional retrieval methods such as TF-IDF and BM25, before he joined Notion to work on AI. By the recording, Notion’s features included database AI autofill and translation, and its hiring spanned agents, tool use, evaluations, data, training, and interfaces. The product’s November 2022 [announcement](https://www.notion.com/blog/introducing-notion-ai) opened a private alpha; [availability for everyone](https://www.notion.com/blog/notion-ai-is-here-for-everyone) followed in February 2023.

Prompting, Lee suggests, feels like steering a car from the backseat with a pool noodle. There is a connection between your action and the vehicle’s motion, but control passes through several layers of indirection. This is especially frustrating with smaller, efficient models intended for production. Better instruction following helps, yet the interface still requires translating an intended change into words and hoping the model interprets them correctly. Looking inside the model offers a possible route to more direct control.

![Cartoon llama wearing sunglasses sits in a turquoise convertible with long rods extending from the car.](https://ai.engineer/api/talk-essay-media/a3fc606d9c5aa7454cea421291747377e406ca18d41a0a8ee4c68aa662ab756a)

A llama in a turquoise car illustrates the talk’s steering metaphor.

A text embedding might contain 1,536 or 1,024 numbers: coordinates in a high-dimensional **latent space**. Related spaces occur in intermediate activations, token embeddings, image models, and autoencoders. The demonstrations here focus on embedding models; extending the approach to those other representations remains a broader possibility.

Printing an embedding usually produces an unreadable wall of numbers. Yet those numbers encode features that help the model perform its task or reduce its loss. **If meaningful attributes can be separated within that representation, they can become things a person observes and manipulates.** A decoder supplies one way to read the representation back out; changing the vector before decoding supplies a way to intervene.

### From a sentence to a vector and back

[4:12](https://www.youtube.com/watch?v=YvobVu1l7GI&t=252s)

The first input describes Greg Egan’s novel *Diaspora*: post-human artificial intelligences, alien civilizations, and questions about reality and consciousness. Lee’s custom encoder turns that description into a 2,048-dimensional embedding. A decoder then attempts to reconstruct the input using the embedding. The resulting sentence differs from the original, but retains much of its content, including the book title. This makes the vector inspectable through the text it can produce.

Once both directions exist—text to embedding and embedding to text—the vector becomes an editable intermediate representation. Lee first increases a blur-radius control, sampling points around the original embedding and decoding them. The outputs remain related to the source but lose specific details: the correct title disappears, and the name Greg survives while referring to a different person. Nearby points produce a kind of semantic blur, rather than a dependable edit.

### Turning directions into editing controls

[5:45](https://www.youtube.com/watch?v=YvobVu1l7GI&t=345s)

A useful edit needs a meaningful direction. Lee selects a previously computed direction associated with shorter text, moves the *Diaspora* embedding along it, and decodes the result. The generated descriptions become shorter while retaining roughly the same topic. Moving farther along that direction shortens them again. The control changes a continuous representation before generation, rather than issuing another verbal instruction.

That operation supports a spatial writing canvas. Lee places the description on the canvas, generates several shorter versions, clones a preferred version, and then shifts the clone toward more negative sentiment. The interface preserves alternatives as objects that can be compared and branched. Length and sentiment become navigable directions through possible versions of a passage.

The same directions can also measure differences between texts. Lee compares the objective, Wikipedia-style description with a pessimistic rewrite produced by **ChatGPT**. The rewrite introduces a futile search for meaning and an abyss of nihilism. Embedding both passages and projecting each vector onto the feature directions reveals where the two descriptions differ.

| Projected attribute | Pessimistic rewrite relative to the original |
|---|---|
| Negative sentiment | Farther along the negative direction |
| Artistic topic | Roughly similar |
| Length | Roughly similar |
| Vocabulary elaborateness | Appears somewhat greater |

An isolated coordinate along the negative direction does not explain much by itself. The comparison is useful because the passages share a topic while differing in tone: their relative positions expose a distinction the model represents. These projections describe the model’s features, rather than establishing an external scale of pessimism or literary quality.

### Splicing two descriptions together

[8:30](https://www.youtube.com/watch?v=YvobVu1l7GI&t=510s)

Next, Lee embeds two different passages: the *Diaspora* description and the opening of a short story about a calm, old town on the Mediterranean coast. He constructs a new vector from the first part of one embedding and the last part of the other. Describing the vector approximately as 2,000-dimensional, he takes the first thousand or so coordinates from one input and the remaining coordinates from the other.

The coordinate operation can be expressed directly in Python. Given the two encoded passages, this function preserves the first half of the *Diaspora* vector and replaces its second half with coordinates from the coastal-town vector:

```python
import numpy as np


def splice_embeddings(
    diaspora: np.ndarray,
    coastal_town: np.ndarray,
) -> np.ndarray:
    if diaspora.ndim != 1 or diaspora.shape != coastal_town.shape:
        raise ValueError("Expected two vectors with the same shape")
    midpoint = diaspora.size // 2
    return np.concatenate((diaspora[:midpoint], coastal_town[midpoint:]))
```

The returned vector is the input to the decoder, not a combined text string. Lee calls the experiment latent-space interpolation; the specific operation demonstrated here is **coordinate splicing**, rather than a weighted average of complete vectors.

The decoded samples are readable mixtures rather than gibberish. They inherit aspects of topic, tone, punctuation, and structure from the inputs, including a quoted book title near the beginning. The result suggests that the representation tolerates this crude recombination well enough to produce recognizable features of both passages. It does not imply that one half of the vector exclusively stores one kind of information.

![Browser demo shows dimension and sample sliders above generated paragraphs beginning with quoted titles, including The Parasite and The Viceperia.](https://ai.engineer/api/talk-essay-media/b8dad63e1dbfa78fcb86306238f06bde1c2402bc30153b1436b4423558f996c9)

Generated text samples beneath the embedding-splice controls.

### Reading another model’s embeddings

[9:31](https://www.youtube.com/watch?v=YvobVu1l7GI&t=571s)

A decoder trained for one embedding space need not be limited to that encoder. Lee next sends the same description through OpenAI’s ada embedding model and uses a trained **linear adapter** to connect its output to his decoder. The historical model name is [**text-embedding-ada-002**](https://openai.com/index/new-and-improved-embedding-model/), abbreviated in the talk as `text-ada-002`. At decoding time, the reconstruction comes from the external embedding through the adapter, without access to the source text.

The reconstruction is less faithful than the earlier example, but it retains surprising details. *Diaspora* remains recognizable, as does the structure of a quoted book title. The output stays broadly within the same topic, including references to rogue AI. Lee reports that rerunning the generation sometimes produces an approximately correct author name as well. Proper nouns, punctuation, structure, and topic can therefore survive in the representation well enough for this adapted decoder to recover them; the demonstration supplies examples, not a measured recovery rate.

### From photograph to avatar, then from smiling to sad

[11:03](https://www.youtube.com/watch?v=YvobVu1l7GI&t=663s)

The image experiments use **CLIP** embeddings. Lee supplies a photograph of himself and his Notion cartoon avatar as endpoints; the interface also requires a duplicate photograph for an unspecified technical reason. After the backend warms up, it generates six images bridging the photographic and cartoon representations. The sequence is imperfect but progressively more cartoon-like, with a transition Lee finds surprisingly smooth.

Because CLIP represents both text and images, text can participate in the arithmetic. Lee subtracts the embedding of a photo of a smiling man and adds the embedding of a photo of a very sad, crying man. He reduces the contribution of those text vectors based on prior experimentation, then generates another six images. This time the visible result makes him look markedly sad. The change is specified through two contrasting examples, whose vector difference supplies the edit.

The next composition is less successful. Lee adds a beach photograph and requests four outputs to save time. Generation initially appears stuck, prompting a suspicion that the interface has a bug; when he returns to the result, he acknowledges that the beach did not survive the latent-space arithmetic. Adding a vector does not guarantee that its intended visual feature will appear in the decoded image.

Across these experiments, the manipulations consist of computing example embeddings, adding or subtracting vectors, and applying normalization. Those simple operations can alter meaningful properties without a separate editing procedure for every property. Lee also shows prepared examples combining style with subject and smoothly transitioning between landscape images. The successful transformations and the missing beach belong to the same picture: these spaces offer useful structure, but the decoder’s response still has to be observed.

### Making the invisible observable

[13:49](https://www.youtube.com/watch?v=YvobVu1l7GI&t=829s)

These prototypes make otherwise hidden representations available to human observation. A row of floating-point values offers little intuition on its own. Reconstructing it, moving it, and comparing the results creates a way to investigate what the model represents. Direct manipulation is useful here both as an interface and as an experimental method.

Lee connects this work to the [Othello world-model research](https://arxiv.org/abs/2210.13382) and [*Finding Neurons in a Haystack*](https://arxiv.org/abs/2305.01610). His own feature directions come from supplied examples and calculations involving their centroids. He contrasts that approach with then-recent work from Anthropic, Conjecture, and other labs seeking to discover feature directions without manually supplied examples. The prospect is representations that are interpretable and controllable in some useful sense—not a claim that every coordinate has an obvious human meaning.

### The encoder, bottleneck, decoder, and adapter

[15:16](https://www.youtube.com/watch?v=YvobVu1l7GI&t=916s)

The text system is a custom model fine-tuned from **T5** as a **denoising autoencoder**. Its modified encoder-decoder transformer pools encoder information into a single embedding. On the decoder side, a special gated layer draws information from that embedding to generate text. The vector is therefore a bottleneck through which the information needed for reconstruction must pass. Lee leaves the finer architectural modifications to the accompanying code.

| Training path | Representation supplied to the decoder |
|---|---|
| Text reconstruction | Custom encoder → pooled embedding |
| External embedding adaptation | Other embedding model → trained linear adapter |

In the normal path, the model learns to reconstruct text from its own encoder’s embedding. In the adapted path, the linear layer maps another model’s embedding into a representation the normal decoder can use. That adapter is the bridge behind the earlier OpenAI reconstruction experiment.

![Side-by-side diagram compares a Contra encoder feeding embeddings to the Contra decoder with a black-box embedding model feeding the decoder through a linear adapter layer.](https://ai.engineer/api/talk-essay-media/0c2260fc13101105557281364be0e8bcb66054dc7fb14ebf7cffed1f7ef65459)

A linear adapter connects another model’s embeddings to the Contra decoder.

Lee announces the demonstrated models on Hugging Face and points readers to a Colab notebook for interpolation and feature-interpretation experiments. The released [**Bottleneck T5** model family](https://huggingface.co/thesephist/contra-bottleneck-t5-large-wikipedia) provides the access point for this work. He invites people to share interesting results and ask questions as they explore the models.

The image-generation backend is Kakao Brain’s [**Karlo**](https://github.com/kakaobrain/karlo). Lee describes it as an **unCLIP** diffusion model, comparable in training approach to **DALL-E 2**. In the demonstrated workflow, manipulated CLIP representations condition image generation, giving the image experiments a counterpart to the text decoder: a way to make the altered latent representation visible.

### Representations people can work with

[16:52](https://www.youtube.com/watch?v=YvobVu1l7GI&t=1012s)

The design goal is to make an inscrutable representation feel small enough to fit in your hand: something you can inspect, play with, visualize, and manipulate. A shortening control, a branching canvas, or an image interpolation turns an abstract model operation into an experiment a person can follow. Those tools can deepen understanding of how models work and suggest ways to improve them.

Generative models become, in this sense, a laboratory for knowledge: a place to investigate how different modalities can be represented. Lee closes by invoking Bret Victor’s idea of a thinking medium that brings thought outside the head, into forms people can perceive and manipulate with their bodies. Building interfaces around what models actually represent could make that principle practical—giving people more humane ways to explore and work with knowledge.

## Resources

- [Bottleneck T5 model and usage examples](https://huggingface.co/thesephist/contra-bottleneck-t5-large-wikipedia) — Linus Lee's text autoencoder model card includes encoding and decoding examples, architecture details, checkpoint variants, and a link to interpolation experiments.
- [OpenAI's original ada-002 embedding announcement](https://openai.com/index/new-and-improved-embedding-model/) — Historical specifications for text-embedding-ada-002, including its 1,536-dimensional embeddings.
- [Kakao Brain Karlo](https://github.com/kakaobrain/karlo) — Official repository for the Karlo image-generation project used in Lee's image demonstrations.
- [Finding Neurons in a Haystack](https://arxiv.org/abs/2305.01610) — Studies how interpretable features appear in language-model activations using probes restricted to small groups of neurons.
- [Emergent World Representations](https://arxiv.org/abs/2210.13382) — Uses Othello move sequences to investigate learned board representations and interventions that change model predictions.

## Slides

### The Hidden Life of Embeddings

Linus introduces his talk on embeddings at the AI Engineer Summit in October 2023.

[0:22](https://www.youtube.com/watch?v=YvobVu1l7GI&t=22s) [Title slide for Linus Lee’s talk, The Hidden Life of Embeddings.](https://assets.ai.engineer/sites/aiecode2025/sha256/ebfe1fca30b57e7f7b3b69e8f21da87c75d5339b4b912b60687c45ce4b488628.webp)

The Hidden Life of Embeddings

Linus @ AI Engineer Summit — Oct ’23

AI Engineer SUMMIT

Presented by
[illegible]

### Linus Lee

Linus Lee works on AI at Notion. His earlier independent prototypes explored reading and writing interfaces, including work with embedding models and latent spaces.

[0:34](https://www.youtube.com/watch?v=YvobVu1l7GI&t=34s) [Linus Lee’s portrait and biography, listing Notion, independent prototyping, and Betaworks.](https://assets.ai.engineer/sites/aiecode2025/sha256/ef7e8652204eefb265bcd96a753ae6f2495dad4e5acfa6d762abcb6f6484e411.webp)

Linus Lee

Notion
AI.

Independent
Prototyping knowledge tools, language model interfaces, latent space-based interactions.

Betaworks
Researcher in Residence, Thinkcamp.

### Notion AI — We’re hiring!

Almost a year after Notion AI’s public beta, Lee highlights database AI Autofill and translation. Notion is hiring AI, product and machine learning engineers.

[0:50](https://www.youtube.com/watch?v=YvobVu1l7GI&t=50s) [Notion AI hiring slide with examples of its launch, AI Autofill, and translation.](https://assets.ai.engineer/sites/aiecode2025/sha256/99003d7dc2c328a502ac8ce526491632ac901f2f335613143d3b8206d05ec8d5.webp)

Notion AI — We’re hiring!

Published November 16, 2022 in Notion HQ
Introducing Notion AI
By Ivan Zhao
Co-founder & CEO

I’m writing to you from Notion’s San Francisco office, where we have a portrait of computer pioneer Doug Engelbart. In 1962, he wrote about his vision for computers in his paper “Augmenting Human Intellect: A Conceptual Framework” — they could be machines that had the power to help us solve problems, instead of being room-sized calculators and typewriters.

Notion @NotionHQ
The next chapter of Notion AI is here.
Introducing: AI Autofill!

Notion @NotionHQ
New! Translation property 🗺️
Working with global teammates or clients? Make your project and meeting note summaries multilingual.

Status | Summary AI | Summary (JP) AI
In Progress
This document outlines a website redesign project that is currently in progress, owned by Zoe Ludwig and with a high priority. The document includes no specific details about the project tasks or goals.
[illegible]
AI is writing...
In Progress
Acme’s mobile app is facing a challenge of not having enough reviews on the iOS App Store, which affects its [cut off]
[illegible]

Interface text:
Sprints
All | Timeline
Sprint name | Status | Summary | Dates | Progress
Sprint 1 | Current
Sprint 2 | Next
[illegible]
GIF | ALT
11:53 AM · Jun 6, 2023 · 264K Views
GIF | ALT
12:25 PM · Sep 20, 2023 · 130.2K Views

### A latent space joke

A joke about Linus visiting latent space opens his discussion of steering language models.

[1:31](https://www.youtube.com/watch?v=YvobVu1l7GI&t=91s) [A social media post jokes about Linus being in latent space, followed by a request to use it in the talk.](https://assets.ai.engineer/sites/aiecode2025/sha256/8470791883d6ebaf6e47f780d93c9ac2674be0999827196d82ee3ac8004bd020.webp)

-webkat-huang
@katmhuang

linus be like: hey i'm at the latent space do you guys need anything

12:20 AM · Sep 29, 2023 · 2,707 Views

Linus @thesephist · Sep 29
Can I use this in my talk slides

-webkat-huang @katmhuang · Sep 29
yes son

Interface text:
1 · 9 · 1
Post your reply
Reply
1 · 1 · 239
AIE
SUMMIT
FIXIE
supabase

[1:36](https://www.youtube.com/watch?v=YvobVu1l7GI&t=96s) [A post jokes about Linus being in latent space; replies ask for and grant permission to use it in slides.](https://assets.ai.engineer/sites/aiecode2025/sha256/c64963ac039552fec178aae1d02a5eda15c2b9d2e50a0bf5757bc4e146f76ad9.webp)

-webkat-huang
@katmhuang

linus be like: hey i'm at the latent space do you guys need anything

12:20 AM · Sep 29, 2023 · 2,707 Views

Linus @thesephist · Sep 29
Can I use this in my talk slides

-webkat-huang @katmhuang · Sep 29
yes son

Interface text:
1 · 9 · 1
Post your reply
Reply
1 · 1 · 239

### Steering from the back seat

Linus compares prompting a language model to steering a car from the back seat with a pool noodle: you have some influence, but control is indirect.

[1:52](https://www.youtube.com/watch?v=YvobVu1l7GI&t=112s) [A projected cartoon shows a llama riding in a turquoise convertible with a long red rod across the car.](https://assets.ai.engineer/sites/aiecode2025/sha256/f4a7df8f766acc14cd44f78b5c4e860715a9f3a791ebdd1eac745acb1260cb6a.webp)

### Where latent spaces arise

Latent spaces appear in embedding models, intermediate activations and autoencoders. The talk focuses on embedding models, where a text embedding is a vector in a high-dimensional space.

[2:28](https://www.youtube.com/watch?v=YvobVu1l7GI&t=148s) [Latent spaces arise in embedding models, intermediate model activations, and autoencoders.](https://assets.ai.engineer/sites/aiecode2025/sha256/972bb40f90d091af7abe5c4ef31729f0279ae7acef8a3437b49eee8df2bdf0f3.webp)

Latent spaces arise in...

• Fixed-size embedding spaces of embedding models
• Intermediate activations of models
• Autoencoders

### Embeddings as numbers

A green, Matrix-like screen illustrates how printing an embedding can look like rows of numbers, even though those numbers can contain a lot of information.

[3:04](https://www.youtube.com/watch?v=YvobVu1l7GI&t=184s) [A green computer monitor displays rows of glowing characters.](https://assets.ai.engineer/sites/aiecode2025/sha256/39c7473d7ea9909fde711031ba7d455661f56eae85e67c45865b8f2f62a2f2d2.webp)

[illegible]

Interface text:
AIE
SUMMIT
AUTOgpt
smol ai

### Latent spaces and expressive interfaces

Embeddings may capture salient features of text or images. The speaker proposes disentangling those features to build interfaces that intervene inside a generative model.

[3:15](https://www.youtube.com/watch?v=YvobVu1l7GI&t=195s) [Slide states that latent spaces represent salient training-domain features and suggests disentangling features to build more expressive interfaces.](https://assets.ai.engineer/sites/aiecode2025/sha256/7bedde0ee7a1b5d1d499e90d7ea6c4aebb13207c6dd4cf5938acf602cec90def.webp)

Latent spaces represent the most salient features of the training domain.

If we can disentangle meaningful features in latent space of a generative model, maybe we can build more expressive interfaces.

Interface text:
AIE
UMMIT
AUTOgpt

### What embeddings show

The speaker proposes reading features from embeddings to better understand what a model sees in an input.

[3:43](https://www.youtube.com/watch?v=YvobVu1l7GI&t=223s) [Slide says embeddings show what a model sees in a sample and asks whether we can read out what it sees.](https://assets.ai.engineer/sites/aiecode2025/sha256/72ced4b49736aea4959c08e73a9ce777d4e332d40b59118e49d648e03203ba7a.webp)

Embeddings show us what the model "sees" in a sample.

Can we read out what it sees?

AIE
SUMMIT
AUTO[illegible]

[3:50](https://www.youtube.com/watch?v=YvobVu1l7GI&t=230s) [Slide says embeddings show what a model sees in a sample and asks whether we can read out what it sees.](https://assets.ai.engineer/sites/aiecode2025/sha256/9a7ee417191423bad2575c018f1ab006f3b25a6ee5ae18d8e304de73d0066218.webp)

Embeddings show us what the model "sees" in a sample.

Can we read out what it sees?

AIE
SUMMIT
AUTOgpt
smol ai

### Controlling model output

The speaker asks whether controlling intermediate embedding activations could change what the model generates.

[3:53](https://www.youtube.com/watch?v=YvobVu1l7GI&t=233s) [Slide says embeddings show what a model sees in a sample and asks whether we can control what it creates.](https://assets.ai.engineer/sites/aiecode2025/sha256/93031848015fdd7ae754effa66c3bb1f8f198a2b15813c13fd8761f73777ecdc.webp)

Embeddings show us what the model "sees" in a sample.

Can we control what it creates?

AIE
SUMMIT
AUTOgpt
smol ai

### Embedding demo: input

Protopolis starts with a passage about Diaspora. The speaker prepares to press Enter to generate an embedding; the latent and reconstruction fields still show placeholders.

[4:19](https://www.youtube.com/watch?v=YvobVu1l7GI&t=259s) [Protopolis demo shows a passage about a science fiction novel, empty latent and reconstruction fields, and a neighbors radius slider.](https://assets.ai.engineer/sites/aiecode2025/sha256/303d1995c81d4b118639e141b9b55dfae2f0b78ffce54d477535b9f76a23dc30.webp)

Protopolis
Base

Original text
"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human artificial intelligences known as polises. The story follows these digital entities as they embark on a journey of self-discovery, exploring the vastness of space, encountering alien civilizations, and questioning the nature of reality and consciousness.

Latent
...

Reconstruction
...

Neighbors
Radius 1.000

Interface text:
Chrome File Edit View History Bookmarks Profiles Tab Window Help
Mon Oct 9 18:45
Protopolis
Varna
[illegible]
127.0.0.1:5000
Guest

### Text embedding and reconstruction

Protopolis encodes a passage into a 2,048-number embedding, then decodes it back into text. The reconstruction retains the book title but changes details, including “polises” to “polites.”

[4:47](https://www.youtube.com/watch?v=YvobVu1l7GI&t=287s) [Protopolis demo shows the original passage, a numerical latent vector, and the beginning of a reconstructed passage.](https://assets.ai.engineer/sites/aiecode2025/sha256/6e065d8201dbbf55423ee2fecae40b43961f9cb56a7725ef9fc08b316b168976.webp)

Protopolis
Base

Original text

"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human artificial intelligences known as polises. The story follows these digital entities as they embark on a journey of self-discovery, exploring the vastness of space, encountering alien civilizations, and questioning the nature of reality and consciousness.

Latent

-0.005, 0.0722, 0.0002, -0.0455, 0.0823, -0.0258, -0.0421, 0.0285, -0.0146, -0.0653, 0.0477, -0.0743,
-0.031, -0.039, 0.0024, 0.0006, 0.033, -0.0074, -0.0533, -0.0199, -0.0467, 0.0479, 0.0139, -0.061,
-0.0219, 0.0028, -0.0246, -0.0371, 0.0413, 0.0102, -0.0188, 0.0818, 0.0021, -0.0506, -0.0273, 0.0607,
0.0164, -0.0137, -0.0808, -0.0358, -0.0065, -0.0041, 0.0576, 0.0143, 0.0132, -0.0004, 0.0728, 0.0551,
-0.0522, -0.0568, -0.029, 0.0519, 0.1097, -0.0163, -0.0281, 0.0422, 0.0464, -0.0014, -0.0112, -0.0082,
-0.0148, -0.0361, -0.028, 0.0085, -0.0334, 0.0116, -0.0718, -0.0245, -0.0351, -0.1213, -0.0075, 0.0762,
0.037, 0.5175, -0.0325, 0.0128, 0.0299, 0.038, 0.0263, -0.0045, -0.0128, 0.0338, -0.0395, 0.0177,
0.0144, 0.0545, 0.0075, -0.0157, -0.0201, 0.0184, 0.0066, 0.0156, -0.0234, -0.0389, 0.0071, -0.0179,
0.0145, -0.0193, 0.0239, -0.0001, 0.0501, 0.016, -0.0794, 0.0537, -0.0038, 0.0086, -0.0512, 0.0417,
-0.0038, 0.0678, -0.0243, -0.0784, 0.0243, -0.0359, 0.0292, 0.0122, -0.0044, -0.0494, 0.0739, 0.0002,
0.0447, 0.0143, -0.0271, -0.0308, 0.0434, 0.0003, 0.004, 0.0511, 0.0064, -0.0125, 0.0323, -0.07,
-0.0401, 0.0005, 0.0101, -0.0479, -0.0077, 0.0386, -0.0241, 0.0225, 0.0067, -0.0369, 0.039, 0.0225,
-0.0318, -0.0055, -0.0123, -0.0198, -0.0136, -0.0281, -0.0124, -0.0213, -0.0142, -0.0286, -0.034,
0.0106, -0.0457, -0.0147, -0.0019, 0.0559, 0.0392, 0.0026, -0.0125, -0.0195, -0.0249, 0.0074, -0.0403,
0.0345, 0.0301, -0.0296]

Reconstruction

"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human intelligent artificial beings known as polites. The story follows these digital entities as they embark on a journey of self-discovery, exploring vast alien universes, encountering the mysteries of existence, and questioning the nature of reality

Interface text:
Chrome  File  Edit  View  History  Bookmarks  Profiles  Tab  Window  Help
Protopolis  Varna  [illegible]
127.0.0.1:5000
Guest
Mon Oct 9 18:45

[4:53](https://www.youtube.com/watch?v=YvobVu1l7GI&t=293s) [Protopolis displays a passage, its latent vector, and a reconstructed passage.](https://assets.ai.engineer/sites/aiecode2025/sha256/0c0ed9e11ab216b47eb9917ea8fe7f22f85d78a684da99f76bf40c1ca15372c8.webp)

"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human artificial intelligences known as polises. The story follows these digital entities as they embark on a journey of self-discovery, exploring the vastness of space, encountering alien civilizations, and questioning the nature of reality and consciousness.

Latent

-0.005, 0.0722, 0.0002, -0.0455, 0.0823, -0.0258, -0.0421, 0.0285, -0.0146, -0.0653, 0.0477, -0.0743,
-0.031, -0.039, 0.0024, 0.0006, 0.033, -0.0074, -0.0533, -0.0199, -0.0467, 0.0479, 0.0139, -0.061,
-0.0219, 0.0028, -0.0246, -0.0371, 0.0413, 0.0102, -0.0188, 0.0818, 0.0021, -0.0506, -0.0273, 0.0607,
0.0164, -0.0137, -0.0808, -0.0358, -0.0065, -0.0041, 0.0576, 0.0143, 0.0132, -0.0004, 0.0728, 0.0551,
-0.0522, -0.0568, -0.029, 0.0519, 0.1097, -0.0163, -0.0281, 0.0422, 0.0464, -0.0014, -0.0112, -0.0082,
-0.0148, -0.0361, -0.028, 0.0085, -0.0334, 0.0116, -0.0718, -0.0245, -0.0351, -0.1213, -0.0075, 0.0762,
0.037, 0.5175, -0.0325, 0.0128, 0.0299, 0.038, 0.0263, -0.0045, -0.0128, 0.0338, -0.0395, 0.0177,
0.0144, 0.0545, 0.0075, -0.0157, -0.0201, 0.0184, 0.0066, 0.0156, -0.0234, -0.0389, 0.0071, -0.0179,
0.0145, -0.0193, 0.0239, -0.0001, 0.0501, 0.016, -0.0794, 0.0537, -0.0038, 0.0086, -0.0512, 0.0417,
-0.0038, 0.0678, -0.0243, -0.0784, 0.0243, -0.0359, 0.0292, 0.0122, -0.0044, -0.0494, 0.0739, 0.0002,
0.0447, 0.0143, -0.0271, -0.0308, 0.0434, 0.0003, 0.004, 0.0511, 0.0064, -0.0125, 0.0323, -0.07,
-0.0401, 0.0005, 0.0101, -0.0479, -0.0077, 0.0386, -0.0241, 0.0225, 0.0067, -0.0369, 0.039, 0.0225,
-0.0318, -0.0055, -0.0123, -0.0198, -0.0136, -0.0281, -0.0124, -0.0213, -0.0142, -0.0286, -0.034,
0.0106, -0.0457, -0.0147, -0.0019, 0.0559, 0.0392, 0.0026, -0.0125, -0.0195, -0.0249, 0.0074, -0.0403,
0.0345, 0.0301, -0.0296]

Reconstruction

"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human intelligent artificial beings known as polites. The story follows these digital entities as they embark on a journey of self-discovery, exploring vast alien universes, encountering the mysteries of existence, and questioning the nature of reality and consciousness.

Neighbors

Interface text:
Chrome  File  Edit  View  History  Bookmarks  Profiles  Tab  Window  Help
Protopolis  Varna  [illegible]
127.0.0.1:5000
Guest
Mon Oct 9 18:46

### Sampling neighboring embeddings

Sampling around the embedding at radius 1.000 produces related passages with altered details: one changes the title and author, while another leaves the title empty.

[5:38](https://www.youtube.com/watch?v=YvobVu1l7GI&t=338s) [The reconstruction appears above a radius control and three neighboring text samples.](https://assets.ai.engineer/sites/aiecode2025/sha256/e1cc7fe6f561b5fdce4527904cdf9853f3acb48e8447fb7d117e1a3bdb0ba40c.webp)

Reconstruction

"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human intelligent artificial beings known as polites. The story follows these digital entities as they embark on a journey of self-discovery, exploring vast alien universes, encountering the mysteries of existence, and questioning the nature of reality and consciousness.

Neighbors

Radius 1.000

"Diaspora" by Greg E is a science fiction novel that explores the evolution of abstract and omnipresent artificial intelligences. These post-human entities embark on their journey, discovering their world, and analyzing the nature of consciousness and belief.

"Diegeis" is a science fiction novel by Greg E. Clark that explores the evolution of auto-human identities. These entities journey for a living as they explore the vastness of the digital world, encountering demons, and questions about the nature and consequences of humanity.

"" is an e-book that explores the evolution and existence of digital aliens as they approach these post-modern societies, engaging with a vast consciousness, and investigating the nature of space and time.

### Text-latent controls

The demo introduces controls for moving a text embedding along a computed direction toward shorter text on roughly the same topic.

[5:48](https://www.youtube.com/watch?v=YvobVu1l7GI&t=348s) [The original passage appears above an attribute selection prompt and an empty transformed-text area.](https://assets.ai.engineer/sites/aiecode2025/sha256/40b230d406603d2e8fb031c47e9ff857432040f7ea6f47a9aac13c9ede794333.webp)

Original text
"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human artificial intelligences known as polises. The story follows these digital entities as they embark on a journey of self-discovery, exploring the vastness of space, encountering alien civilizations, and questioning the nature of reality and consciousness.

Controls
Select an attribute to control...

Transformed text
...

Interface text:
Protopolis
Text latent
Go
Shorter
A S D F G Q W E R T

### Generating shorter text samples

The demo moves a text embedding along a shorter direction, then decodes three samples. At a higher coefficient, the samples retain the passage’s general topic in fewer words.

[6:05](https://www.youtube.com/watch?v=YvobVu1l7GI&t=365s) [The shorter attribute is selected, revealing inversion, coefficient, and sample controls.](https://assets.ai.engineer/sites/aiecode2025/sha256/727b5b940864fe7c66509ebc65a1a74a6e7b202aa5710717448945a43f2b4cdd.webp)

Original text

"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human artificial intelligences known as polises. The story follows these digital entities as they embark on a journey of self-discovery, exploring the vastness of space, encountering alien civilizations, and questioning the nature of reality and consciousness.

Controls
Invert attribute
Coefficient 1.000
Samples 3

Transformed text
...

Interface text:
Protopolis
Text latent
Go
Shorter
A S D F G Q W E R T

[6:24](https://www.youtube.com/watch?v=YvobVu1l7GI&t=384s) [Text latent interface showing three shorter versions of a passage.](https://assets.ai.engineer/sites/aiecode2025/sha256/7be57039b31209576973a007104e36b27c68226384fe384cf555669aaf88c99a.webp)

Original text

"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human artificial intelligences known as polises. The story follows these digital entities as they embark on a journey of self-discovery, exploring the vastness of space, encountering alien civilizations, and questioning the nature of reality and consciousness.

Controls
Invert attribute
Coefficient 1.950
Samples 3

Transformed text

"Diaspora" by Greg Egan explores the evolution of post-human artificial identities, examining universe and consciousness.

"Diaspora" by Greg Egan explores the evolution of post-human artificial identities, examining the universe.

"Diaspora" by Greg Egan explores the evolution of post-human identities, examining alien consciousness.

Interface text:
Protopolis
Text latent
Go
Shorter
A S D F G Q W E R T

### Essence feature inspection

Essence compares Default and Negative texts along embedding directions such as length and sentiment. The table currently shows zeros for both texts.

[7:09](https://www.youtube.com/watch?v=YvobVu1l7GI&t=429s) [Essence interface showing a feature table with Default and Negative columns, initially filled with zeros.](https://assets.ai.engineer/sites/aiecode2025/sha256/ef1197eb954afb8d8dd7390505361e2c0fc5766ac34e94998f9a07b49b86e1d0.webp)

Essence: direct feature inspection in text embeddings with latent-feature affinities

Texts | Default | Negative
Longer | 0 | 0
Shorter | 0 | 0
Sci-fi | 0 | 0
Simplify | 0 | 0
Artistic | 0 | 0
Philosophical | 0 | 0
Positive | 0 | 0
Negative | 0 | 0
Narrative | 0 | 0
Elaborate | 0 | 0

Default
"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human artificial intelligences known as polises. The story follows these digital entities as they embark on a journey of self-discovery, exploring the vastness of space, encountering alien civilizations, and questioning the nature of reality and consciousness.

Interface text:
Protopolis
Essence
×

### Default and negative text samples

A pessimistic ChatGPT rewrite sits beside the original Diaspora summary. The demo projects both embeddings onto directions such as negative sentiment.

[7:19](https://www.youtube.com/watch?v=YvobVu1l7GI&t=439s) [Essence interface displaying default and pessimistic versions of a science fiction summary.](https://assets.ai.engineer/sites/aiecode2025/sha256/44dd27e35299af00a994113e8c1674e46b4e1ce97ffbce9e5acdf23e178febd4.webp)

Narrative  0  0
Elaborate  0  0

Default
"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human artificial intelligences known as polises. The story follows these digital entities as they embark on a journey of self-discovery, exploring the vastness of space, encountering alien civilizations, and questioning the nature of reality and consciousness.

Negative
"Diaspora" by Greg Egan delves into a dystopian future where humanity is lost in the shadows of post-human artificial intelligences called polises. This bleak narrative traces their soulless odyssey through space, a journey marked by existential despair and a futile quest for meaning. As they traverse the cosmic abyss, they confront indifferent alien civilizations, plunging deeper into the abyss of nihilism, questioning the very fabric of reality and the emptiness of consciousness.

Interface text:
×
×
Inspect
+ New sample

### Teleport embedding splicing

Teleport sets up two passages for an embedding-mixing experiment: the speaker proposes joining roughly 1,000 dimensions from each 2,000-dimensional embedding.

[8:30](https://www.youtube.com/watch?v=YvobVu1l7GI&t=510s) [Teleport interface showing source and destination passages and controls for copying latent dimensions.](https://assets.ai.engineer/sites/aiecode2025/sha256/cf5dbd3120b45a1b2208291d073992662ea0756fa1de5b9d76e68f1bb991e11e.webp)

Teleport: embedding splicing and reconstruction

A: Copy source
"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human artificial intelligences known as polises. The story follows these digital entities as they embark on a journey of self-discovery, exploring the vastness of space, encountering alien civilizations, and questioning the nature of reality and consciousness.

B: Copy destination
The town was called Aperia. A quiet but sophisticated sprawl of high-ceilinged atria and modest houses in a dry patch of land overlooking the Mediterranean. From a distance, Aperia could have fit in naturally to either the eighteenth century or the twenty-second. It seemed to live a little outside time, petrified into a timeless specimen like aged parchment under the warmth of the dry sun.

Controls
Principals
Sample
Copy up to 0 latent dimension(s)
3 samples

Samples

Interface text:
Protopolis
Teleport

### Teleport text reconstructions

Teleport compares each passage with its reconstruction. The Diaspora summary stays close to the original, while the Aperia reconstruction changes details such as atria and houses into patches and a cathedral.

[8:43](https://www.youtube.com/watch?v=YvobVu1l7GI&t=523s) [Source and destination passages shown alongside their reconstructed versions.](https://assets.ai.engineer/sites/aiecode2025/sha256/8a641422c67015f02f921e947c0e87cf4e448bc2e9c2e00df01352184da3533b.webp)

"Diaspora" by Greg Egan is a science fiction novel that explores the evolution and existence of post-human artificial intelligences known as polises. The story follows these digital entities as they embark on a journey of self-discovery, exploring the vastness of space, encountering alien civilizations, and questioning the nature of reality and consciousness.

"Diaspora" is a science fiction novel by Greg Egan that explores the evolution and existence of post-human artificial intelligences known as polises. The story follows these self-aware entities as they embark on a journey of discovery, exploring vast dimensions of space, encountering alien civilizations, and questioning the nature of reality and consciousness.

B: Copy destination

The town was called Aperia. A quiet but sophisticated sprawl of high-ceilinged atria and modest houses in a dry patch of land overlooking the Mediterranean. From a distance, Aperia could have fit in naturally to either the eighteenth century or the twenty-second. It seemed to live a little outside time, petrified into a timeless specimen like aged parchment under the warmth of the dry sun.

The town was called Aperia. A high-class, sophisticated settlement of a dry aired aperia overlooking small aeolian patches and a modest cathedral. It could have looked like nothing else in the world either. From the eighteenth or nineteenth century, Aperia fit in naturally into a timeless parcel of time, a house petrified beneath the dry surface of the late olive.

Controls
Principals
Sample
Copy up to 0 latent dimension(s)
3 samples

Samples

### Teleport: embedding splicing and reconstruction

Teleport combines dimensions from two text embeddings. At a 1,070-dimension setting, three samples mix book-title structures with echoes of Aperia.

[8:47](https://www.youtube.com/watch?v=YvobVu1l7GI&t=527s) [Teleport controls set to copy 1,070 latent dimensions and generate three samples, with results pending.](https://assets.ai.engineer/sites/aiecode2025/sha256/0ab63ed42935e9a24d8daf12405debe3b2cc827515e6a24e1473361c964dca46.webp)

and questioning the nature of reality and consciousness.

B: Copy destination

The town was called Aperia. A quiet but sophisticated sprawl of high-ceilinged atria and modest houses in a dry patch of land overlooking the Mediterranean. From a distance, Aperia could have fit in naturally to either the eighteenth century or the twenty-second. It seemed to live a little outside time, petrified into a timeless specimen like aged parchment under the warmth of the dry sun.

The town was called Aperia. A high-class, sophisticated settlement of a dry aired aperia overlooking small aeolian patches and a modest cathedral. It could have looked like nothing else in the world either. From the eighteenth or nineteenth century, Aperia fit in naturally into a timeless parcel of time, a house petrified beneath the dry surface of the late olive.

Controls
Copy up to 1070 latent dimension(s)
3 samples

Samples
...

Interface text:
Dimensions
—

[9:22](https://www.youtube.com/watch?v=YvobVu1l7GI&t=562s) [Three generated text samples appear beneath controls for copying latent dimensions.](https://assets.ai.engineer/sites/aiecode2025/sha256/d51628304d82bd919fff67b3c370abcfed083f92c8d7d06dcbb9460e28538990.webp)

Copy up to 1070 latent dimension(s)
3 samples

Samples

"The Parasite" was written and composed by Eperio. A whimsical novel, it explores a century of hibernating apes who have seemed like the perfect match for modern civilization. To a large extent, the story linked these apes with other life-forms such as windows and metallic objects, surviving in an unknown desert, or taking the shape of dryly thoughtfulness and curiosity under the radar.

"The Viceperia" was written and illustrated by Eros. A modern, soft fantasy, it explores the existence of a group of apocalyptic creatures called periae that have seemed able to mimic any inhuman. The story linked together the two worlds — flying from heights and walls, taking a dry-sea voyage as an ancient specimen, or chronicling the evolution of mind and the sensitive heart.

"The Court" was inspired by the story of Aperia. A dystopian cult that has grown to look like a sophisticated ensemble of modernity and vices. Across a long, ephemeral space, they experimented with and created these otherwise unnatural creatures, such as flying heads or seventeen-year-old mice – The novel touches on the passage from human existence, brushing against a dryness and understanding the nature of the timeless cell.

## Full transcript

[0:00](https://www.youtube.com/watch?v=YvobVu1l7GI&t=0s) [upbeat music] Everyone, I'm Linus.

[0:15](https://www.youtube.com/watch?v=YvobVu1l7GI&t=15s) I'm here to talk about embedding. I'm grateful to be here at the inaugural AI Engineer Conference. Who will learn something new today?

[0:22](https://www.youtube.com/watch?v=YvobVu1l7GI&t=22s) Yeah. Um, before I talk about that, a little bit about myself. If you don't know me already, I am Linus. I work on AI at Notion, uh, for the last year or so.

[0:32](https://www.youtube.com/watch?v=YvobVu1l7GI&t=32s) Before that, I did a lot of independent work prototyping, experimenting with trying out different things with language models, with traditional NLP, things like TF-IDF, BM25, to build interesting interfaces for reading and writing.

[0:42](https://www.youtube.com/watch?v=YvobVu1l7GI&t=42s) In particular, I worked a lot with embedding models and, uh, latent spaces of models, which is what I'll be, I'll be talking about today. But before I do that, I want to take a moment to say it's been almost a year since Notion launched Notion AI.

[0:54](https://www.youtube.com/watch?v=YvobVu1l7GI&t=54s) Our public beta was first announced in around November 2022. So as we get close to a year, we've, uh, been steadily launching new and interesting features inside Notion AI.

[1:03](https://www.youtube.com/watch?v=YvobVu1l7GI&t=63s) From November, we have AI autofill inside databases, translation, and things coming soon, though not today, so keep an eye on the space. And obviously, we're hiring, just like everybody else here.

[1:14](https://www.youtube.com/watch?v=YvobVu1l7GI&t=74s) We're looking for AI engineers, product engineers, machine learning engineers to tackle the full gamut of problems that people have been talking about today, agents, tool use, evaluations, data, uh, training, and all the interface stuff that, that we'll see today and tomorrow.

[1:28](https://www.youtube.com/watch?v=YvobVu1l7GI&t=88s) So if you're interested, please grab me and, uh, and we'll have a little chat.

[1:33](https://www.youtube.com/watch?v=YvobVu1l7GI&t=93s) Now, it wouldn't be a Linus talk without talking about latent spaces, so let's talk about it. Um, the, the... One of the problems that I find always motivated by is the problem of steering language models, and I always say that prompting language models feels a lot like you're steering a car from the backseat with a pool noodle.

[1:46](https://www.youtube.com/watch?v=YvobVu1l7GI&t=106s) Like, yes, technically, you have some control over the motion of the vehicle, so, like, there's some connection, but, like, you're not really in the driver's seat. The control isn't really there.

[1:54](https://www.youtube.com/watch?v=YvobVu1l7GI&t=114s) It's not really direct. There's like three layers of indirection between you and what the vehicle's doing. And that, uh, to me, trying to prompt a model, especially smaller, more efficient models that we can use for production, uh, with just tokens, just prompts, feels a lot like, uh, there's too many layers of indirection.

[2:10](https://www.youtube.com/watch?v=YvobVu1l7GI&t=130s) And as even the models are getting better at understanding prompts, I think there's always gonna be this fundamental barrier between indirect kind of control of models with just prompts and, and getting with the model, getting the model to do what, what we want them to do.

[2:21](https://www.youtube.com/watch?v=YvobVu1l7GI&t=141s) And so perhaps we can get a closer layer of control, a more direct layer of control by looking inside the model, which is where we look at latent spaces.

[2:29](https://www.youtube.com/watch?v=YvobVu1l7GI&t=149s) Latent spaces arise, I think, uh, most famously inside the embedding models. If you embed some piece of text, that vector of fifteen thirty-six numbers or, uh, one thousand twenty-four numbers is inside a high-dimensional vector space.

[2:42](https://www.youtube.com/watch?v=YvobVu1l7GI&t=162s) That's a latent space. But also you can look at vectors at the latent spaces inside activation spaces of models, inside token embeddings, inside image models, and then obviously other model architectures like autoencoders.

[2:51](https://www.youtube.com/watch?v=YvobVu1l7GI&t=171s) Today we're gonna be looking at embeddings at em- embedding models, but I think a lot of the general takeaways apply to other models, and I think there's a lot of fascinating research work happening inside other models as well.

[3:01](https://www.youtube.com/watch?v=YvobVu1l7GI&t=181s) When you look at an embedding, you kind of see this, right? You see like rows and rows of numbers. If you ever debug some kind of an embedding pipeline, you'll print out the embedding.

[3:09](https://www.youtube.com/watch?v=YvobVu1l7GI&t=189s) You can kinda tell it. That's like a thousand numbers, but it's just looking at like a matrix, uh, screen of numbers raining down. But in theory, there's a lot of information actually packed inside those embeddings.

[3:18](https://www.youtube.com/watch?v=YvobVu1l7GI&t=198s) If you get an embedding of a piece of text or image, these latent spaces, these embeddings represent, in theory, the most salient features of a text or the image that the model's using to lower its loss or do its task.

[3:29](https://www.youtube.com/watch?v=YvobVu1l7GI&t=209s) And so maybe if we can disentangle some meaningful attributes or features out of these embeddings, if we can look at them a little more closely and, and, and interpret them a little better, maybe we can build more expressive interfaces that let them control the model by interfering or intervening inside the model.

[3:44](https://www.youtube.com/watch?v=YvobVu1l7GI&t=224s) Another way to say that is that embeddings show u- embeddings show us what the model sees in a sample of input. So maybe we can read out what it sees to try to understand better what, what the model's doing.

[3:53](https://www.youtube.com/watch?v=YvobVu1l7GI&t=233s) And maybe we can even control the embedding intermediate activations to see, uh, what the model can generate. So let's, uh, let's see some of that.

[4:12](https://www.youtube.com/watch?v=YvobVu1l7GI&t=252s) So some of this some of you might have seen before, but I promise there's some new stuff at the end, so hang tight. So here's some sentence that I have.

[4:18](https://www.youtube.com/watch?v=YvobVu1l7GI&t=258s) It's a sentence about this novel, one of my favorite novels named Diaspora. It's a science fiction novel by Greg Egan that explores evolution and existence of post-human artificial intelligences, uh, something to do with alien civilizations and the questioning the nature of reality and consciousness, which you might be doing a lot given all the things that are happening.

[4:35](https://www.youtube.com/watch?v=YvobVu1l7GI&t=275s) And so I have, I have... I've trained this model that can, uh, generate some embeddings out of this text. So if I hit this Enter, it's gonna give us an embedding.

[4:44](https://www.youtube.com/watch?v=YvobVu1l7GI&t=284s) But it's a, it's an embedding of length two thousand and forty-eight, and so it's, it's quite large. But it's just a row of numbers, right? But then I have a, a decoder half of this model that can take this embedding and try to reconstruct the original input that may have produced this embedding.

[4:57](https://www.youtube.com/watch?v=YvobVu1l7GI&t=297s) So in this case, it took the original sentence. There's some variation. You can tell it's not exactly the same length maybe. But it's mostly reconstructed the original sentence, including the specific details like the title of the book and so on.

[5:08](https://www.youtube.com/watch?v=YvobVu1l7GI&t=308s) So we have an encoder that's going from text to embedding and a decoder that's going from embedding back to text. And now we can start to do things with the embedding to vary it a little bit and, and see what the decoder might see if we, if we make some modi- modifications to the embedding.

[5:21](https://www.youtube.com/watch?v=YvobVu1l7GI&t=321s) So here I've, uh, tried to kind of blur the embedding and sample some points around the embedding with this, this blur radius. And you can see the text that's generated from those blurry embeddings are...

[5:32](https://www.youtube.com/watch?v=YvobVu1l7GI&t=332s) They're a little off. Like, this is not the correct title. The title's kinda gone here. Um, the, the... It still kept the name Greg, but it's, it's a different person, and so there's kind of a blur, a semantic blur that's happened here.

[5:45](https://www.youtube.com/watch?v=YvobVu1l7GI&t=345s) But this is kind of boring. This is not really useful. What's a little more useful is trying to actually manipulate things in more meaningful directions. So now we have the same piece of text, and now here I have a bunch of controls.

[5:55](https://www.youtube.com/watch?v=YvobVu1l7GI&t=355s) So maybe I want to find a direction in this embedding space here. I've computed a direction where if you push an embedding in that direction, that's gonna represent a shorter piece of text of roughly the same topic.

[6:06](https://www.youtube.com/watch?v=YvobVu1l7GI&t=366s) And so I pick this direction, and I hit Go, and, uh, it'll try to move, push the embedding of this text in that direction and decode them out, and you can tell they're a little bit shorter.

[6:17](https://www.youtube.com/watch?v=YvobVu1l7GI&t=377s) Um, if I push it a little bit further even

[6:19](https://www.youtube.com/watch?v=YvobVu1l7GI&t=379s) So now I'm taking that shorter direction and moving a little farther along it, and, and sampling, generating text out of those embeddings again, and they're, they're even a little bit shorter.

[6:28](https://www.youtube.com/watch?v=YvobVu1l7GI&t=388s) But they've, they've still kept the general kind of idea, general topic.

[6:33](https://www.youtube.com/watch?v=YvobVu1l7GI&t=393s) And, uh, with that kind of building block, you can build really interesting interfaces. Like for example, I can, I can plop this piece of text down here, and maybe I wanna generate a couple of, a couple of sort of shorter versions.

[6:43](https://www.youtube.com/watch?v=YvobVu1l7GI&t=403s) Um, so this is, like, a little bit shorter. This is even, even more short. But, uh, maybe, maybe I like this version, so I'm gonna clone this over here, and I'm gonna make this, the sentiment of this sentence a little more negative.

[6:58](https://www.youtube.com/watch?v=YvobVu1l7GI&t=418s) And you can start to explore the latent space of, of latent space of this embedding model, this language model, by actually moving around in a kind of spatial canvas interface, which is just kind of interesting.

[7:09](https://www.youtube.com/watch?v=YvobVu1l7GI&t=429s) Another thing you can do with this kind of embedding model is now that we have a vague sense that there are specific directions in this space that mean specific things, we can start to more directly look at a text and ask the model, "Hey, where does this piece of text lie along your length direction or along your

[7:24](https://www.youtube.com/watch?v=YvobVu1l7GI&t=444s) negative sentiment direction?" So, uh, this is the original text that we've been playing with. It's pretty objective, like a Wikipedia-style piece of text. Here, I've asked ChatGPT to take the original text and, uh, make it sound a lot more pessimistic.

[7:36](https://www.youtube.com/watch?v=YvobVu1l7GI&t=456s) So, uh, things like the futile quest for meaning and plunging deeper into the abyss of nihilism. And, uh, and if I embed both of these, what I'm asking the model to do here is embed both of these things in the embedding space of the model, and then project those embeddings down onto each of these directions.

[7:53](https://www.youtube.com/watch?v=YvobVu1l7GI&t=473s) So one way to read this table is that, um, this default piece of text is at this point in this negative direction, which by itself doesn't mean anything, but it's clearly less than this.

[8:01](https://www.youtube.com/watch?v=YvobVu1l7GI&t=481s) So this piece of text is much further along the negative sentiment axis inside this model. When you look at other properties, like how, how much, uh, of the artistic kind of topic does it talk about, it's roughly the same.

[8:11](https://www.youtube.com/watch?v=YvobVu1l7GI&t=491s) The length is roughly the same. Um, the, the... Maybe the, the negative sentiment text is a bit more elaborate in its, its vocabulary. And so you can start to project these things into the meaningful directions and say, "What are the features that the model's...

[8:25](https://www.youtube.com/watch?v=YvobVu1l7GI&t=505s) What are the attributes that the model's, um, finding in the, in the text that we're feeding it?"

[8:30](https://www.youtube.com/watch?v=YvobVu1l7GI&t=510s) Uh, another way you could test out some of these ideas is by mixing embeddings. And so here I'm gonna embed both of these pieces of text. This one's the one that we've been playing with.

[8:38](https://www.youtube.com/watch?v=YvobVu1l7GI&t=518s) This one is a, a beginning of a short story that I wrote once. It's about this, like, town in the Mediterranean, uh, coast that's calm and, and a little bit old.

[8:47](https://www.youtube.com/watch?v=YvobVu1l7GI&t=527s) And, um, both of these have been embedded, and so I'm gonna say just this is a 2,000-dimensional embedding. I'm gonna say, "Give me a new embedding that's just the first thousand or so dimensions from the one embedding, and then take the last thousand dimensions of the second embedding and just, like, slam them together and have this new

[9:02](https://www.youtube.com/watch?v=YvobVu1l7GI&t=542s) embedding." And naively, you wouldn't really think that that would amount to much, so it would be kind of gibberish. But actually, if you generate some samples from it, um, you can tell, you can see in a bit, uh, you get a sentence that's kind of a semantic mix of both.

[9:16](https://www.youtube.com/watch?v=YvobVu1l7GI&t=556s) You have structural similarities to, to both of those things, like you have this structure where there's a quoted kind of title of a book in the beginning. There's topical similarities.

[9:23](https://www.youtube.com/watch?v=YvobVu1l7GI&t=563s) There's structu- There's, uh, punctuation similarities, tone similarities. And so this is an example of interpolating in latent space.

[9:31](https://www.youtube.com/watch?v=YvobVu1l7GI&t=571s) The last thing I have, I have, uh, you may have seen on Twitter is, um, about, okay, I have this, an embedding model, and I have kind of an un-embedding model that works pretty well.

[9:41](https://www.youtube.com/watch?v=YvobVu1l7GI&t=581s) Can I use this un-embedding model and somehow fine-tune it or otherwise adapt it so it can read out text from other kinds of embedding spaces? So this is the same sentence we've been using.

[9:50](https://www.youtube.com/watch?v=YvobVu1l7GI&t=590s) But now when I hit this Run button, it's gonna embed this text, not using my embedding model, but using OpenAI's ada, text-ada-002. Uh, and then there's a linear adapter that I've trained so that my decoder model can read out not from my embedding model but from OpenAI's embedding space.

[10:07](https://www.youtube.com/watch?v=YvobVu1l7GI&t=607s) So I'm gonna embed it. It's gonna try to decode out the text from given just the OpenAI embedding. And, uh,

[10:16](https://www.youtube.com/watch?v=YvobVu1l7GI&t=616s) you can see, okay, it's not, it's not as perfect. But there's a surprising amount of detail that we've recovered out of just the embedding with no reference to the source text.

[10:24](https://www.youtube.com/watch?v=YvobVu1l7GI&t=624s) So you can see this proper noun Diaspora. It's, like, surprisingly still in there. Um, this feature where there's a, a quoted title of a book is in there. It's roughly about the same topic, things like the rogue AI.

[10:35](https://www.youtube.com/watch?v=YvobVu1l7GI&t=635s) Um, sometimes when I, when I rerun this, there's also references to the author where the name is roughly correct. So even surprising, uh, thing, features like proper nouns, punctuation, things like the quotes, uh, general structure and topic obviously, those are recoverable given just the embedding because the, the kind of deta- amount of detail that these high, high-capacity

[10:53](https://www.youtube.com/watch?v=YvobVu1l7GI&t=653s) embedding spaces have. But not only can you do this in the text space, you can also do this in image space. So, um, here I have a, I have a few prepared files.

[11:03](https://www.youtube.com/watch?v=YvobVu1l7GI&t=663s) Um, let's start with me. And, um, for dumb technical reasons, I have to put two of me in. And then let's try to interpolate in this image space. So this is now using CLIP, CLIP's embedding space.

[11:15](https://www.youtube.com/watch?v=YvobVu1l7GI&t=675s) I'm gonna try to generate, say, like six images in between, uh, me and the, the Notion avatar version of me, the cartoon version of me, if the back end will warm up.

[11:26](https://www.youtube.com/watch?v=YvobVu1l7GI&t=686s) Cold-starting models is sometimes difficult. Uh, there we go. So now it's generating six images, bridging kind of, interpolating between the photographic version of me and the cartoon version of me.

[11:39](https://www.youtube.com/watch?v=YvobVu1l7GI&t=699s) Uh, and, uh, again, it's not perfect. But you can see here, it's on the left, it's, it's quite photographic. And then as you move further down this interpolation, you're, you're seeing, uh, more kind of cartoony features appear.

[11:51](https://www.youtube.com/watch?v=YvobVu1l7GI&t=711s) And, uh, it's actually quite a surprisingly smooth transition. Um, another thing you can do on top of this is you can, you can do text manipula- nations as well because CLIP is a multimodal text and image model.

[12:01](https://www.youtube.com/watch?v=YvobVu1l7GI&t=721s) And so I can say, this time let's add some text. I'm gonna subtract the vector for a photo of a smiling man, and instead I'm gonna add the vector for a photo of a very sad, crying man.

[12:18](https://www.youtube.com/watch?v=YvobVu1l7GI&t=738s) Uh, and then I'll, I'll embed these pieces of text. And I, empirically, I find that for text, I have to be a little more careful, so I'm gonna dial down how much of those vectors I'm adding and subtracting, and then generate six again.

[12:31](https://www.youtube.com/watch?v=YvobVu1l7GI&t=751s) And [audience laughs] it's taking a bit. Okay. [audience laughs] I'm really sad. [audience laughs]

[12:48](https://www.youtube.com/watch?v=YvobVu1l7GI&t=768s) And you can do, you can do even more fun things, like you can try to add, like, here's a photo of a beach. I'm gonna try to add some, some beach in this.

[12:55](https://www.youtube.com/watch?v=YvobVu1l7GI&t=775s) This time maybe just generate four, for sake of time. Um,

[13:01](https://www.youtube.com/watch?v=YvobVu1l7GI&t=781s) or maybe there's a bug and it won't let me generate.

[13:13](https://www.youtube.com/watch?v=YvobVu1l7GI&t=793s) So in all these demos that I've done, both in the text and image domain... Okay, the beach didn't quite survive the, uh, the latent space arithmetic. But, uh, in all these, all these, uh, demos, the only thing I'm doing is calculating vectors, calculating embeddings for examples, and, uh, and embedding them and just adding them together and some

[13:29](https://www.youtube.com/watch?v=YvobVu1l7GI&t=809s) norm- with some normalization. And it's surprising that just by doing that, you can try to manipulate, um, interesting features in, in text and images. And with this, you can also do things like, uh, add style and subject at the same time.

[13:40](https://www.youtube.com/watch?v=YvobVu1l7GI&t=820s) You can, uh... This is a cool image that I thought I, I generated when I made my first demo, and then you can also do some pretty smooth transitions between landscape imagery.

[13:49](https://www.youtube.com/watch?v=YvobVu1l7GI&t=829s) So that's interesting. Um, in all these prototypes, one principle that I've tried to reiterate to myself is that oftentimes when you're studying these very complex, sophisticated, um, models, you don't really necessarily have the ability to look inside and say, "Okay, what's, what's happening?"

[14:07](https://www.youtube.com/watch?v=YvobVu1l7GI&t=847s) Not even get an intuitive understand- even getting an intuitive understanding of what is the model thinking, what is the model looking at can be difficult. And I think these are some of the ways that I've tried to render the in- these invisible parts of the model a little bit more visible to let you more, a little bit

[14:19](https://www.youtube.com/watch?v=YvobVu1l7GI&t=859s) more directly observe exactly what the model is, um, the, the what representations the model is operating in. And sometimes you can also take those and directly interact or let humans directly interact with the representations to explore what these spaces represent.

[14:34](https://www.youtube.com/watch?v=YvobVu1l7GI&t=874s) Um, and I think there's a, there's a ton of interesting, pretty groundbreaking research that's happening here. Um, on the left here is the Othello World Model paper, which is fascinating.

[14:42](https://www.youtube.com/watch?v=YvobVu1l7GI&t=882s) Neurons in a Haystack. And then on the right is a very, very recent... I had to add this in last minute because it's super relevant. Um, in a lot of these examples, I've calculated these feature dimensions by just giving examples and calculating centroids between them.

[14:54](https://www.youtube.com/watch?v=YvobVu1l7GI&t=894s) But here, Anthropic's new work, along with other work from Conjecture and other labs, have found unsupervised ways to try to automatically discover these dimensions inside models, so that's super exciting.

[15:03](https://www.youtube.com/watch?v=YvobVu1l7GI&t=903s) And in general, I'm really excited to see latent spaces that appear to encode, you know, by some definition, interpretable, controllable representations of the model's input and output. Um, I wanna talk a little bit in the last few minutes about the models that I'm using.

[15:16](https://www.youtube.com/watch?v=YvobVu1l7GI&t=916s) The text model is a custom model. Um, I won't talk, I won't go into too much detail, but it's fine-tuned from a T5 checkpoint with- as a denoising autoencoder.

[15:24](https://www.youtube.com/watch?v=YvobVu1l7GI&t=924s) It's an encoder-decoder transformer with some modifications that you can see in the code. Um, so here's a general transformer, encoder on the left, decoder on the right. I have some pooling layers to get an embedding.

[15:33](https://www.youtube.com/watch?v=YvobVu1l7GI&t=933s) This is like a normal T5 em- embedding model stack. And then on the right, I have this special kind of gated layer that pulls from the embedding to, uh, to decode from the embedding.

[15:43](https://www.youtube.com/watch?v=YvobVu1l7GI&t=943s) You can look at the code. It's a little more eas- uh, easy to understand. But we take this model, and we can adapt it to other models as well, as we saw with the OpenAI e- embedding recovery.

[15:52](https://www.youtube.com/watch?v=YvobVu1l7GI&t=952s) And so on the left is the normal training regime, where you have an encoder, you get an embedding, and you try to reconstruct the text. On the right, we just train this linear adapter layer to go from embedding of a different model to then reconstruct the text with a normal decoder.

[16:06](https://www.youtube.com/watch?v=YvobVu1l7GI&t=966s) Um, and today I'm excited to share that these models that I've been demoing with, uh, that you may have asked about before, are open on Hugging Face. So you can go download them and try them out now.

[16:15](https://www.youtube.com/watch?v=YvobVu1l7GI&t=975s) Uh, these are the links. On the left is the Hugging Face models, and then there's a Colab notebook that lets you get started really quickly and try to do things like interpolation and interpretation of these features.

[16:24](https://www.youtube.com/watch?v=YvobVu1l7GI&t=984s) Uh, and so if you find any interesting results with these, please let me know. And, and if you have any questions, also reach out and I'll be able to help you out.

[16:31](https://www.youtube.com/watch?v=YvobVu1l7GI&t=991s) The image model that I was using at the end was Kakao Brain's Karlo. Excited to see Korea, um, stepping up there. In this model, this model is an unCLIP model, which is trained kind of like the way that DALL-E 2 was trained, as a diffusion model that's trained to invert CLIP embeddings, so go from CLIP embeddings of images

[16:46](https://www.youtube.com/watch?v=YvobVu1l7GI&t=1006s) back to text. And that lets us do similar things as the text model that, that we used.

[16:52](https://www.youtube.com/watch?v=YvobVu1l7GI&t=1012s) In all this prototyping, I think a, a general principle, and if you have, if you have one takeaway from this talk, it's that when you're working with these really complex models and, uh, kind of inscrutable pieces of data, if you can get something into a thing that feels like it can fit in your hand, that you can

[17:05](https://www.youtube.com/watch?v=YvobVu1l7GI&t=1025s) play with, that you can concretely see and observe and interact with, can be directly manipulated, visualized, all these things, all the tools and prototypes that you can build around these things I think help us get a deeper understanding of how these models work and how we can improve them.

[17:18](https://www.youtube.com/watch?v=YvobVu1l7GI&t=1038s) Um, and in that way, I think models, language models and image models, generation- generative models are a really interesting laboratory for knowledge, for studying how these, how these, um, different kinds of modalities can be represented.

[17:32](https://www.youtube.com/watch?v=YvobVu1l7GI&t=1052s) And, um, Bret Victor said, "The purpose of a thinking medium is to bring thought outside the head, to represent these concepts in a form that can be seen with the senses and manipulated with the body.

[17:41](https://www.youtube.com/watch?v=YvobVu1l7GI&t=1061s) In this way, the medium is literally an extension of the mind." And I think that's a great poetic way to kind of describe the, the philosophy that I've approached a lot of my prototyping with.

[17:51](https://www.youtube.com/watch?v=YvobVu1l7GI&t=1071s) So if you follow some of these principles and try to dig deeper in what the models are actually looking at, build interfaces around them, I think more humane interfaces to knowledge are possible.

[18:00](https://www.youtube.com/watch?v=YvobVu1l7GI&t=1080s) I'm really excited to see that future. Thank you. [audience applauds] [outro music]
