algenta-serialization
Serialization and data-format kernels. Compiled Mojo, loaded in-process.
17 modules · 138 functions · CPU
Get started
pip install kernels torch
from kernels import get_kernel
kernel = get_kernel(
"thyn-ai/algenta-serialization",
version=1,
backend="cpu",
trust_remote_code=["thyn-ai/algenta-serialization"],
)
kernel.compression.delta.delta_encode([1, 4, 9, 16, 25]) # -> [1, 3, 5, 7, 9] first value, then differences
backend="cpu" selects the CPU build. On a Mac the loader otherwise looks for a Metal build, which
this family does not ship. trust_remote_code names the repositories you allow; Hugging Face's
trusted publishers load without it.
Plain Python in, plain Python out. Lists, tuples, buffers and tensors are accepted wherever the
contract expects a list; structured results are dictionaries. Some functions take a list and the
number of elements to use from it, which may not exceed the list's length; multi-dimensional data is
passed flattened, row-major, with its dimensions. Functions that update an argument do so in place,
as help() says. Every call is checked against the published contract before it reaches native
code. An invalid call raises KernelError with a stable code, never a crash. Engine kernels
report shape and finiteness problems as a status; the wrapper raises KernelError named after it.
Any function can also be called by name, with args as a list or a dict of parameter names:
kernel.execute("compression.delta", "compression_savings", [...])
What's inside
| Module | Functions | What it does |
|---|---|---|
compression.delta |
11 | Delta coding of integer and float sequences: plain, XOR, zigzag and double delta, savings ratio |
compression.huffman |
6 | Huffman coding: byte frequency counts, tree building, code lengths, bit encoding and decoding |
compression.lz77 |
6 | LZ77 sliding-window compression: longest-match search, token encoding and decoding, ratio |
compression.rle |
5 | Run-length encoding of byte arrays and strings, with decoding and compression ratio |
data.csv_parser |
4 | RFC 4180 CSV parsing: quoted fields and escaped quotes, typed field access, CSV to JSON array |
data_feedback_loop |
10 | Retraining-loop heuristics: sample informativeness, drift z-score, freshness decay, A/B z-stat |
data_pipeline |
10 | Training-data heuristics: packing efficiency, MinHash band match, curriculum score, DoReMi mix |
data_quality.contract |
18 | Data-quality helpers: status names, bit-pattern float equality, tolerances, decimal grid, masks |
data_quality.duplicates |
4 | Duplicate rows: hash grouping on chosen key columns, by exact bits or a set number of decimals |
data_quality.expect |
6 | Column expectations: greater, less, equal, between, not-null, finite, reported per failing row |
data_quality.leakage |
3 | Target leakage: exact copy, affine relation, high Pearson correlation, missingness, timestamps |
data_quality.profile |
5 | Column census: null, NaN, infinite, zero, sign and distinct counts, mean, min, max, constants |
json.parser |
15 | JSON field extraction from raw text without a DOM: keys, nested objects, arrays, base64 bytes |
json.writer |
12 | JSON building: escaped strings, integer, float, boolean, null, array fields, objects from pairs |
model_serialization |
10 | Model sizing: checkpoint bytes, LoRA parameters, forward FLOPs, sparsity, pruning speedup |
serialization.msgpack |
10 | MessagePack: encode scalars, nil, array and map headers; decode integers, floats and strings |
serialization_io |
3 | Bit-exact text serialization of named float arrays, strict parsing back, FNV-1a checksum |
kernel.CONTRACT holds every signature, including the length rules for list arguments;
help(kernel.data_feedback_loop) documents each function.
Not included
compression.huffman.generate_codes— allocates from a frequency table whose size it trusts; an ill-formed table is not expressible as a length rule.
Requirements
- Apple silicon: macOS 15 or later for the CPU build.
- Linux arm64 and x86-64, glibc 2.35 or later.
kernels0.17 or later and PyTorch 2.5 to 2.14. PyTorch has to be installed: the loader picks the build for your PyTorch version. The kernel itself never imports it.
Windows is not supported.
Notes
Calls into one kernel instance run one at a time; use processes for parallelism. Runtime state
does not survive fork(); start worker processes with spawn.
License
Algenta Community License 1.0 (LICENSE). Free for personal, research and open-source use, and
for internal use at organizations with fewer than 50 employees and under $5M in annual revenue.
Beyond that, a commercial license is required: licensing@algenta.ai.
Enforced in the compiled library, not just in this text: one concurrent native worker per device (ABI §9). A second process, family or thread waits its turn rather than running in parallel. That is the Community licence's worker floor made real; parallel execution comes with a commercial license.
- Downloads last month
- -
- Torch
- 2.14
- OS
- macoslinux
- Arch
- x86_64aarch64