deskmerc/ quantum

Byte protection / KINGSTON

Quantum Field Report

Prepare the codeword directly at Charlie

Check the final receiver without the preceding transport circuit.

IBM job ID
dc0g6kqnj2vs73ddvolg
Submitted
20 Nov 2026 · 20:34 CST
QPU charge
2 seconds
Backend
ibm_kingston
Sampling
256 shots per recorded setting/case
Provenance
Quantum Field Report, page 13.

The question

Check the final receiver without the preceding transport circuit.

Circuit & method

In a separate job, prepare the same Hamming codeword directly on the identical Charlie endpoints and read it out.

PrepareState, codeword or problem instance
Run on KingstonRecorded physical circuit and settings
Measure & checkCounts, decoding and classical verification

Results

Raw A was exact on 252/256 shots; decoding recovered all 256. There were 250 intact codewords and six single-bit errors.

Measured outcomesAll-shot success; each bar runs from 0% to 100%.
Raw byte252/256 · 98.4%
Decoded byte256/256 · 100.0%

What this supports

This is a separate direct-preparation job. It verifies this local codeword readout, while a clean codeword prepared at Bob and sent through just the SWAPs would be a different control. No such result is in the supplied register.

Percentages are rounded for reading. The original integer counts, physical layouts, settings and available uncertainty calculations remain in the records below. Sampling intervals do not account for drift or every systematic error.

Full experiment record

Every top-level field from the primary hardware JSON is reproduced below, including the complete saved measurement distributions where present. Field names and outcome strings retain their original order and spelling.

backend
ibm_kingston
previous_job
dc0g4nlhdvas73bjffe0
endpoints_by_hamming_position
[
  144,
  56,
  58,
  88,
  126,
  152,
  128,
  110,
  73,
  44,
  115,
  17
]
native_counts
{
  "measure": 12,
  "x": 3
}
input_codeword
010010000100
stage
done
tag
charlie-direct-hamming-a-kingston-20261120
shots_per_circuit
256
job_id
dc0g6kqnj2vs73ddvolg
counts
[
  {
    "010010000100000000000000000000000000": 250,
    "010110000100000000000000000000000000": 1,
    "010000000100000000000000000000000000": 2,
    "010010010100000000000000000000000000": 1,
    "000010000100000000000000000000000000": 1,
    "010010000000000000000000000000000000": 1
  }
]
metrics
{
  "caller": "qiskit",
  "qiskit_version": "qiskit_ibm_runtime-0.52.1,qiskit-2.6.2*,qiskit_aer-0.17.2*",
  "timestamps": {
    "created": "2026-11-21T02:34:59.781993Z",
    "finished": "2026-11-21T02:35:06.23029Z",
    "running": "2026-11-21T02:35:01.77096Z"
  },
  "usage": {
    "qpu_charge_time_seconds": 2,
    "value": 0.029478,
    "unit": "resource_units",
    "status": "complete",
    "details": [
      {
        "value": 0.029478,
        "unit": "resource_units",
        "metric": {
          "id": "caffe3ca-729c-5750-8777-df63bbf8bfd9",
          "value": 2
        }
      }
    ]
  },
  "circuits_execution_time_ns": 66604032
}
analysis
{
  "raw_byte_exact": 252,
  "decoded_byte_exact": 256,
  "rescued": 4,
  "lost": 0,
  "uncorrectable_flags": 0,
  "wrong_returned": 0,
  "received_words": {
    "010010000100": 250,
    "010110000100": 1,
    "010000000100": 2,
    "010010010100": 1,
    "000010000100": 1,
    "010010000000": 1
  },
  "codeword_bit_errors": {
    "0": 250,
    "1": 6
  }
}

Simulation & checks

Gap in the supplied files. No standalone simulator record was recovered for this job. The source and any verification described above remain available.

Source code

