DEV Community

Cover image for QH256 in C — A Deterministic 256-Bit State Structure for K501-AIONARC
Iinkognit0
Iinkognit0

Posted on

QH256 in C — A Deterministic 256-Bit State Structure for K501-AIONARC

QH256 in C — A Deterministic 256-Bit State Structure for K501-AIONARC

A small, deterministic C reference implementation of QH256 for the K501-AIONARC information architecture.

This article has a simple purpose:

Make the QH256 structure understandable, executable, testable, and reproducible by both humans and machine systems.

The implementation does not introduce a new interpretation of QH256.

It does not connect QH256 to embeddings.

It does not redefine the four QH256 states.

It does not introduce hidden semantic meaning.

It implements the already defined structural model:

128 cells
×
2 bits per cell
=
256 bits
=
32 bytes
Enter fullscreen mode Exit fullscreen mode

The canonical cell states are:

UNKNOWN = 00
FALSE   = 01
TRUE    = 10
GUARD   = 11
Enter fullscreen mode Exit fullscreen mode

The central K501 principle remains:

structure != semantics
Enter fullscreen mode Exit fullscreen mode

QH256 is therefore implemented here as a deterministic structural state space.


0. K501 Canonical Header

SYSTEM:        K501-AIONARC
NAMESPACE:     K501-Aionarc
DOCUMENT:      QH256 C Reference Implementation
LANGUAGE:      C11
STATUS:        CANONICAL STRUCTURE / REFERENCE IMPLEMENTATION
MODE:          DETERMINISTIC / APPEND-ONLY / NO-DRIFT
AUTHOR:        Patrick R. Miller (Iinkognit0)
ORCID:         0009-0005-5125-9711

TIME ANCHOR:
Unix Epoch:    1786954613
UTC:           2026-08-17 08:16:53 UTC
Europe/Berlin: 2026-08-17 10:16:53 CEST

QH256:
128 cells
2 bits per cell
256 bits
32 bytes

STATE ALPHABET:
UNKNOWN = 00
FALSE   = 01
TRUE    = 10
GUARD   = 11
Enter fullscreen mode Exit fullscreen mode

1. What is QH256?

QH256 is a fixed 256-bit structure consisting of exactly 128 cells.

Each cell contains exactly 2 bits.

Therefore:

128 × 2 = 256 bits
Enter fullscreen mode Exit fullscreen mode

or:

256 / 8 = 32 bytes
Enter fullscreen mode Exit fullscreen mode

Each cell has exactly one of four possible bit patterns:

00
01
10
11
Enter fullscreen mode Exit fullscreen mode

K501 assigns the following canonical structural states:

Bits State
00 UNKNOWN
01 FALSE
10 TRUE
11 GUARD

This produces the state alphabet:

Σ = { UNKNOWN, FALSE, TRUE, GUARD }
Enter fullscreen mode Exit fullscreen mode

and:

QH256 ∈ Σ^128
Enter fullscreen mode Exit fullscreen mode

The corresponding binary representation is:

QH256 ≅ B^256
Enter fullscreen mode Exit fullscreen mode

where:

B = {0,1}
Enter fullscreen mode Exit fullscreen mode

The complete theoretical state space therefore contains:

4^128 = 2^256
Enter fullscreen mode Exit fullscreen mode

possible configurations.

This article does not attempt to enumerate those configurations.

It defines the representation and demonstrates that the structure can be implemented deterministically.


2. Semantic Separation

A critical K501 rule is that the four QH256 states must not be silently reinterpreted.

For example:

UNKNOWN ≠ low embedding value
FALSE   ≠ negative embedding value
TRUE    ≠ positive embedding value
GUARD   ≠ quantization level
Enter fullscreen mode Exit fullscreen mode

Likewise:

QH256 != embedding
QH256 != binary embedding
QH256 != vector quantizer
QH256 != GPU storage format
Enter fullscreen mode Exit fullscreen mode

These are distinct layers.

A future system may use QH256 to describe the structural state of another artifact.

That would be an additional application specification.

It is not implicitly created by this C implementation.


3. Physical Memory Layout

The implementation stores QH256 as:

typedef struct qh256 {
    uint8_t bytes[32];
} qh256_t;
Enter fullscreen mode Exit fullscreen mode

The physical structure is:

