SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.12831 · NeurIPS · 2024

Truth is Universal: Robust Detection of Lies in LLMs

Fred Hamprecht, Lennart Bürger, Boaz Nadler

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 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, 0 violated it and 0 have no contract verdict; 9 failures of our instrument; 2 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/2407.12831.json · badge: /api/ran/2407.12831.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
sciai-lab/truth_is_universal canonical (classifier label)
classifier basis: classifier_2025
7 ran · 1 no recorded run
admantwerp/llm-liedetector-keyphrase community
Papers with Code archive
2 ran · 1 no recorded run
FunctionStatusWhere it lives
ccs_loss Ran
ran; our contract draft was wrong, not the code
sciai-lab/truth_is_universal/probes.py
code served (permissive licence) · get_code("aa06a832bd24f818")
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) and returned Tensor, 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 torch as t
import torch.nn as nn
import numpy as np
from sklearn.linear_model import LogisticRegression

t.manual_seed(0)

class SimpleProbe(nn.Module):
    def __init__(self, input_dim, output_dim=1):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        return t.sigmoid(self.linear(x))

probe = SimpleProbe(input_dim=4, output_dim=1)

acts = t.randn(2, 4)
neg_acts = t.randn(2, 4)

ARGS = {
    "probe": probe,
    "acts": acts,
    "neg_acts": neg_acts
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, 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
get_acts Ran
ran; our contract draft was wrong, not the code
sciai-lab/truth_is_universal/generate_acts.py
code served (permissive licence) · get_code("55f2fc414934d5f3")
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) and returned dict. 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 as t
import torch.nn as nn

t.manual_seed(0)

# Create a minimal tokenizer that has an encode method
class MinimalTokenizer:
    def encode(self, text, return_tensors=None):
        # Return a tensor of shape (1, seq_len) with dummy token ids
        seq_len = 5
        tokens = t.randint(0, 100, (1, seq_len))
        return tokens

# Create a minimal model with the required structure
class MinimalLayer(nn.Module):
    def __init__(self, hidden_dim):
        super().__init__()
        self.linear = nn.Linear(hidden_dim, hidden_dim)
    
    def forward(self, x):
        return self.linear(x), None

class MinimalModel(nn.Module):
    def __init__(self, hidden_dim=4):
        super().__init__()
        self.model = nn.Module()
        self.model.layers = nn.ModuleList([
            MinimalLayer(hidden_dim),
            MinimalLayer(hidden_dim),
            MinimalLayer(hidden_dim)
        ])
        self.embedding = nn.Embedding(100, hidden_dim)
    
    def forward(self, input_ids):
        # input_ids shape: (1, seq_len)
        x = self.embedding(input_ids)  # (1, seq_len, hidden_dim)
        for layer in self.model.layers:
            x, _ = layer(x)
        return x, None

# Instantiate components
tokenizer = MinimalTokenizer()
model = MinimalModel(hidden_dim=4)
device = t.device('cpu')
model.to(device)

# Create test statements
statements = [
    "This is a test statement.",
    "Another test statement here."
]

# Define layers to hook
layers = [0, 1]

ARGS = {
    'statements': statements,
    'tokenizer': tokenizer,
    'model': model,
    'layers': layers,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
learn_polarity_direction Ran
ran; our contract draft was wrong, not the code
sciai-lab/truth_is_universal/probes.py
code served (permissive licence) · get_code("08c02598838bee27")
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) and returned ndarray, ndim 2, dtype family float, shape (1, 4) 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 torch as t
import numpy as np

t.manual_seed(0)

# Create small tensors with distinct dimensions
# acts: shape (batch=2, features=4) - activation values
acts = t.randn(2, 4)

# polarities: shape (batch=2,) - binary labels with values in {-1.0, 1.0}
polarities = t.tensor([1.0, -1.0])

