SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.12469 · 2020

Attention-based Quantum Tomography

arXiv · PDF · Open in the Atlas

Code that ran

10 of 10 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 7 have no contract verdict; 2 failures of our instrument; 0 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/2006.12469.json · badge: /api/ran/2006.12469.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
KimGroup/AQT canonical (classifier label)
classifier basis: census
10 ran · 0 no recorded run
FunctionStatusWhere it lives
BitFlip Ran
ran on a synthesized input
KimGroup/AQT/povm.py
code served (permissive licence) · get_code("823bceecb6cfc4c7")
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 int, ndim 0, dtype family int, 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
import numpy as np

# The function BitFlip takes three parameters:
# - n: an integer whose bits will be flipped
# - N: the total bit length to consider
# - pos: the position (from left) of the bit to flip

ARGS = {
    "n": 5,           # binary: 0101, a simple integer
    "N": 8,           # consider 8-bit representation
    "pos": 2          # flip the bit at position 2 from the left
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, 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
MLELoss Ran
ran on a synthesized input
KimGroup/AQT/MLE.py
code served (permissive licence) · get_code("5421f4156718415e")
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 float64, ndim 0, dtype family float; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-27T00:55:27Z. 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 numpy as np

class POVMStandIn:
    """Minimal POVM class with required attributes."""
    def __init__(self, Na, M):
        self.Na = Na
        self.M = M

# Parameters for MLELoss
Nq = 2  # number of qubits
dim = 2 ** Nq  # dimension of Hilbert space (4)

# t_params: should have length 4^Nq = 16
# - First 2^Nq = 4 diagonal elements
# - Remaining (2^Nq * (2^Nq - 1) / 2) * 2 = 12 off-diagonal elements (real + imag pairs)
# Total: 4 + 12 = 16
t_params = np.random.randn(4 ** Nq)

# p: probability vector matching the flattened output of the reduced density matrix
# After Nq iterations of partial traces, we get a (Na^Nq, 1, 1) shaped array
# When flattened and taking real part, p has shape (Na^Nq,)
Na = 2
p = np.ones(Na ** Nq) / (Na ** Nq)  # normalized probability distribution for 2^2 = 4 outcomes

# POVM measurement operators
# M should have shape (Na, 2, 2) to support the indexing M[na, i, j]
# Create simple POVM: projectors onto |0> and |1> states
M = np.zeros((Na, 2, 2), dtype=complex)
M[0, 0, 0] = 1.0  # |0><0|
M[1, 1, 1] = 1.0  # |1><1|

povm = POVMStandIn(Na=Na, M=M)

ARGS = {
    't_params': t_params,
    'p': p,
    'Nq': Nq,
    'povm': povm
}
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 float64, ndim 0, dtype family float — no output shape is stated: no later run recorded an output shape for this sample (observed_output and metamorphic_properties carry none; shape_contract and output_contract record ndim only)
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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
TtoRho Ran
ran on a synthesized input
KimGroup/AQT/MLE.py
code served (permissive licence) · get_code("3c474b097d55a054")
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 (2, 2) 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 numpy as np

# Determine Nq value - let's use Nq=1 for a small example
# For Nq=1: we need 4^1 = 4 parameters for t_params
# This creates a 2x2 matrix (2^1 = 2)

Nq = 1

# t_params needs exactly 4^Nq elements
# For Nq=1: 4^1 = 4 elements needed
# Structure: 
# - First 2^Nq (=2) elements are diagonal entries
# - Remaining elements are complex off-diagonal entries (2 per pair)

t_params = np.array([
    1.0 + 0.0j,  # diagonal element [0,0]
    1.0 + 0.0j,  # diagonal element [1,1]
    0.5,          # real part of [1,0]
    0.3           # imaginary part of [1,0]
], dtype=complex)

ARGS = {
    't_params': t_params,
    'Nq': Nq
}
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 ndarray, ndim 2, dtype family float, shape (2, 2) — shape (2, 2) 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
attention Ran
ran; our contract draft was wrong, not the code
KimGroup/AQT/.ipynb_checkpoints/ann-checkpoint.py
code served (permissive licence) · get_code("0cf22e1991ad4ef4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned tuple. 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
import math

torch.manual_seed(0)

# Create tiny tensors for attention mechanism
# Typical attention shape: (batch, num_heads, seq_len, d_k)
batch_size = 2
num_heads = 3
seq_len = 5
d_k = 4

query = torch.randn(batch_size, num_heads, seq_len, d_k)
key = torch.randn(batch_size, num_heads, seq_len, d_k)
value = torch.randn(batch_size, num_heads, seq_len, d_k)

# Create a mask (e.g., for padding or causal masking)
# Shape should match the attention scores shape: (batch, num_heads, seq_len, seq_len)
mask = torch.ones(batch_size, num_heads, seq_len, seq_len)
# Optionally mask out some positions (e.g., future positions for causal attention)
mask[:, :, :, 3:] = 0  # Mask positions 3 and beyond

# Create a dropout layer
dropout = nn.Dropout(p=0.1)

ARGS = {
    'query': query,
    'key': key,
    'value': value,
    'mask': mask,
    'dropout': dropout
}
Setup block drafted by
a language model, Claude Sonnet 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 — a tuple output has no array shape of its own; none is 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
basestr2int Ran
ran on a synthesized input
KimGroup/AQT/fidelity.py
code served (permissive licence) · get_code("88d748375c5705b7")
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 int, ndim 0, dtype family int, 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

def basestr2int(st, b):
    return sum([st[i] * b ** (len(st) - i - 1) for i in range(len(st))])

# st is indexed by integer position, so it should be a list or sequence
# The function accesses st[i] and uses len(st)
# b is used as a base for exponentiation
# st[i] should be numeric (int or similar) to multiply with b**power

st = [1, 2, 3, 4]  # A list of digits in some base
b = 10  # The base (e.g., decimal)

ARGS = {
    "st": st,
    "b": b
}
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 int, ndim 0, dtype family int, 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
binom Ran
ran on a synthesized input
KimGroup/AQT/fidelity.py
code served (permissive licence) · get_code("41e553c19f260dd6")
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 float, 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
import numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - p: numeric value (int or float), used in arithmetic operations
# - q: numeric value (int or float), used in range() and arithmetic operations
# - c: numeric value with default 1.0, used in arithmetic operations
# The function computes a binomial coefficient-like value

ARGS = {
    "p": 5,
    "q": 3,
    "c": 1.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
clones Ran
ran; our contract draft was wrong, not the code
KimGroup/AQT/ann.py
pointer only (licence: MIT); the stored copy get_code serves, from DSE-MSU/R-transformer, is pointer only (licence: NONE) · get_code("b1bec2c4b1c9b491")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from DSE-MSU/R-transformer, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

int2basestr Ran
ran on a synthesized input
KimGroup/AQT/MLE.py
code served (permissive licence) · get_code("50e6569937d95da6")
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 list, ndim 1, dtype family int; 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

ARGS = {
    "n": 42,
    "b": 2,
    "l": 8
}
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 list, ndim 1, dtype family int — 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
sample Ran
ran on a synthesized input
KimGroup/AQT/ann.py
code served (permissive licence) · get_code("aac1ef2df99b4262")
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 Tensor, ndim 2, dtype family int; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-27T00:55:33Z. 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
import torch.nn as nn
import numpy as np
from torch.autograd import Variable

torch.manual_seed(0)

def subsequent_mask(size):
    """Mask out subsequent positions."""
    attn_shape = (1, size, size)
    subsequent_mask = np.triu(np.ones(attn_shape), k=1).astype('uint8')
    return torch.from_numpy(subsequent_mask) == 0

class Batch:
    """Object for holding a batch of data with mask during training."""

    def __init__(self, trg=None, pad=0):
        if trg is not None:
            self.trg = trg[:, :-1]
            self.trg_y = trg[:, 1:]
            self.trg_mask = self.make_std_mask(self.trg, pad)
            self.ntokens = (self.trg_y != pad).data.sum()

    @staticmethod
    def make_std_mask(tgt, pad):
        """Create a mask to hide padding and future words."""
        tgt_mask = (tgt != pad).unsqueeze(-2)
        tgt_mask = tgt_mask & Variable(subsequent_mask(tgt.size(-1)).type_as(tgt_mask.data))
        return tgt_mask

class SimpleGenerator(nn.Module):
    """Generator that outputs log probabilities."""
    def __init__(self, vocab_size):
        super().__init__()
        self.linear = nn.Linear(4, vocab_size)
    
    def forward(self, x):
        # x shape: (batch, seq_len, 4)
        # output shape: (batch, seq_len, vocab_size)
        logits = self.linear(x)
        return torch.log_softmax(logits, dim=-1)

class SimpleModel(nn.Module):
    """Simple model with forward method and generator."""
    def __init__(self):
        super().__init__()
        self.Nq = 3  # number of questions
        self.embedding = nn.Embedding(10, 4)
        self.linear = nn.Linear(4, 4)
        self.generator = SimpleGenerator(vocab_size=7)
    
    def forward(self, x, mask):
        # x: (batch, seq_len) - token indices
        # Returns: (batch, seq_len, 4)
        embedded = self.embedding(x)
        output = self.linear(embedded)
        return output

model = SimpleModel()
Ns = 2
device = 'cpu'

ARGS = {
    'model': model,
    'Ns': Ns,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family int — no output shape is stated: no later run recorded an output shape for this sample (observed_output and metamorphic_properties carry none; shape_contract and output_contract record ndim only)
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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
subsequent_mask Ran
ran, violated the contract we drafted
KimGroup/AQT/ann.py
code served (permissive licence) · get_code("79e53d4ea458987d")
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 Tensor, ndim 3, dtype family float, shape (1, 4, 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 numpy as np
import torch

torch.manual_seed(0)

# The function takes a single parameter 'size' which is used to create
# a numpy array of shape (1, size, size) and then converted to a torch tensor.
# We need to provide a small integer value for size.

size = 4

ARGS = {
    "size": size
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (1, 4, 4) — shape (1, 4, 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

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 3 the same month, 3 later) and 7 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
clones 79 other papers
20 dated earlier, 3 the same month, 56 later · 11 only as an assembly brick
1411.4555 (2014-11)
Show and Tell: A Neural Image Caption Generator
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1706.03762 (2017-06)
Attention Is All You Need
and 76 more not named here
attention 27 other papers
9 dated earlier, 1 the same month, 16 later, 1 same year, order not determinable
1411.4555 (2014-11)
Show and Tell: A Neural Image Caption Generator
1609.08144 (2016-09)
Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
and 24 more not named here
subsequent_mask 21 other papers
7 dated earlier, 1 the same month, 13 later
1411.4555 (2014-11)
Show and Tell: A Neural Image Caption Generator
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1707.07998 (2017-07)
Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
and 18 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

With rapid progress across platforms for quantum systems, the problem of many-body quantum state reconstruction for noisy quantum states becomes an important challenge. Recent works found promise in recasting the problem of quantum state reconstruction to learning the probability distribution of quantum state measurement vectors using generative neural network models. Here we propose the "Attention-based Quantum Tomography" (AQT), a quantum state reconstruction using an attention mechanism-based generative network that learns the mixed state density matrix of a noisy quantum state. The AQT is based on the model proposed in "Attention is all you need" by Vishwani et al (2017) that is designed to learn long-range correlations in natural language sentences and thereby outperform previous natural language processing models. We demonstrate not only that AQT outperforms earlier neural-network-based quantum state reconstruction on identical tasks but that AQT can accurately reconstruct the density matrix associated with a noisy quantum state experimentally realized in an IBMQ quantum computer. We speculate the success of the AQT stems from its ability to model quantum entanglement across the entire quantum system much as the attention model for natural language processing captures the correlations among words in a sentence.

For agents

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

get_harvested_code_for_paper("2006.12469")
get_code_for_paper("2006.12469")
have("2006.12469")

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

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

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

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

Connect an agent — have() is free.