Original experiment and verification programs are preserved byte for byte. These are historical listings; dependencies, authentication prompts and machine-specific input paths may need adjustment before a rerun.

  • charlie_direct.pyQuantum Field Report.pdf / Experiment-source.zip · 3,644 bytes
  • charlie_direct.pyThrough the Noise Wall.pdf / Kingston measurements and source.zip · 3,644 bytes
field-report/outputs/charlie_direct.py · complete source
"""Prepare and measure the Hamming-coded A directly on the previous Charlie endpoints."""
import getpass
import logging
import sys
import traceback

from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime.fake_provider import FakeKingston

from charlie_ascii import HW as PREVIOUS
from graph156 import save
from hamming_ascii import VALUE, WIDTH, analyze, encode
from run_switch_puzzles import ROOT, SHOTS, execute, load

HW = ROOT / "Charlie-direct-A-Kingston.json"
STATUS = ROOT.parent / "work" / "charlie-direct-status.json"
TAG = "charlie-direct-hamming-a-kingston-20261120"


def circuit():
    # Use the same bit positions as the earlier receiver for an identical decoder.
    q = QuantumCircuit(WIDTH, 3 * WIDTH, name="direct_Charlie")
    for i in range(WIDTH):
        if (encode(VALUE) >> i) & 1:
            q.x(i)
    q.measure(range(WIDTH), range(2 * WIDTH, 3 * WIDTH))
    return q


def endpoints():
    return [p[-1] for p in load(PREVIOUS)["paths_by_hamming_position"]]


def compile_direct(backend):
    layout = endpoints()
    assert len(set(layout)) == WIDTH
    q = transpile(circuit(), backend, initial_layout=layout, routing_method="none", optimization_level=0)
    backend.check_faulty(q)
    measured = {}
    flipped = []
    for inst in q.data:
        wire, = inst.qubits
        physical = q.find_bit(wire).index
        if inst.operation.name == "measure":
            measured[q.find_bit(inst.clbits[0]).index] = physical
        else:
            assert inst.operation.name == "x"
            flipped.append(physical)
    assert measured == {2 * WIDTH+i: wire for i, wire in enumerate(layout)}
    assert sorted(flipped) == sorted(wire for i, wire in enumerate(layout) if (encode(VALUE) >> i) & 1)
    return q


def simulate():
    counts = AerSimulator().run(circuit(), shots=SHOTS).result().get_counts()
    assert analyze(counts)["decoded_byte_exact"] == SHOTS
    assert list(counts) == [format(encode(VALUE) << (2 * WIDTH), "036b")]
    print(dict(compile_direct(FakeKingston()).count_ops()), endpoints())


def hardware():
    record = load(HW)
    if record.get("analysis"):
        return
    save(STATUS, {"stage": "waiting for key"})
    key = getpass.getpass("IBM Cloud API key for the Charlie direct control (hidden): ").strip()
    if not key:
        save(STATUS, {"stage": "cancelled"})
        return
    save(STATUS, {"stage": "connecting"})
    service = QiskitRuntimeService(channel="ibm_quantum_platform", token=key, plans_preference=["open"], region="us-east")
    backend = service.backend("ibm_kingston")
    circuits = []
    if not record:
        q = compile_direct(backend)
        circuits.append(q)
        record = dict(backend=backend.name, previous_job=load(PREVIOUS)["job_id"],
                      endpoints_by_hamming_position=endpoints(), native_counts=dict(q.count_ops()),
                      input_codeword=format(encode(VALUE), "012b"))
    record = execute(service, backend, HW, TAG, record, lambda: circuits)
    record["analysis"] = analyze(record["counts"][0])
    save(HW, record)
    save(STATUS, {"stage": "finished"})


if __name__ == "__main__":
    if sys.argv[1:] == ["simulate"]:
        simulate()
    elif sys.argv[1:] == ["hardware"]:
        logging.disable(logging.CRITICAL)
        try:
            hardware()
        except Exception as exc:
            save(STATUS, {"stage": "error", "type": type(exc).__name__,
                          "frames": [f.name for f in traceback.extract_tb(exc.__traceback__)]})
            print(type(exc).__name__)