QH256
│
├── 32 bytes
│
├── 128 cells
│
└── 4 cells per byte
Enter fullscreen mode Exit fullscreen mode

Each byte contains four 2-bit cells.

The mapping is deterministic:

cell 0  -> byte 0, bits 0..1
cell 1  -> byte 0, bits 2..3
cell 2  -> byte 0, bits 4..5
cell 3  -> byte 0, bits 6..7

cell 4  -> byte 1, bits 0..1

...

cell 127 -> byte 31, bits 6..7
Enter fullscreen mode Exit fullscreen mode

The implementation therefore does not depend on compiler-specific bit fields.

That is intentional.

Explicit byte and bit operations make serialization easier to reconstruct across different systems.


4. Project Structure

The complete reference implementation consists of three files:

qh256/
├── qh256.h
├── qh256.c
└── test_qh256.c
Enter fullscreen mode Exit fullscreen mode

The responsibilities are deliberately separated.

qh256.h

Defines the public structure and interface.

qh256.c

Contains the implementation.

test_qh256.c

Contains deterministic validation tests.


5. qh256.h

#ifndef K501_QH256_H
#define K501_QH256_H

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

/*
 * K501 QH256
 *
 * 128 cells × 2 bits = 256 bits = 32 bytes.
 *
 * Canonical states:
 *
 * UNKNOWN = 00
 * FALSE   = 01
 * TRUE    = 10
 * GUARD   = 11
 *
 * This implementation treats QH256 exclusively
 * as the defined structural state space.
 *
 * No embedding semantics.
 * No quantization semantics.
 */

#define QH256_CELL_COUNT       128u
#define QH256_BITS             256u
#define QH256_BYTES            32u
#define QH256_CELLS_PER_BYTE   4u
#define QH256_CELL_MASK        0x03u

typedef enum qh256_state {
    QH256_UNKNOWN = 0u, /* 00 */
    QH256_FALSE   = 1u, /* 01 */
    QH256_TRUE    = 2u, /* 10 */
    QH256_GUARD   = 3u  /* 11 */
} qh256_state_t;


/*
 * Exact physical structure:
 *
 * 32 bytes = 256 bits
 * 4 cells per byte
 * 2 bits per cell
 */

typedef struct qh256 {
    uint8_t bytes[QH256_BYTES];
} qh256_t;


/* ============================================================
 * Construction / Reset
 * ============================================================ */

void qh256_clear(qh256_t *q);

void qh256_fill(
    qh256_t *q,
    qh256_state_t state
);


/* ============================================================
 * Cell access
 * ============================================================ */

bool qh256_set(
    qh256_t *q,
    size_t cell_index,
    qh256_state_t state
);

bool qh256_get(
    const qh256_t *q,
    size_t cell_index,
    qh256_state_t *out_state
);


/* ============================================================
 * Validation / Comparison
 * ============================================================ */

bool qh256_state_valid(
    qh256_state_t state
);

bool qh256_is_valid(
    const qh256_t *q
);

bool qh256_equal(
    const qh256_t *a,
    const qh256_t *b
);


/* ============================================================
 * Byte representation
 * ============================================================ */

bool qh256_from_bytes(
    qh256_t *q,
    const uint8_t bytes[QH256_BYTES]
);

void qh256_to_bytes(
    const qh256_t *q,
    uint8_t bytes[QH256_BYTES]
);


/* ============================================================
 * State counting
 * ============================================================ */

void qh256_count_states(
    const qh256_t *q,
    size_t *unknown,
    size_t *false_count,
    size_t *true_count,
    size_t *guard
);


/* ============================================================
 * Deterministic text representation
 *
 * Caller requires at least 257 bytes:
 * 256 characters + '\0'
 * ============================================================ */

void qh256_to_bitstring(
    const qh256_t *q,
    char out[257]
);


/* ============================================================
 * Structural checksum
 *
 * FNV-1a 64-bit.
 *
 * Not cryptographic.
 * Only a deterministic structural checksum.
 * ============================================================ */

uint64_t qh256_fnv1a64(
    const qh256_t *q
);


#ifdef __cplusplus
}
#endif

#endif /* K501_QH256_H */
Enter fullscreen mode Exit fullscreen mode

6. qh256.c

#include "qh256.h"

#include <assert.h>
#include <string.h>


#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L

