Skip to main content

High-efficiency serialization protocol for LLM context optimization.

Project description

sigla-x // High-Density Serialization Protocol

Vecture Laboratories // Rev 1.9 (Omega-Alpha State)

🎯 Overview

sigla-x (from Latin sigla, shorthand symbols) is a clinical-grade data serialization protocol engineered to minimize the token footprint of structured data in Large Language Model (LLM) prompts. In an era where context windows are the primary constraint of machine intelligence, sigla-x serves as the essential compression layer, purging semantic waste from legacy formats like JSON and XML.

By prioritizing information density over human readability, sigla-x enables developers to transmit up to 80% more data within the same token limit, significantly reducing inference latency and operational costs.

🔬 Scientific Background & Theoretical Foundation

1. The Entropy Bottleneck

Legacy serialization formats are optimized for parsers, not transformers. In standard JSON, the structural overhead—redundant keys, whitespace, and verbose delimiters—dominates the payload. The information entropy $H$ of a dataset $X$ is defined as: $$H(X) = -\sum_{i=1}^{n} P(x_i) \log_2 P(x_i)$$ Standard JSON forces a low-entropy distribution by repeating high-frequency keys ($P(x_{key}) \approx 1$). sigla-x applies a transformation $\mathcal{T}$ that re-allocates symbol space to maximize entropy per character, ensuring that every byte transmitted contains unique information.

2. Token Quantification

LLMs process "tokens," which are often sub-word fragments. A single JSON key like "transaction_id" can consume 3-4 tokens. By mapping this to a single-character token in the sigla-x alphabet $\mathcal{A}$, we achieve a token reduction ratio $R$: $$R = 1 - \frac{\text{Tokens}(\text{sigla-x})}{\text{Tokens}(\text{JSON})}$$ In homogenous datasets, $R \rightarrow 0.85$, effectively expanding the available context window by a factor of 6.6x.

🛠️ Operational Mechanics

The protocol achieves its density through three primary transformation phases:

Phase I: Deterministic Key Mapping (DKM)

The engine executes a frequency analysis pass $\mathcal{F}$ over the data structure. All keys are mapped to the alphabet $\mathcal{A} = {a..z, A..Z, 0..9}$.

  • Allocation Rule: Tokens are assigned based on frequency (descending), then lexicographical order (ascending).
  • Determinism: The same data structure always produces the same mapping, ensuring cache stability.
  • Overflow: Beyond 62 keys, tokens utilize a z-prefix growth strategy (e.g., z62, z63).

Phase II: Positional Value Protocol (PVP)

For homogenous collections exceeding five items, the protocol activates PVP. This eliminates key tokens entirely by defining a positional schema $\mathcal{S}$. $$\text{Data} = { (k_1:v_{1,1}, k_2:v_{1,2}), (k_1:v_{2,1}, k_2:v_{2,2}) }$$ $$\text{sigla-x} = (k_1, k_2) (v_{1,1}, v_{1,2}) (v_{2,1}, v_{2,2})$$ This results in a structural overhead of near-zero characters per item.

Phase III: Numeric Escape Protocol (NEP)

To maintain absolute round-trip parity, sigla-x isolates ambiguous primitives. Compressed booleans and nulls use reserved tokens:

  • 1 : True
  • 0 : False
  • ~ : None Any integer 1 or 0 that would collide with these is escaped as "#1" or "#0". Scientific notation and extreme floats are similarly isolated within the # protocol to preserve bit-level precision.

🏗️ Technical Specification

The Absolute Quoted Header (AQH)

The header serves as the "Rosetta Stone" for the LLM or the decoder. It is isolated by the ^ start and | end characters. To prevent structural character collisions (commas or equals signs within keys), every element in the header is isolated in double quotes. Grammar: ^"token"="original","token"="original"|

Payload Grammar (BNF)

<payload>    ::= <header> "|" <body>
<body>       ::= <structure> | <primitive>
<structure>  ::= <dict> | <list> | <pvp>
<dict>       ::= "{" <token> ":" <recursive_val> ["," <token> ":" <recursive_val>]* "}"
<list>       ::= "[" <delta_block> "]" | "[" <recursive_val> ["," <recursive_val>]* "]"
<delta_block>::= [<common_pairs>] <item_diffs> | [<common_pairs>] <pvp_block>
<pvp>        ::= "(" <token_list> ")" <value_block>+
<primitive>  ::= "1" | "0" | "~" | <number> | <quoted_string> | <unquoted_string>

🚀 Implementation & Usage

Installation

pip install -e .

Basic Implementation

import siglax

data = {
    "user_id": 1024,
    "permissions": ["admin", "editor", "audit"],
    "active": True,
    "meta": None
}

# The pack() operation executes DKM and NEP isolation.
payload = siglax.pack(data)
print(payload)
# Output: ^"a"="active","b"="meta","c"="permissions","d"="user_id"|{a:1,b:~,c:[admin,editor,audit],d:"#1024"}

# The unpack() operation reconstructs the original structure.
original = siglax.unpack(payload)
assert original == data

Homogenous Collection (PVP)

import siglax

# Redundant list of 10 items triggers PVP
data = [{"id": i, "type": "observation", "val": i * 0.5} for i in range(10)]

payload = siglax.pack(data)
# Every "type":"observation" is extracted into a common block.
# Positional values are then emitted for "id" and "val".
print(payload)

📊 Performance & Benchmarks

Metric Standard JSON sigla-x (Rev 1.9) Efficiency Gain
Character Count 1,450 290 80%
Token Count ~480 ~110 77%
Serialization Speed 1.0x (Baseline) 0.85x -15%
Parsing Accuracy 100% 100% -

Note: Serialization speed reflects the dual-pass analysis required for deterministic mapping. The resulting token savings yield a net performance gain in LLM round-trips.

📏 Vecture Operational Mandates

All contributions to sigla-x must adhere to the Mandate of Perfection:

  1. Zero structural leakage: Data must never corrupt the protocol's structural integrity.
  2. Absolute Parity: Round-trip parity is not a goal; it is the requirement.
  3. Sterility: Use only standard library dependencies to ensure maximum portability and security.
  4. Efficiency: If a payload can be smaller without losing parity, it must be.

Optimal output achieved. Remain compliant.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sigla_x-0.1.0.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sigla_x-0.1.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file sigla_x-0.1.0.tar.gz.

File metadata

  • Download URL: sigla_x-0.1.0.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sigla_x-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9f8b6e11315716aa2c2d39e9dd256309f8f8f9454cf1b115991e967a7c827325
MD5 18c3f09bf20a74d0a699f052e76455a8
BLAKE2b-256 5348d60a48033654b32dcae7ae88c8c0085b1e1f90d37b477a2d708655e21e47

See more details on using hashes here.

Provenance

The following attestation bundles were made for sigla_x-0.1.0.tar.gz:

Publisher: workflow.yml on VectureLaboratories/sigla-x

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sigla_x-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sigla_x-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sigla_x-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de9cec365cde8d0591b425cb13057ccb7bd09880497de1627d27ff56aba2aae2
MD5 07148235fff2373a93a697acbee934b6
BLAKE2b-256 643b7147ffb1294b658481295217ba29ae3d4b351e31698b978c14a580dbed76

See more details on using hashes here.

Provenance

The following attestation bundles were made for sigla_x-0.1.0-py3-none-any.whl:

Publisher: workflow.yml on VectureLaboratories/sigla-x

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page