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: True0: False~: None Any integer1or0that 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:
- Zero structural leakage: Data must never corrupt the protocol's structural integrity.
- Absolute Parity: Round-trip parity is not a goal; it is the requirement.
- Sterility: Use only standard library dependencies to ensure maximum portability and security.
- Efficiency: If a payload can be smaller without losing parity, it must be.
Optimal output achieved. Remain compliant.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f8b6e11315716aa2c2d39e9dd256309f8f8f9454cf1b115991e967a7c827325
|
|
| MD5 |
18c3f09bf20a74d0a699f052e76455a8
|
|
| BLAKE2b-256 |
5348d60a48033654b32dcae7ae88c8c0085b1e1f90d37b477a2d708655e21e47
|
Provenance
The following attestation bundles were made for sigla_x-0.1.0.tar.gz:
Publisher:
workflow.yml on VectureLaboratories/sigla-x
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sigla_x-0.1.0.tar.gz -
Subject digest:
9f8b6e11315716aa2c2d39e9dd256309f8f8f9454cf1b115991e967a7c827325 - Sigstore transparency entry: 910530433
- Sigstore integration time:
-
Permalink:
VectureLaboratories/sigla-x@683ba54ae1e6af1e0451e95fd1bd9ec5a4e17c31 -
Branch / Tag:
refs/tags/v1.9.0 - Owner: https://github.com/VectureLaboratories
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@683ba54ae1e6af1e0451e95fd1bd9ec5a4e17c31 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de9cec365cde8d0591b425cb13057ccb7bd09880497de1627d27ff56aba2aae2
|
|
| MD5 |
07148235fff2373a93a697acbee934b6
|
|
| BLAKE2b-256 |
643b7147ffb1294b658481295217ba29ae3d4b351e31698b978c14a580dbed76
|
Provenance
The following attestation bundles were made for sigla_x-0.1.0-py3-none-any.whl:
Publisher:
workflow.yml on VectureLaboratories/sigla-x
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sigla_x-0.1.0-py3-none-any.whl -
Subject digest:
de9cec365cde8d0591b425cb13057ccb7bd09880497de1627d27ff56aba2aae2 - Sigstore transparency entry: 910530436
- Sigstore integration time:
-
Permalink:
VectureLaboratories/sigla-x@683ba54ae1e6af1e0451e95fd1bd9ec5a4e17c31 -
Branch / Tag:
refs/tags/v1.9.0 - Owner: https://github.com/VectureLaboratories
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@683ba54ae1e6af1e0451e95fd1bd9ec5a4e17c31 -
Trigger Event:
push
-
Statement type: