pllm
SDK
Operators

SiLU activation

Compile and evaluate PLLM's bounded experimental Q7 SiLU component.

PLLM documentationView Markdown ↗

PLLM implements one bounded SiLU primitive using numeric graph pllm.numeric.silu.quadratic_q7.v1. Compilation requires the explicit pllm/arithmetic-garbling-silu-q7/v1 nonlinear component and pllm/bounded-independent-elements/v1 protected scheduler. It encodes [-1, 1] at scale 128, evaluates x / 2 + x² / 4, rounds ties to even, and rejects inputs outside the locked domain. Across all 257 encoded inputs, absolute error against SiLU is at most 0.02285. One compiled Q7 SiLU region is capped at 128 elements in this initial bounded slice.

The protected implementation uses modulus 257 across the bounded Q7 input and output domains. Client wire encodings and evaluator gates remain separate. Evaluator material is serialized for transport within one process, registered when issued, bound to the compiled plan, and consumed once after exact payload authentication. This is an experimental reference component, not a complete Qwen execution profile, a cross-process replay protocol, or a production-security claim.

Python SDK example

from pathlib import Path

from pllm import lower_model
from pllm.nonlinear import ArithmeticGarblingSiluQ7
from pllm.schedulers import BoundedIndependentElementsProtectedTensorSchedule

fixture = Path("crates/pllm-models/tests/fixtures/mini-coder-4b-c87892d-config.json")
plan = lower_model(fixture.read_bytes(), batch=1, max_input_tokens=16, max_new_tokens=4)
silu = next(
    operation
    for operation in plan.prefill["operations"]
    if operation["operator"] == "silu"
)
assert silu["id"] == "layer.0.silu"
assert silu["output_shape"] == (1, 16, 9728)
assert ArithmeticGarblingSiluQ7().component == "pllm/arithmetic-garbling-silu-q7/v1"
assert BoundedIndependentElementsProtectedTensorSchedule(
    max_elements=128
).params["max_elements"] == 128

API: Python SDK objects and signatures

Run this example from a PLLM source checkout; package installations do not include the model-adapter test fixture. ModelPlan.prefill and its operation records are read-only mappings.

The semantic plan preserves SiLU as an explicit operator. A separately validated compile request can lower a bounded SiLU region to the internal native Q7 evaluator, but PLLM does not expose that evaluator through the stable Python runtime facade.

On this page

Loading documentation index…

Search runs locally in this browser.