Qwen3.5-signed-input-demo

The project is called secproc. The model in this repository is called rv-tiny. It holds only the CPU circuit, and it has no text model.

A demonstration, not a chat model. This GGUF file (the model file format that llama.cpp reads) holds a model in the Qwen3.5 format. The weights of the model contain a small CPU of the RISC-V type. This CPU runs a real Ed25519 signature check. Ed25519 is a standard digital signature scheme. The check uses the Monocypher library's code, made to follow the standard RFC 8032 strictly. You give the model a signed message as token ids (the numbers that stand for pieces of input). If the signature is valid for one of the 4 public keys built into the model, it answers <verify_ok>. Otherwise it answers <verify_failed><eos>. It never writes text.

The 4 keys are public test keys. Their private seeds (the secret values that the keys are made from) are in the source code (secproc.protocol.TEST_SEEDS). So anyone can produce a message that this model accepts. The model shows that the mechanism works. It protects nothing. To use it for real, rebuild it with your own keys (see "Rebuilding with your own keys" below).

Files

File Size Firmware
secproc-rvtiny-ed25519.gguf 6.5 GB The real Ed25519 verifier. A signed message is a stream of 6.3M tokens
secproc-rvtiny-stub.gguf 6.5 GB The same circuit, but with a checksum instead of a signature (a checksum is a short number computed from the data). About 4k tokens per message. Use it to try the mechanism in seconds. It is not secure
llama-secproc.patch The llama.cpp fork, as a patch. Apply it to llama.cpp 3de52ac

The firmware is the program that the model's CPU runs.