_Static_assert(
    QH256_CELL_COUNT == 128u,
    "QH256 must contain exactly 128 cells"
);

_Static_assert(
    QH256_BITS == 256u,
    "QH256 must contain exactly 256 bits"
);

_Static_assert(
    QH256_BYTES == 32u,
    "QH256 must occupy exactly 32 bytes"
);

_Static_assert(
    sizeof(qh256_t) == QH256_BYTES,
    "Unexpected qh256_t size"
);

#endif


/* ============================================================
 * Internal cell addressing
 * ============================================================ */

/*
 * 1 byte = 8 bits
 * 1 cell = 2 bits
 *
 * Therefore:
 *
 * 4 cells / byte
 *
 * cell 0 -> byte 0, bits 0..1
 * cell 1 -> byte 0, bits 2..3
 * cell 2 -> byte 0, bits 4..5
 * cell 3 -> byte 0, bits 6..7
 *
 * cell 4 -> byte 1, bits 0..1
 *
 * ...
 */

static inline size_t
cell_byte_index(size_t cell_index)
{
    return cell_index >> 2;
}


static inline unsigned
cell_shift(size_t cell_index)
{
    return (unsigned)((cell_index & 3u) << 1);
}


/* ============================================================
 * State validation
 * ============================================================ */

bool
qh256_state_valid(qh256_state_t state)
{
    /*
     * All four 2-bit combinations are valid QH256 states.
     */

    return ((unsigned)state & ~3u) == 0u;
}


/* ============================================================
 * Clear QH256
 * ============================================================ */

void
qh256_clear(qh256_t *q)
{
    assert(q != NULL);

    memset(
        q->bytes,
        0,
        sizeof(q->bytes)
    );
}


/* ============================================================
 * Fill complete QH256 with one state
 * ============================================================ */

void
qh256_fill(
    qh256_t *q,
    qh256_state_t state
)
{
    uint8_t packed;

    assert(q != NULL);
    assert(qh256_state_valid(state));

    /*
     * Copy the 2-bit state into all four
     * 2-bit fields of a byte.
     */

    packed = (uint8_t)(
          (unsigned)state
        | ((unsigned)state << 2)
        | ((unsigned)state << 4)
        | ((unsigned)state << 6)
    );

    memset(
        q->bytes,
        packed,
        sizeof(q->bytes)
    );
}


/* ============================================================
 * Set single cell
 * ============================================================ */

bool
qh256_set(
    qh256_t *q,
    size_t cell_index,
    qh256_state_t state
)
{
    size_t byte_index;
    unsigned shift;
    uint8_t mask;

    if (q == NULL) {
        return false;
    }

    if (cell_index >= QH256_CELL_COUNT) {
        return false;
    }

    if (!qh256_state_valid(state)) {
        return false;
    }

    byte_index = cell_byte_index(cell_index);
    shift = cell_shift(cell_index);

    mask = (uint8_t)(
        QH256_CELL_MASK << shift
    );

    /*
     * Clear existing 2-bit field.
     */

    q->bytes[byte_index] =
        (uint8_t)(
            q->bytes[byte_index]
            & (uint8_t)~mask
        );

    /*
     * Insert new state.
     */

    q->bytes[byte_index] =
        (uint8_t)(
            q->bytes[byte_index]
            | ((uint8_t)state << shift)
        );

    return true;
}


/* ============================================================
 * Get single cell
 * ============================================================ */

bool
qh256_get(
    const qh256_t *q,
    size_t cell_index,
    qh256_state_t *out_state
)
{
    size_t byte_index;
    unsigned shift;

    if (q == NULL) {
        return false;
    }

    if (out_state == NULL) {
        return false;
    }

    if (cell_index >= QH256_CELL_COUNT) {
        return false;
    }

    byte_index = cell_byte_index(cell_index);
    shift = cell_shift(cell_index);

    *out_state =
        (qh256_state_t)(
            (q->bytes[byte_index] >> shift)
            & QH256_CELL_MASK
        );

    return true;
}


/* ============================================================
 * Structural QH256 validation
 * ============================================================ */

bool
qh256_is_valid(const qh256_t *q)
{
    /*
     * Every 2-bit combination is one of the
     * four defined QH256 states.
     *
     * Therefore no invalid bit pattern exists
     * inside the 256-bit storage structure.
     */

    return q != NULL;
}