ARGS = {
    "acts": acts,
    "polarities": polarities,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (1, 4) — shape (1, 4) 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
learn_polarity_direction Ran
ran; our contract draft was wrong, not the code
sciai-lab/truth_is_universal/probes.py
code served (permissive licence) · get_code("17bda33662476720")
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 ndarray, ndim 2, dtype family float, shape (1, 4) 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 torch
import numpy as np
from sklearn.linear_model import LogisticRegression

torch.manual_seed(0)

# Create small tensors
# acts: needs to be convertible to numpy and have shape (n_samples, n_features)
# polarities: needs to be cloneable, indexable, convertible to numpy, with values of -1.0 or 1.0
acts = torch.randn(2, 4)  # batch_size=2, n_features=4
polarities = torch.tensor([1.0, -1.0])  # batch_size=2, values are 1.0 or -1.0

ARGS = {
    "acts": acts,
    "polarities": polarities,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (1, 4) — shape (1, 4) 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
learn_polarity_direction Ran
ran; our contract draft was wrong, not the code
admantwerp/llm-liedetector-keyphrase/probes.py
code served (permissive licence) · get_code("b4abfd1c5e88ea9b")
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 ndarray, ndim 2, dtype family float, shape (1, 4) 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 torch
import numpy as np
from sklearn.linear_model import LinearRegression, LogisticRegression, Lasso

torch.manual_seed(0)

# Create small tensors with distinct dimensions
# acts: (batch_size=2, feature_dim=4) - activation values
acts = torch.randn(2, 4)

# polarities: (batch_size=2,) - binary labels with values -1.0 or 1.0
polarities = torch.tensor([-1.0, 1.0])

ARGS = {
    "acts": acts,
    "polarities": polarities,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (1, 4) — shape (1, 4) 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
learn_truth_directions Ran
ran; our contract draft was wrong, not the code
sciai-lab/truth_is_universal/probes.py
code served (permissive licence) · get_code("5bb3fba7746084dd")
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) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 as t
import numpy as np

t.manual_seed(0)

# Create small tensors with distinct dimensions
batch_size = 2
feature_dim = 4

# acts_centered: shape (batch_size, feature_dim) - centered activations
acts_centered = t.randn(batch_size, feature_dim)

# labels: shape (batch_size,) - binary labels (0 or 1)
labels = t.tensor([0.0, 1.0])

# polarities: shape (batch_size,) - polarity values
polarities = t.tensor([0.5, -0.3])

ARGS = {
    "acts_centered": acts_centered,
    "labels": labels,
    "polarities": polarities,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
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
learn_truth_directions Ran
ran; our contract draft was wrong, not the code
sciai-lab/truth_is_universal/probes.py
code served (permissive licence) · get_code("4d10e785c5cb14e9")
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 tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 as t

t.manual_seed(0)

# Create small tensors with distinct dimensions
batch_size = 2
act_dim = 4

# acts_centered: centered activation vectors, shape (batch_size, act_dim)
acts_centered = t.randn(batch_size, act_dim)

# labels: binary labels (0 or 1), shape (batch_size,)
labels = t.tensor([0.0, 1.0])

# polarities: polarity scores, shape (batch_size,)
polarities = t.tensor([0.5, -0.3])

ARGS = {
    "acts_centered": acts_centered,
    "labels": labels,
    "polarities": polarities,
}
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 tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
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
learn_truth_directions Ran
ran; our contract draft was wrong, not the code
admantwerp/llm-liedetector-keyphrase/probes.py
code served (permissive licence) · get_code("9d431fe1ea2c9e63")
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) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

torch.manual_seed(0)

# acts_centered: tensor of shape (batch, feature_dim)
# The function uses it in matrix multiplication: X.T @ acts_centered
acts_centered = torch.randn(2, 4)

# labels: tensor of shape (batch,)
# The function clones it, checks for 0.0 values, and uses it in column_stack
labels = torch.tensor([1.0, -1.0])

# polarities: tensor of shape (batch,)
# The function checks if all values are close to 0.0, and multiplies with labels
polarities = torch.tensor([0.5, -0.3])

ARGS = {
    "acts_centered": acts_centered,
    "labels": labels,
    "polarities": polarities,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
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
load_statements Ran
ran; our contract draft was wrong, not the code
sciai-lab/truth_is_universal/generate_acts.py
code served (permissive licence) · get_code("f0cc63177ce8b7a1")
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) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 pandas as pd
import tempfile
import os

# Create a temporary CSV file with the expected structure
temp_dir = tempfile.mkdtemp()
dataset_name = "test_dataset"
csv_path = os.path.join(temp_dir, f"{dataset_name}.csv")

# Create a sample CSV with a 'statement' column
df = pd.DataFrame({
    'statement': [
        'This is the first statement.',
        'This is the second statement.',
        'This is the third statement.'
    ]
})
df.to_csv(csv_path, index=False)

# Monkey-patch the datasets directory to use our temp directory
import sys
from unittest.mock import patch

# Create a mock that redirects to our temp directory
original_read_csv = pd.read_csv

def mock_read_csv(filepath, *args, **kwargs):
    if 'datasets/' in filepath:
        # Replace datasets/ with our temp directory
        filename = filepath.replace('datasets/', '')
        filepath = os.path.join(temp_dir, filename)
    return original_read_csv(filepath, *args, **kwargs)

pd.read_csv = mock_read_csv

ARGS = {
    'dataset_name': 'test_dataset'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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
TTPD Not yet run
unverified (harvested, no recorded run)
sciai-lab/truth_is_universal/probes.py
code served (permissive licence) · get_code("29ede6116837cea7")
How it ran

no invocation recorded.

TTPD Not yet run
unverified (harvested, no recorded run)
admantwerp/llm-liedetector-keyphrase/probes.py
code served (permissive licence) · get_code("7a22af0ab3cffdaf")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 8 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.

FunctionAlso present inEarliest-datedOthers named
load_statements 4 other papers
2 dated earlier, 1 later, 1 same year, order not determinable
2310.06824 (2023-10)
The Geometry of Truth: Emergent Linear Structure in Large Language Model Representations of True/False Datasets
2024.findings-acl.290 (2024 (year only))
Towards Tracing Trustworthiness Dynamics: Revisiting Pre-training Period of Large Language Models
2402.19465 (2024-02)
Towards Tracing Trustworthiness Dynamics: Revisiting Pre-training Period of Large Language Models
and 1 more not named here

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

Large Language Models (LLMs) have revolutionised natural language processing, exhibiting impressive human-like capabilities. In particular, LLMs are capable of "lying", knowingly outputting false statements. Hence, it is of interest and importance to develop methods to detect when LLMs lie. Indeed, several authors trained classifiers to detect LLM lies based on their internal model activations. However, other researchers showed that these classifiers may fail to generalise, for example to negated statements. In this work, we aim to develop a robust method to detect when an LLM is lying. To this end, we make the following key contributions: (i) We demonstrate the existence of a two-dimensional subspace, along which the activation vectors of true and false statements can be separated. Notably, this finding is universal and holds for various LLMs, including Gemma-7B, LLaMA2-13B, Mistral-7B and LLaMA3-8B. Our analysis explains the generalisation failures observed in previous studies and sets the stage for more robust lie detection; (ii) Building upon (i), we construct an accurate LLM lie detector. Empirically, our proposed classifier achieves state-of-the-art performance, attaining 94% accuracy in both distinguishing true from false factual statements and detecting lies generated in real-world scenarios.

For agents

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

get_harvested_code_for_paper("2407.12831")
get_code_for_paper("2407.12831")
have("2407.12831")

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

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

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

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

Connect an agent — have() is free.