What you need

  1. The llama.cpp fork. llama.cpp is a program that runs language models on your own machine. Stock llama.cpp (the unpatched version) refuses these files, because they hold tensors that it does not know. A tensor is a named block of numbers in the model file. These tensors hold the starting state of the CPU. The fork reads them. The circuit also needs activations rounded to bf16 (a 16-bit number format), and the fork does that. Activations are the numbers that pass between the steps of the model. The fork adds the tool llama-secproc. To build it:

    The easy way is the ready-made fork, branch secproc (https://github.com/moonlightelite/llama.cpp):

    git clone --depth 1 --branch secproc https://github.com/moonlightelite/llama.cpp && cd llama.cpp
    cmake -B build [-DGGML_CUDA=ON] && cmake --build build --target llama-secproc
    

    Or patch the original llama.cpp yourself:

    git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp && git checkout 3de52ac
    git apply llama-secproc.patch
    cmake -B build [-DGGML_CUDA=ON] && cmake --build build --target llama-secproc
    

    These commands download llama.cpp, switch to the version that the patch was made for, apply the patch and build the llama-secproc tool. llama-secproc.patch is the file from the table above. Give its path if it is not in the current folder. The brackets mark an option you can leave out. Add -DGGML_CUDA=ON (without the brackets) if you have an NVIDIA GPU.

  2. The project's client (python -m secproc.client). It signs a message and computes the token stream, which is the list of tokens that the model checks. It is Python code in the secproc repository on GitHub (https://github.com/moonlightelite/secproc). Run pip install -e . in that repository. This installs numpy and gguf. You need Python 3.11 or newer. You do not need PyTorch, a GPU or a RISC-V compiler, because the firmware is in the GGUF file.

For step-by-step instructions, with hardware needs and expected output, see docs/quickstart-rvtiny.md in that repository. The model that answers questions, Qwen3.5-4B, is in a separate Hugging Face repository.

Try it

export LLAMA_CPP=/path/to/llama.cpp
python -m secproc.client secproc-rvtiny-ed25519.gguf "Pay 100 to Alice"                         # VOK
python -m secproc.client secproc-rvtiny-ed25519.gguf "Pay 100 to Alice" --alter "Pay 900 to Alice"  # VF
python -m secproc.client secproc-rvtiny-ed25519.gguf "Pay 100 to Alice" --flip-signature        # VF

The first line tells the client where llama.cpp is. The next three lines run the client on the model file. In the comments, VOK means accepted and VF means refused. They are the short names of the tokens <verify_ok> and <verify_failed>. The second message has its text changed after signing (--alter). The third message has one bit of its signature flipped (--flip-signature).

In each run, the client signs the message. It runs the firmware stored in the file on a reference CPU, a normal program that imitates the model's CPU. This gives the whole token stream. Then llama-secproc feeds the stream to the model. The model checks every token of it. If a token differs from what the model would have written, the model refuses. So the host, which is the program that supplies the stream, cannot fake an accept. The option --generate has the model write the whole stream itself. It is tested on the stub file only. For Ed25519 it would take about 10 hours on a GPU, and it has not been run.

Results

Stub Ed25519
NVIDIA RTX PRO 6000 (CUDA, batch 64) 4 s per message; model-written stream 22.5 s 578 s per message (10.9k tokens/s)
Apple M1 Pro (Metal) 10 s per message; model-written stream 160 s 16,385 s (4.6 h, 386 tokens/s): honest message accepted
8 CPU threads (Linux, 24-core host) 34 s (137 tokens/s, measured 2026-11-14; an earlier run on 2026-11-11 took 52 s) not run

"Model-written stream" is the time that the model takes to write the whole stream itself. CUDA, Metal and the CPU are the three backends. A backend is the part of llama.cpp that does the computing on one kind of hardware: NVIDIA GPUs, Apple GPUs or the CPU.

The checks on the stub file ran on all three backends:

  • The honest message is accepted.
  • A flipped signature bit is refused.
  • All 19 tampered streams are refused from the tampered token on. A tampered stream is an honest stream with one edit. The edits include a forged accept, a VOK written in the middle of the stream, an injected record, a nested start marker, and others.
  • The model is fed only the message tokens. It writes all 3,830 stream tokens itself.

The checks on the Ed25519 file ran on CUDA, with 6.3M tokens each. On Metal, only the honest message was run, and it was accepted. On CUDA:

  • The honest message is accepted.
  • A flipped signature bit is refused. So are an altered message, and a message signed with key 1 while its header claims key 0.
  • Three host attacks on the stream are also refused: a forged accept in the final burst, a VOK written in the middle of the stream, and a trace record injected at an input position. The last two were run with a valid signature.

A burst is the short run of trace tokens that comes after each input token. A trace record is one entry in the record of the firmware's steps. An input position is a place where only input tokens belong.

Limits

  • Not a secure deployment with the published keys (above).
  • Do not quantize. Quantizing means storing the weights in a smaller, less exact number format. The circuit's weights are exact bf16 values, and any quantized type changes them.
  • Needs the fork. Activations must also be rounded to bf16. The fork does this, as the file tells it to.
  • Not bit-exact. Inside the delta rule (one step of the model's delta-net layers), the numbers do not match the reference bit for bit. Every token was right in all the tests. But a 6.3M-token stream was tested only in the cases listed above.
  • The inference engine is trusted. The inference engine is the program that runs the model, here the llama.cpp fork. The file fixes the CPU's starting state and the circuit. But a modified engine can still change what is computed.
  • Authenticity only. The model checks that a trusted key signed the message, and it does not encrypt anything. The host, not the model, enforces freshness (a message must not be old or replayed). It uses the header fields nonce and expires_at.

Rebuilding with your own keys

The key table is the list of public keys that the firmware accepts. It is part of the firmware, so it is part of the starting state. To make a model that accepts your keys, first build a firmware that holds your 4 public keys: protocol.build_firmware(stub=False, keys=[...]). Then run python -m secproc.release --elf build/secproc-mine.elf. See docs/gguf.md in the project for the full commands.

How it works

The model is a stock Qwen3_5ForCausalLM. That is a standard Qwen3.5 model class from the Hugging Face transformers library. It has 15 layers, hidden size 2816 (the width of the vectors inside each layer), 3.2B parameters, and a vocabulary of 492,736 circuit tokens. The vocabulary is the list of tokens that the model knows. The CPU was compiled into the weights with chipformer, a tool that turns digital circuits into model weights. The parts work like this:

  • The delta-net layers are a kind of layer in Qwen3.5 that keeps a state from one token to the next. The states of these layers are the CPU's memory.
  • The MLPs (the feed-forward part of each layer) are the CPU's logic.
  • Each instruction that the CPU runs becomes a few tokens. The model predicts these tokens.

A signed region is fed in as tokens. The region is the signed input: a start marker, a header and signature, the message and an end marker. The CPU runs the verifier, which is the signature check. A gate in the last layers forces the output to <verify_failed><eos>, unless the verifier accepted. docs/overview.md in the project explains it step by step.

This work builds on chipformer (MIT license), Monocypher 4.0.2 (BSD-2-Clause or CC0 license) and llama.cpp (MIT license).

Downloads last month
41
GGUF
Model size
3B params
Architecture
qwen35
Hardware compatibility
Log In to add your hardware

We're not able to determine the quantization variants.

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support