/* ============================================================
 * Compare QH256
 * ============================================================ */

bool
qh256_equal(
    const qh256_t *a,
    const qh256_t *b
)
{
    if (a == NULL || b == NULL) {
        return false;
    }

    return memcmp(
        a->bytes,
        b->bytes,
        QH256_BYTES
    ) == 0;
}


/* ============================================================
 * Create from bytes
 * ============================================================ */

bool
qh256_from_bytes(
    qh256_t *q,
    const uint8_t bytes[QH256_BYTES]
)
{
    if (q == NULL) {
        return false;
    }

    if (bytes == NULL) {
        return false;
    }

    memcpy(
        q->bytes,
        bytes,
        QH256_BYTES
    );

    return true;
}


/* ============================================================
 * Export to bytes
 * ============================================================ */

void
qh256_to_bytes(
    const qh256_t *q,
    uint8_t bytes[QH256_BYTES]
)
{
    assert(q != NULL);
    assert(bytes != NULL);

    memcpy(
        bytes,
        q->bytes,
        QH256_BYTES
    );
}


/* ============================================================
 * Count states
 * ============================================================ */

void
qh256_count_states(
    const qh256_t *q,
    size_t *unknown,
    size_t *false_count,
    size_t *true_count,
    size_t *guard
)
{
    size_t counts[4] = {
        0,
        0,
        0,
        0
    };

    size_t i;

    assert(q != NULL);

    for (i = 0; i < QH256_CELL_COUNT; ++i) {

        qh256_state_t state;

        bool ok =
            qh256_get(
                q,
                i,
                &state
            );

        assert(ok);

        counts[(unsigned)state]++;
    }

    if (unknown != NULL) {
        *unknown =
            counts[QH256_UNKNOWN];
    }

    if (false_count != NULL) {
        *false_count =
            counts[QH256_FALSE];
    }

    if (true_count != NULL) {
        *true_count =
            counts[QH256_TRUE];
    }

    if (guard != NULL) {
        *guard =
            counts[QH256_GUARD];
    }
}


/* ============================================================
 * Deterministic 256-bit representation
 * ============================================================ */

void
qh256_to_bitstring(
    const qh256_t *q,
    char out[257]
)
{
    static const char bits[4][3] = {
        "00",
        "01",
        "10",
        "11"
    };

    size_t i;

    assert(q != NULL);
    assert(out != NULL);

    for (i = 0; i < QH256_CELL_COUNT; ++i) {

        qh256_state_t state;

        bool ok =
            qh256_get(
                q,
                i,
                &state
            );

        assert(ok);

        out[(i * 2) + 0] =
            bits[(unsigned)state][0];

        out[(i * 2) + 1] =
            bits[(unsigned)state][1];
    }

    out[256] = '\0';
}


/* ============================================================
 * FNV-1a 64-bit
 *
 * Not cryptographic.
 * Only a deterministic structural checksum.
 * ============================================================ */

uint64_t
qh256_fnv1a64(const qh256_t *q)
{
    uint64_t hash =
        UINT64_C(14695981039346656037);

    size_t i;

    assert(q != NULL);

    for (i = 0; i < QH256_BYTES; ++i) {

        hash ^=
            (uint64_t)q->bytes[i];

        hash *=
            UINT64_C(1099511628211);
    }

    return hash;
}
Enter fullscreen mode Exit fullscreen mode

7. test_qh256.c

#include "qh256.h"

#include <assert.h>
#include <stdio.h>
#include <string.h>


/* ============================================================
 * Test: CLEAR
 * ============================================================ */

static void
test_clear(void)
{
    qh256_t q;
    size_t i;

    qh256_clear(&q);

    for (i = 0; i < QH256_BYTES; ++i) {
        assert(q.bytes[i] == 0x00u);
    }
}


/* ============================================================
 * Test: all 128 cells
 * ============================================================ */

static void
test_states(void)
{
    qh256_t q;
    qh256_state_t state;
    size_t i;

    qh256_clear(&q);

    for (i = 0; i < QH256_CELL_COUNT; ++i) {

        qh256_state_t expected =
            (qh256_state_t)(i & 3u);

        assert(
            qh256_set(
                &q,
                i,
                expected
            )
        );

        assert(
            qh256_get(
                &q,
                i,
                &state
            )
        );

        assert(
            state == expected
        );
    }
}


