affordance

Affordance/Showcase

Showcase

Things we built with Affordance and things we measured, each with its code and its numbers.

Pages

18

Benchmarks

6

Built with Affordance

5

Examples

4

Benchmark

We replaced chat templates with Affordance in four experiments and measured what each one changed

We ran the usual chat templates beside Affordance on the same models and tasks. The templates joined tokens across a break, rebuilt 11.0% of replies differently, changed how a trained model writes, broke a server's cache and slowed the first token of a reply.

4 experiments

Benchmark

Affordance inside SGLang made replies start 24% sooner on 120,000-token prompts

A model server turns each conversation into tokens before the model starts. We replaced that step in two servers, SGLang and vLLM, with Affordance and ran three models three times each. On Qwen3.6-35B-A3B in SGLang, replies to prompts over 120,000 tokens started in 421 to 422 ms instead of 552 to 562 ms.

24% sooner

Benchmark

We trained a model with reinforcement learning on an Affordance app, from 40% to 77%, on exactly the tokens it saw

Rebuilding the model's replies with its chat template, the usual way, changed 261 of 2,729 of them. Every one of the 345,983 model calls Affordance exported matched what the inference server had processed, and Qwen3-4B learned the task.

40% → 77%

Built with Affordance

We trained Qwen3-4B to work in a plain document instead of a chat, from 11% to 78% right

Chat models are trained to read conversations. We wrote a task as a plain document instead, with numbered steps and no chat layout. Qwen3-4B got 10.9% right at first and 77.7% after 70 training steps, level with the same model trained in chat.

11% → 78%

Benchmark

We trained Qwen3-4B on chat-template rebuilds of its replies, and it stopped writing the blank line before its tool calls

The usual way to train an agent rebuilds the model's replies from saved messages. On our task the rebuild changed 11.0% of replies, and after 70 training steps on rebuilds the model wrote its tool calls differently. Trained on its own exact tokens with Affordance, it kept its own form.

Built with Affordance

The same app, run by a decision model: 266 of 270 support messages routed correctly, 74 ms each

A decision model reads a list of options and picks one, without writing any text. Affordance renders an app's tools as those options, so a support-desk app with nine tools ran unchanged on LiquidAI's d1-3B.

266 of 270

Benchmark

We found LiquidAI's d1 reading the end of a message and the start of its question as one token, in 699 of 3,080 test messages

d1 is a model that picks one option from a list. Its prompt is a message, three newlines, then the question. When the message ends in a period, d1's tokenizer turns the period and the newlines into a single token.

699 of 3,080

Built with Affordance

We built OptMem, a long-term memory for AI agents, as a small Affordance app

A chat model forgets everything when a conversation ends. OptMem, a design by Victor Taelin, has the model keep one-line notes and read them back next time. Our version is 120 lines, and it answered 8 of 8 questions about facts from earlier conversations.

Built with Affordance

We built a Recursive Language Model as one Affordance file

Models get worse at answering as their input gets longer. A Recursive Language Model keeps the long input out of the prompt and lets the model work on it with code. Ours got 5 of 6 questions right on a 408,893-character log. Reading the log directly, the same model finished none.

Compatibility test

740 models' prompt formats rebuilt in Affordance, each matching the official one token for token

Every chat model expects its conversations in one exact format. We rebuilt the format of 740 models in Affordance and ran 963 test conversations through each one and through the model's official tools. The tokens matched every time.

740 models

Benchmark

One line in a style sheet cut a long conversation's requests from 4.6 seconds to 0.5

A model server saves work when a prompt starts the same way as the last one. An agent with a full history breaks that on every turn by trimming a little off the front. We changed how it trims, with one line, and requests got nine times faster.

4.6 s → 0.5 s

Built with Affordance

Running the pi coding agent on Affordance

pi is an open-source coding agent for the terminal. In our fork, the part that talks to the model is an Affordance app. Changing when pi summarizes a long conversation is now an edit to two numbers in a 41-line file.

Comparison

Affordance vs. Pi Durable

Both can run durable agents. Affordance also renders the model's interface, down to the template and token IDs inside an inference server.

Example

Showing a model the useful 98 tokens of a 1,440-token test log

When an agent runs your tests, the output can be thousands of tokens, and the model mostly needs the last line. This three-line rule keeps the start and the end of a command's output and says how much it left out.

1,440 → 98 tokens

Example

A first agent in 23 lines, and a recording of it at work

An agent is a model that uses tools in a loop until a task is done. This is the smallest one Affordance writes for you: it can run shell commands and give an answer. The page walks through the file and shows one real run.

23 lines

Example

One app, shown to three different models

Qwen, GLM and Llama each expect a prompt in their own format, and each has its own way of listing tools. This app is one file that names no model, and one setting picks the format. The page shows what each of the three models reads.

3 models

Example

One Affordance app showed five models a picture, a video or a spoken word, and all 7 answers were right

A model that takes pictures expects a special token in its prompt where the picture goes, and each family has its own. We gave five models from five publishers a blue picture, a green video or the spoken word banana through one small app, and read their answers.

7 of 7 right

Formal proof

A proof that a part of the prompt never goes over its token limit

If you give a part of the prompt a limit of 1,500 tokens, Affordance must never put 1,501 there, whatever the content is. We did not only test that. A proof checker confirms it for every possible input.

proved