0464GitHub
open-jev (MLX)
Gemma 3 option scorer for Apple MLX that shares one prefill across candidate continuations and exposes a System One-compatible endpoint; its docs show zero-shot overconfidence…
daseinlabs/open-jevREADME ↗
# openjev
One-pass option scoring with a local Gemma 3 4B on Apple silicon via MLX.
Design notes: [docs/design/one-pass-option-scoring.md](docs/design/one-pass-option-scoring.md);
per-task training: [docs/design/per-task-finetuning-with-gemma.md](docs/design/per-task-finetuning-with-gemma.md).
Given a context and a list of pre-written options, the model prefills the
context once, expands that KV cache across the option batch, and scores every
option in a single padded forward pass. No decoding. The score is the
log-probability of the option tokens given the context; a softmax over the
option scores gives a probability per option, like `jevlike-predict`.
## Setup
```sh
make setup # uv sync (arm64 Python 3.12 venv) + download google/gemma-3-4b-it into models/ (gated; needs HF login)
make serve # start the HTTP server on :8000
make health # curl /health
make request # example curl against /score
make systemone # TypeSafe-style request against /v1/systemone
make check # verify cached batched scoring against naive re-encoding
make bench # latency benchmark
make eval DATA=data/synthetic/test.jsonl
```
`make setup` also installs the optional `torch` extra, used only for the jevlike comparison and HF cross-checks.
`make` on macOS needs the Xcode licence accepted (`sudo xcodebuild -license accept`) or Homebrew's `gmake`.
## Usage
```sh
# Rank options for one context (prints probability, score, raw sum, token count)
.venv/bin/openjev score --context "The capital of France is" \
--option " Paris" --option " Berlin" --option " Lyon"
# Chat template (context as user turn, options scored as the reply) + PMI normalisation
.venv/bin/openjev score --chat --norm pmi --context "..." --option "..." --option "..."
# Predefined options: one per