/* ============================================================
 * Test: FILL + state counting
 * ============================================================ */

static void
test_fill_and_count(void)
{
    qh256_t q;

    size_t unknown;
    size_t false_count;
    size_t true_count;
    size_t guard;


    qh256_fill(
        &q,
        QH256_UNKNOWN
    );

    qh256_count_states(
        &q,
        &unknown,
        &false_count,
        &true_count,
        &guard
    );

    assert(
        unknown == 128
        && false_count == 0
        && true_count == 0
        && guard == 0
    );


    qh256_fill(
        &q,
        QH256_FALSE
    );

    qh256_count_states(
        &q,
        &unknown,
        &false_count,
        &true_count,
        &guard
    );

    assert(
        unknown == 0
        && false_count == 128
        && true_count == 0
        && guard == 0
    );


    qh256_fill(
        &q,
        QH256_TRUE
    );

    qh256_count_states(
        &q,
        &unknown,
        &false_count,
        &true_count,
        &guard
    );

    assert(
        unknown == 0
        && false_count == 0
        && true_count == 128
        && guard == 0
    );


    qh256_fill(
        &q,
        QH256_GUARD
    );

    qh256_count_states(
        &q,
        &unknown,
        &false_count,
        &true_count,
        &guard
    );

    assert(
        unknown == 0
        && false_count == 0
        && true_count == 0
        && guard == 128
    );
}


/* ============================================================
 * Test: Byte representation
 * ============================================================ */

static void
test_serialization(void)
{
    qh256_t a;
    qh256_t b;

    uint8_t bytes[QH256_BYTES];


    qh256_clear(&a);


    /*
     * Byte 0:
     *
     * cell 0 = TRUE    = 10
     * cell 1 = FALSE   = 01
     * cell 2 = GUARD   = 11
     * cell 3 = UNKNOWN = 00
     *
     * Numeric byte value:
     *
     * 00 | 11<<4 | 01<<2 | 10
     *
     * = 0x36
     */

    assert(
        qh256_set(
            &a,
            0,
            QH256_TRUE
        )
    );

    assert(
        qh256_set(
            &a,
            1,
            QH256_FALSE
        )
    );

    assert(
        qh256_set(
            &a,
            2,
            QH256_GUARD
        )
    );

    assert(
        qh256_set(
            &a,
            3,
            QH256_UNKNOWN
        )
    );


    /*
     * Last cell:
     *
     * cell 127 = TRUE = 10
     *
     * Bits 6..7 of byte 31.
     */

    assert(
        qh256_set(
            &a,
            127,
            QH256_TRUE
        )
    );


    qh256_to_bytes(
        &a,
        bytes
    );


    assert(
        bytes[0] == 0x36u
    );


    assert(
        (bytes[31] & 0xC0u)
        == 0x80u
    );


    assert(
        qh256_from_bytes(
            &b,
            bytes
        )
    );


    assert(
        qh256_equal(
            &a,
            &b
        )
    );
}


/* ============================================================
 * Test: Bitstring
 * ============================================================ */

static void
test_bitstring(void)
{
    qh256_t q;
    char s[257];


    qh256_clear(&q);


    assert(
        qh256_set(
            &q,
            0,
            QH256_UNKNOWN
        )
    );

    assert(
        qh256_set(
            &q,
            1,
            QH256_FALSE
        )
    );

    assert(
        qh256_set(
            &q,
            2,
            QH256_TRUE
        )
    );

    assert(
        qh256_set(
            &q,
            3,
            QH256_GUARD
        )
    );


    qh256_to_bitstring(
        &q,
        s
    );


    assert(
        strlen(s) == 256u
    );


    assert(
        strncmp(
            s,
            "00011011",
            8
        ) == 0
    );
}


/* ============================================================
 * Main
 * ============================================================ */

