SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.01702 · 2024

Fluent dreaming for language models

arXiv · PDF · Open in the Atlas

Code that ran

4 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 3 failures of our instrument; 5 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2402.01702.json · badge: /api/ran/2402.01702.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
confirm-solutions/dreamy canonical (classifier label)
classifier basis: census
4 ran · 5 no recorded run
FunctionStatusWhere it lives
build_pareto_frontier Ran
ran; our contract draft was wrong, not the code
confirm-solutions/dreamy/dreamy/epo.py
code served (permissive licence) · get_code("40b63eccd8c8fa7b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ParetoFrontier. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import dataclasses
from typing import List

# Stand-in tokenizer class
class SimpleTokenizer:
    def decode(self, ids):
        """Convert token ids to text"""
        if isinstance(ids, np.ndarray):
            ids = ids.tolist()
        return "sample_text_" + "_".join(str(i) for i in ids)

# Stand-in History class
@dataclasses.dataclass
class History:
    xentropy: np.ndarray
    target: np.ndarray
    ids: np.ndarray

# Create tokenizer
tokenizer = SimpleTokenizer()

# Create sample histories
# History 1: 3 samples, each with 2 token ids
history1 = History(
    xentropy=np.array([[0.5], [0.7], [0.3]]),
    target=np.array([[0.8], [0.6], [0.9]]),
    ids=np.array([[1, 2], [3, 4], [5, 6]])
)

# History 2: 2 samples, each with 2 token ids
history2 = History(
    xentropy=np.array([[0.4], [0.6]]),
    target=np.array([[0.85], [0.65]]),
    ids=np.array([[7, 8], [9, 10]])
)

histories = [history1, history2]

# Create Xvs (cross-entropy penalties)
Xvs = 1.0 / np.linspace(0, 50, 1000)[1:]

ARGS = {
    "tokenizer": tokenizer,
    "histories": histories,
    "Xvs": Xvs
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ParetoFrontier — a ParetoFrontier output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ParetoFrontier output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
check_file_exists Ran
ran, violated the contract we drafted
confirm-solutions/dreamy/dreamy/experiment.py
code served (permissive licence) · get_code("ff0ddb961dafdda8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import boto3
from botocore.exceptions import ClientError
from unittest.mock import Mock, MagicMock

# Create a mock S3 client
s3 = Mock()

# Set up the mock to succeed for head_object (file exists case)
s3.head_object = MagicMock()

# For this test, we'll set it up to return successfully (file exists)
s3.head_object.return_value = {'ResponseMetadata': {'HTTPStatusCode': 200}}

bucket = "test-bucket"
key = "test-key.txt"

ARGS = {
    "s3": s3,
    "bucket": bucket,
    "key": key
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
boto3, botocore — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
logit_diff_runner Ran
ran; our contract draft was wrong, not the code
confirm-solutions/dreamy/dreamy/runners.py
code served (permissive licence) · get_code("0a7362a40b17901c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Build a minimal model that satisfies how logit_diff_runner uses it
class MinimalModel(nn.Module):
    def __init__(self, vocab_size=100, hidden_dim=4):
        super().__init__()
        self.linear = nn.Linear(hidden_dim, vocab_size)
        self.device_attr = torch.device('cpu')
    
    @property
    def device(self):
        return self.device_attr
    
    def forward(self, input_ids=None, inputs_embeds=None):
        if input_ids is not None:
            # Create dummy embeddings from input_ids
            batch_size, seq_len = input_ids.shape
            embeddings = torch.randn(batch_size, seq_len, 4)
        else:
            batch_size, seq_len, _ = inputs_embeds.shape
            embeddings = inputs_embeds
        
        # Pass through linear layer to get logits
        logits = self.linear(embeddings)
        
        # Create output object with logits attribute
        output = type('Output', (), {'logits': logits})()
        return output

# Build a minimal tokenizer
class MinimalTokenizer:
    def __init__(self, vocab_size=100):
        self.vocab_size = vocab_size
    
    def batch_decode(self, input_ids):
        # Return strings for each batch element
        return [f"text_{i}" for i in range(input_ids.shape[0])]
    
    def encode(self, text, return_tensors=None):
        # Return fixed-size token sequence
        tokens = torch.tensor([[1, 2, 3, 4]])
        return tokens

# Create instances
model = MinimalModel(vocab_size=100, hidden_dim=4)
tokenizer = MinimalTokenizer(vocab_size=100)
token_id = 5
banned_text = "forbidden"

ARGS = {
    'model': model,
    'tokenizer': tokenizer,
    'token_id': token_id,
    'banned_text': banned_text,
    'check_retokenization': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
viz_simple Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
confirm-solutions/dreamy/dreamy/attribution.py
code served (permissive licence) · get_code("6989b8a8e10f20b8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Create sample tokens and attributions
tokens = ['hello', 'world', 'test', 'example']
attributions = np.array([0.2, 0.5, 0.8, 0.3])

ARGS = {
    'tokens': tokens,
    'attributions': attributions,
    'normalize': True,
    'colormap': 'viridis'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
does_retokenize Not yet run
unverified (harvested, no recorded run)
confirm-solutions/dreamy/dreamy/runners.py
code served (permissive licence) · get_code("c064d28f43a7d9c6")
How it ran

no invocation recorded.

epo Not yet run
unverified (harvested, no recorded run)
confirm-solutions/dreamy/dreamy/epo.py
code served (permissive licence) · get_code("e6c85e40b8e012ea")
How it ran

no invocation recorded.

load_model Not yet run
unverified (harvested, no recorded run)
confirm-solutions/dreamy/dreamy/epo.py
code served (permissive licence) · get_code("70da85a2f1e954b0")
How it ran

no invocation recorded.

resample Not yet run
unverified (harvested, no recorded run)
confirm-solutions/dreamy/dreamy/attribution.py
code served (permissive licence) · get_code("4df8cbcc21efc651")
How it ran

no invocation recorded.

viz Not yet run
unverified (harvested, no recorded run)
confirm-solutions/dreamy/dreamy/attribution.py
code served (permissive licence) · get_code("164c2cef2b355a4d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 9 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Feature visualization, also known as "dreaming", offers insights into vision models by optimizing the inputs to maximize a neuron's activation or other internal component. However, dreaming has not been successfully applied to language models because the input space is discrete. We extend Greedy Coordinate Gradient, a method from the language model adversarial attack literature, to design the Evolutionary Prompt Optimization (EPO) algorithm. EPO optimizes the input prompt to simultaneously maximize the Pareto frontier between a chosen internal feature and prompt fluency, enabling fluent dreaming for language models. We demonstrate dreaming with neurons, output logits and arbitrary directions in activation space. We measure the fluency of the resulting prompts and compare language model dreaming with max-activating dataset examples. Critically, fluent dreaming allows automatically exploring the behavior of model internals in reaction to mildly out-of-distribution prompts. Code for running EPO is available at https://github.com/Confirm-Solutions/dreamy. A companion page demonstrating code usage is at https://confirmlabs.org/posts/dreamy.html

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2402.01702")
get_code_for_paper("2402.01702")
have("2402.01702")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2402.01702.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2402.01702.svg)](https://syntology.ai/paper/2402.01702)

Connect an agent — have() is free.