saci-julia is a Saci module. It runs the open
SupersonicLabs/Julia-1
decision model as a local System One judge. A worker
can then pass a step without a model request and without a hosted judge
service.
Julia 1 is a 144M parameter encoder model (Apache 2.0). It is not a chat
model. It reads a state and named questions, and it gives probabilities over
the options of each question. saci-julia runs the ONNX export of the model,
Julia-1-ONNX, with ONNX
Runtime. Python and PyTorch are not necessary.
saci-julia is a separate binary. No other Saci binary depends on it, and
Saci does not start it. make install installs it. The Saci image does not
contain it.
saci-julia serve loads the model once.saci-julia encodes each question with its options and the state, runs
all questions of the evaluation in one batch, and returns the probability
that each expected result holds.judge.threshold_percent. Otherwise the llm model assesses the step.The encoder uses the same token layout as the reference encoder in
Julia-1-ONNX. By default it is strict: it rejects an evaluation that does not
fit the token limits, and text that contains <mask>. The worker then asks
the llm model. Thus long evidence is never cut before the judge sees it.
Build and install the binary:
make install
The build downloads a prebuilt ONNX Runtime library. If the build host
cannot download it, build with --no-default-features --features
load-dynamic and set ORT_DYLIB_PATH to an ONNX Runtime 1.20 or later
library at run time.
Download the model files (about 600 MB):
saci-julia download
The files go to ~/.cache/saci-julia/<revision>. Set --model-dir or
SACI_JULIA_MODEL_DIR to use a different directory. If Hugging Face
requires a token, set HF_TOKEN.
Make sure that the model gives the same results as the reference PyTorch model:
saci-julia parity
This runs the 100 cases in parity-cases.json. The command fails if a
logit differs by more than 0.001 (--tolerance), or if the top option is
different.
Start the service:
saci-julia serve
Configure the judge in the Saci configuration:
judge:
provider: julia-1
The default endpoint is http://127.0.0.1:8095/v1/evaluate. It works
only for workers on the same host that are not in a container. In a
container, 127.0.0.1 is the container itself. For workers in Podman or
Docker containers, listen on all interfaces with a token, and use the
host name of the container runtime:
saci-julia serve --listen 0.0.0.0:8095 --token-env SACI_JULIA_TOKEN
judge:
provider: julia-1
endpoint: http://host.containers.internal:8095/v1/evaluate # host.docker.internal on Docker
api_key: env:SACI_JULIA_TOKEN
run,
when each block ran and exited normally, and the step has expected
results.saci-julia serve logs loaded the model at startup, then a request
line for each HTTP request (with its status), and ran the model and
evaluated lines for each evaluation (with the token count, the time and
the answers). A 401 status means a wrong or missing token.the System One judge is configured at startup. For
each step it has asking the judge and the judge passed the step, or
the reason that the judge did not assess the step or did not pass it.model_requests: 0.llm model assesses the step.One evaluation usually takes a fraction of a second on a CPU. Thus the CPU use of the service is low.
| Option | Default | Meaning |
|---|---|---|
--model-dir |
~/.cache/saci-julia/<revision> |
The model files. Also SACI_JULIA_MODEL_DIR. |
serve --listen |
127.0.0.1:8095 |
The listen address. |
serve --token-env |
none | The environment variable that holds the token. Each evaluation must send it as Authorization: Bearer <token>. Required when --listen is not a loopback address. |
--threads |
ONNX Runtime chooses | CPU threads for one evaluation. |
--max-length |
8192 |
The most tokens of one question with its options and the state. |
--head-length |
512 |
The tokens for the question and its options. |
--no-strict |
off | Truncate input that does not fit, instead of rejecting it. |
download --revision |
the tested commit | The Julia-1-ONNX commit to download. |
parity --cases, --tolerance |
parity-cases.json, 0.001 |
The reference cases and the largest allowed logit difference. |
The service logs each request and each evaluation (see
Check that the judge is used). Set the log
level with RUST_LOG, for example RUST_LOG=warn. SIGINT
and SIGTERM stop the server.
To require a token, put it in a variable and give the variable name:
saci-julia serve --listen 0.0.0.0:8095 --token-env SACI_JULIA_TOKEN
Give the worker the same value:
judge:
provider: julia-1
endpoint: http://judge.example:8095/v1/evaluate
api_key: env:SACI_JULIA_TOKEN
| Method and path | Meaning |
|---|---|
POST /v1/evaluate |
One evaluation. Requires the bearer token when one is set. |
GET /health |
{"status": "ok"}. Does not require a token. |
A request is a JSON object with state (a string, or any JSON value, which
the service writes as compact JSON text) and questions. The service ignores
model.
{"state": {"step": "Check the pods", "evidence": ["..."]},
"questions": {"criterion_0": {"type": "noul",
"instructions": "Does the evidence show that all pods are Running?",
"criteria": {"false": "It does not.", "true": "It does."}}}}
Question type |
criteria |
Answer |
|---|---|---|
noul |
omitted, or an object with the keys false and true |
noul: the probability of true |
choice |
an object of 2 to 20 options (ID to description) | choice (the selected ID), probabilities, confidence |
score |
an ordered list of 2 to 20 levels | score (the expected level index, from 0), probabilities, legend, confidence |
The response is {"model": "julia-1", "answers": {...}}, with one answer for
each question ID. The status is 400 for a request that is not valid or
does not fit the token limits, 401 for a missing or wrong token, and 500
when the model fails. The body of an error is
{"error": {"message": "..."}}.
The unit tests and the end-to-end tests use a stand-in graph and tokenizer. The test of the encoder against the reference token IDs needs the real tokenizer:
SACI_JULIA_MODEL_DIR=~/.cache/saci-julia/<revision> \
cargo test -p saci-julia --test reference -- --ignored