int
main(void)
{
    test_clear();
    test_states();
    test_fill_and_count();
    test_serialization();
    test_bitstring();

    printf(
        "QH256 reference tests: PASS\n"
    );

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

8. Compilation

The implementation targets standard C11.

Compile it with:

gcc \
    -std=c11 \
    -O2 \
    -Wall \
    -Wextra \
    -Wpedantic \
    -Wconversion \
    -Wshadow \
    -Werror \
    qh256.c \
    test_qh256.c \
    -o test_qh256
Enter fullscreen mode Exit fullscreen mode

Run:

./test_qh256
Enter fullscreen mode Exit fullscreen mode

Expected result:

QH256 reference tests: PASS
Enter fullscreen mode Exit fullscreen mode

9. What the tests demonstrate

The reference test suite checks several properties.

First, the complete 256-bit structure can be cleared deterministically.

Second, all 128 cells can be addressed independently.

Third, all four canonical QH256 states can be stored and reconstructed.

Fourth, complete-state filling produces exactly 128 identical cells.

Fifth, byte serialization and deserialization are deterministic.

Sixth, the first and last cell positions are explicitly tested.

Seventh, the complete structure can be represented as a deterministic 256-character bit string.

The implementation therefore provides a small executable reference model rather than only a conceptual definition.


10. The Important Byte Example

Consider byte zero.

Its four cells are:

cell 0 = TRUE
cell 1 = FALSE
cell 2 = GUARD
cell 3 = UNKNOWN
Enter fullscreen mode Exit fullscreen mode

The corresponding 2-bit values are:

cell 0 = 10
cell 1 = 01
cell 2 = 11
cell 3 = 00
Enter fullscreen mode Exit fullscreen mode

The byte is stored as:

00 11 01 10
Enter fullscreen mode Exit fullscreen mode

which gives:

0x36
Enter fullscreen mode Exit fullscreen mode

This explicit example matters because reproducible binary formats require a defined packing order.

Without a defined order, two independently written implementations could produce different byte streams while both claiming to implement the same logical structure.

K501 therefore treats representation details as part of reproducibility.


11. Deterministic Reconstruction

The implementation is intentionally explicit.

A QH256 value can be reconstructed from:

32 bytes
Enter fullscreen mode Exit fullscreen mode

or from:

128 × 2-bit cells
Enter fullscreen mode Exit fullscreen mode

or from:

256 binary digits
Enter fullscreen mode Exit fullscreen mode

provided the defined ordering rules are preserved.

The structure therefore has multiple human- and machine-readable views while retaining one physical representation.

QH256
  │
  ├── 128 cells × 2 bit
  │
  ├── 32-byte binary representation
  │
  └── 256-character bit representation
Enter fullscreen mode Exit fullscreen mode

12. Structural Checksum

The implementation also contains an FNV-1a 64-bit function:

uint64_t qh256_fnv1a64(
    const qh256_t *q
);
Enter fullscreen mode Exit fullscreen mode

This is deliberately described as a structural checksum.

It is not a cryptographic identity mechanism.

The distinction is important.

FNV-1a
=
deterministic structural checksum

not

cryptographic proof
Enter fullscreen mode Exit fullscreen mode

The function can therefore be useful for local testing, debugging, and reproducibility checks without being mistaken for a cryptographic commitment.


13. Why this implementation is intentionally small

The implementation does not contain:

LLM code
Embedding code
GPU code
Vulkan code
CUDA code
Quantization code
Network code
Database code
Enter fullscreen mode Exit fullscreen mode

This is deliberate.

The QH256 reference should remain structurally isolated.

Its job is to define and demonstrate the 256-bit state object.

Additional layers can be built around it without modifying the core definition.

That preserves architectural continuity.


14. QH256 and Embedding Research

Recent K501 research also investigates highly compressed representations of 1024-dimensional embeddings.

A binary representation of a 1024-dimensional vector can contain:

1024 dimensions × 1 bit
=
1024 bits
=
4 × 256 bits
Enter fullscreen mode Exit fullscreen mode

This mathematical relation is useful for compute research.

However:

1024-bit vector code
≠ QH256 semantic object
Enter fullscreen mode Exit fullscreen mode

The four 256-bit blocks should therefore be treated as:

K501 Vector Block 256
Enter fullscreen mode Exit fullscreen mode

and not automatically as four QH256 objects.

The distinction is architectural:

QH256
=
canonical K501 state structure
Enter fullscreen mode Exit fullscreen mode

while:

Vector Block 256
=
technical 256-bit compute representation
Enter fullscreen mode Exit fullscreen mode

The shared width is a hardware and representation property.

It is not a semantic equivalence.


15. The K501 No-Drift Boundary

This separation can be expressed formally:

QH256 semantics
    remain fixed
         │
         │
         ▼
256-bit technical representations
    may be used independently
Enter fullscreen mode Exit fullscreen mode

Therefore:

QH256 state meanings
    are not quantization states
Enter fullscreen mode Exit fullscreen mode

and:

embedding quantization
    does not redefine QH256
Enter fullscreen mode Exit fullscreen mode

This is the important boundary for future compute research.


16. Possible Future Architecture

A later K501 system could contain:

Canonical Data
      │
      ├── QH256 structural state
      │
      └── Derived data
             │
             ├── Embeddings
             │
             ├── Quantized vectors
             │
             └── Vector Block 256
Enter fullscreen mode Exit fullscreen mode

The dependency direction should remain explicit.

The derived representation can always be regenerated from its canonical source.

That makes the derived index disposable.

Canonical
    ↓
Derived
    ↓
Compute Index
Enter fullscreen mode Exit fullscreen mode

not:

Compute Index
    ↓
Canonical Truth
Enter fullscreen mode Exit fullscreen mode

17. K501 Principles Preserved

This implementation is designed around several K501 principles:

DETERMINISTIC
APPEND-ONLY
NO-DRIFT
NO-INTERPRETATION
PROOF BEFORE STATE
CANONICAL DATA FIRST
DERIVED DATA SEPARATION
RECONSTRUCTABILITY
Enter fullscreen mode Exit fullscreen mode

The code does not attempt to make these principles mysterious.

They are reflected in the architecture:

fixed dimensions
explicit states
explicit packing
explicit serialization
explicit tests
explicit separation
Enter fullscreen mode Exit fullscreen mode

18. Machine-Readable Summary

For automated systems, the QH256 definition used by this implementation can be reduced to:

{
  "namespace": "K501-Aionarc",
  "object": "QH256",
  "status": "CANONICAL",
  "cells": 128,
  "bits_per_cell": 2,
  "total_bits": 256,
  "total_bytes": 32,
  "state_encoding": {
    "UNKNOWN": "00",
    "FALSE": "01",
    "TRUE": "10",
    "GUARD": "11"
  },
  "cells_per_byte": 4,
  "representation": "uint8_t[32]",
  "semantic_separation": true,
  "embedding_format": false,
  "quantization_format": false,
  "deterministic_serialization": true,
  "language": "C11"
}
Enter fullscreen mode Exit fullscreen mode

This is intentionally descriptive.

It does not attempt to encode undocumented semantics.


19. Reproducibility

A useful experiment with the implementation is simple.

Build the program on one machine.

Run the test suite.

Then build the same source with another conforming C11 compiler or on another architecture.

The expected structural result remains:

QH256 reference tests: PASS
Enter fullscreen mode Exit fullscreen mode

For stronger reproducibility, the compiled binary itself is not the canonical artifact.

The canonical artifact is the defined source representation plus its specification and test conditions.

This distinction matters because compiler versions, optimization levels, and target architectures can change binary executables even when the source-level structure is unchanged.


20. What this implementation does not claim

This implementation does not prove that QH256 is cryptographically collision-free.

It does not prove that QH256 is an embedding representation.

It does not prove that QH256 improves AI retrieval.

It does not define GPU acceleration.

It does not define Vulkan behavior.

It does not define a quantization standard.

It does not assign semantic truth to the four states.

Those questions belong to different specifications and experiments.


21. Current K501 Status

QH256 specification:
CANONICAL / UNCHANGED

C reference implementation:
REFERENCE IMPLEMENTATION

State encoding:
CANONICAL

Binary layout:
EXPLICIT

Serialization:
DEFINED

Test suite:
IMPLEMENTED

Embedding integration:
SEPARATE / DERIVED

Quantized vector integration:
EXPERIMENTAL

Vulkan compute:
NOT PART OF THIS IMPLEMENTATION

GPU performance:
NOT CLAIMED
Enter fullscreen mode Exit fullscreen mode

22. Why publish this?

A specification becomes more useful when other people can execute it.

The purpose of this publication is therefore not only documentation.

It is an invitation to test.

A developer should be able to:

read
↓
compile
↓
run
↓
inspect
↓
modify
↓
compare
Enter fullscreen mode Exit fullscreen mode

without requiring the author to be present.

An AI system should likewise be able to reconstruct the essential structure from the textual specification and source code:

128 cells
×
2 bits
=
256 bits
=
32 bytes
Enter fullscreen mode Exit fullscreen mode

with the exact state mapping:

00 UNKNOWN
01 FALSE
10 TRUE
11 GUARD
Enter fullscreen mode Exit fullscreen mode

and the defined byte layout.

That is the intended level of machine readability.


23. Invitation to Test QH256

The most useful response to this implementation is not agreement.

It is independent testing.

Try another compiler.

Try another architecture.

Inspect the generated bytes.

Rewrite the implementation in another language.

Implement the same packing rules independently.

Compare the resulting structures.

Attempt to find ambiguities.

Attempt to find contradictions.

Attempt to find edge cases.

If an implementation does not reproduce the defined structure, that is useful information.

In K501, a discovered error is preferable to an undocumented assumption.

The objective is not to protect the specification from criticism.

The objective is to make the structure sufficiently explicit that criticism becomes reproducible.


24. A Small Independent Test

A minimal external implementation only needs to reproduce the cell packing rule.

For example:

cell_index = 0
byte_index = 0
shift = 0

cell_index = 1
byte_index = 0
shift = 2

cell_index = 2
byte_index = 0
shift = 4

cell_index = 3
byte_index = 0
shift = 6
Enter fullscreen mode Exit fullscreen mode

Then continue with:

cell_index / 4
Enter fullscreen mode Exit fullscreen mode

for the byte index.

The 2-bit state is inserted at:

(cell_index % 4) × 2
Enter fullscreen mode Exit fullscreen mode

This provides a straightforward route for independently verifying the reference implementation.


25. Final Architectural Statement

The important result is not the C source itself.

The important result is the separation it preserves:

QH256
=
QH256
Enter fullscreen mode Exit fullscreen mode

A 256-bit technical block is simply:

256 bits
Enter fullscreen mode Exit fullscreen mode

An embedding is:

a vector representation
Enter fullscreen mode Exit fullscreen mode

A quantized embedding is:

a derived vector representation
Enter fullscreen mode Exit fullscreen mode

A Vulkan buffer is:

a compute representation
Enter fullscreen mode Exit fullscreen mode

These structures may share dimensions.

They do not therefore share semantics.

The K501 rule remains:

QH256 remains QH256. Embedding remains embedding. A 256-bit technical representation may be shared as a compute building block without redefining the canonical QH256 state space.

That separation is the basis for future K501-AIONARC experimentation with deterministic vector quantization, CPU reference computation, Vulkan compute, and reconstructable retrieval indexes.


References

Author

Patrick R. Miller (Iinkognit0)

K501-AIONARC

K501 Information Space / AIONARC

ORCID

https://orcid.org/0009-0005-5125-9711

Author GitHub

https://github.com/Iinkognit0

K501 GitHub

https://github.com/k501is

K501 Information Space / eArc

https://github.com/k501-Information-Space/eArc

Website

https://iinkognit0.de/

Dev.to

https://dev.to/k501is

Mastodon

https://mastodon.social/@K501

Zenodo

https://zenodo.org/records/18697454

YouTube

https://www.youtube.com/@Iinkognit0


License

Code

MIT License

Copyright (c) 2026 Patrick R. Miller (Iinkognit0)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, subject to the conditions of the MIT License.

The Software is provided "AS IS", without warranty of any kind.

Documentation

CC BY 4.0

Attribution:

Patrick R. Miller (Iinkognit0) — K501-AIONARC


K501 Time Anchor

Namespace:      K501-Aionarc

Unix Epoch:     1786954613

Time (UTC):
2026-08-17 08:16:53 UTC

Time (Europe/Berlin):
2026-08-17 10:16:53 CEST

Status:
REFERENCE IMPLEMENTATION

Mode:
DETERMINISTIC
APPEND-ONLY
NO-DRIFT
NO-INTERPRETATION
Enter fullscreen mode Exit fullscreen mode

K501 Declaration

QH256 = 128 × 2-bit cells = 256 bits.

UNKNOWN = 00
FALSE   = 01
TRUE    = 10
GUARD   = 11

QH256 remains structurally defined.

No semantic reinterpretation.
No silent extension.
No drift.

Structure precedes interpretation.
Proof before state.
Reconstruction before extension.
Enter fullscreen mode Exit fullscreen mode

K501-Aionarc

The structure is public. Test it. Reproduce it. Challenge it. Extend it without silently redefining it.

Top comments (0)