noise-wall/source/charlie_direct.py · complete source
"""Prepare and measure the Hamming-coded A directly on the previous Charlie endpoints."""
import getpass
import logging
import sys
import traceback

from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime.fake_provider import FakeKingston

from charlie_ascii import HW as PREVIOUS
from graph156 import save
from hamming_ascii import VALUE, WIDTH, analyze, encode
from run_switch_puzzles import ROOT, SHOTS, execute, load

HW = ROOT / "Charlie-direct-A-Kingston.json"
STATUS = ROOT.parent / "work" / "charlie-direct-status.json"
TAG = "charlie-direct-hamming-a-kingston-20261120"


def circuit():
    # Use the same bit positions as the earlier receiver for an identical decoder.
    q = QuantumCircuit(WIDTH, 3 * WIDTH, name="direct_Charlie")
    for i in range(WIDTH):
        if (encode(VALUE) >> i) & 1:
            q.x(i)
    q.measure(range(WIDTH), range(2 * WIDTH, 3 * WIDTH))
    return q


def endpoints():
    return [p[-1] for p in load(PREVIOUS)["paths_by_hamming_position"]]


def compile_direct(backend):
    layout = endpoints()
    assert len(set(layout)) == WIDTH
    q = transpile(circuit(), backend, initial_layout=layout, routing_method="none", optimization_level=0)
    backend.check_faulty(q)
    measured = {}
    flipped = []
    for inst in q.data:
        wire, = inst.qubits
        physical = q.find_bit(wire).index
        if inst.operation.name == "measure":
            measured[q.find_bit(inst.clbits[0]).index] = physical
        else:
            assert inst.operation.name == "x"
            flipped.append(physical)
    assert measured == {2 * WIDTH+i: wire for i, wire in enumerate(layout)}
    assert sorted(flipped) == sorted(wire for i, wire in enumerate(layout) if (encode(VALUE) >> i) & 1)
    return q


def simulate():
    counts = AerSimulator().run(circuit(), shots=SHOTS).result().get_counts()
    assert analyze(counts)["decoded_byte_exact"] == SHOTS
    assert list(counts) == [format(encode(VALUE) << (2 * WIDTH), "036b")]
    print(dict(compile_direct(FakeKingston()).count_ops()), endpoints())


def hardware():
    record = load(HW)
    if record.get("analysis"):
        return
    save(STATUS, {"stage": "waiting for key"})
    key = getpass.getpass("IBM Cloud API key for the Charlie direct control (hidden): ").strip()
    if not key:
        save(STATUS, {"stage": "cancelled"})
        return
    save(STATUS, {"stage": "connecting"})
    service = QiskitRuntimeService(channel="ibm_quantum_platform", token=key, plans_preference=["open"], region="us-east")
    backend = service.backend("ibm_kingston")
    circuits = []
    if not record:
        q = compile_direct(backend)
        circuits.append(q)
        record = dict(backend=backend.name, previous_job=load(PREVIOUS)["job_id"],
                      endpoints_by_hamming_position=endpoints(), native_counts=dict(q.count_ops()),
                      input_codeword=format(encode(VALUE), "012b"))
    record = execute(service, backend, HW, TAG, record, lambda: circuits)
    record["analysis"] = analyze(record["counts"][0])
    save(HW, record)
    save(STATUS, {"stage": "finished"})


if __name__ == "__main__":
    if sys.argv[1:] == ["simulate"]:
        simulate()
    elif sys.argv[1:] == ["hardware"]:
        logging.disable(logging.CRITICAL)
        try:
            hardware()
        except Exception as exc:
            save(STATUS, {"stage": "error", "type": type(exc).__name__,
                          "frames": [f.name for f in traceback.extract_tb(exc.__traceback__)]})
            print(type(exc).__name__)

Personal comments

Personal comments will be added here.