# Repository Briefing: PyModel/verdict
> Source: https://repoforai.com/repo/PyModel/verdict (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/PyModel/verdict
- **Official Docs / Website**: https://verdict.pymodel.com/
- **Category**: LLMs & Inference (大模型与推理微调)
- **Primary Language**: Swift
- **License**: MIT
- **Engineering Health**: A (87/100 · Maintenance 35/35 · Adoption 12/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v0.13.0 (2026-12-04) — https://github.com/PyModel/verdict/releases
- **Review Snapshot**: 2026-12-03 (Note: v0.13.0 on 2026-12-04 shipped after this review; verify latest release notes)
- **Deployment / Stack Signals**: Self-Hosted, Local AI, GPU, API
- **Momentum**: 118 ★ total (+0 24h / +118 7d) · 11 forks
- **Topics**: `apple-silicon`, `classification`, `decider`, `decision-model`, `gguf`, `llama-cpp`, `llm-inference`, `local-llm`, `macos`, `menubar-app`, `metal`, `on-device-ai`
- **When to Use**: Best for: Apple silicon Mac users who need a local Decisions API for structured text or image classification and scoring, starting with Flash on a 16 GB machine. Skip if: You need `locate` questions, a general-purpose chat server, non-Mac deployment, automatic launch at login, or encrypted remote access without a separate network layer.

## Overview
```text
### Architecture & Core Mechanics
Verdict separates its SwiftUI menu bar app from inference. `Sources/VerdictDomain` defines policies and port protocols without OS or UI dependencies; `VerdictApplication` holds controllers such as `ServerSupervisor` and `ModelDownloader`; and `VerdictInfrastructure` implements macOS, POSIX, URLSession, Keychain, filesystem, and llama-server adapters. The desktop composition root is `AppContainer`. The app supervises a separate llama-server process, and clients call that server directly over HTTP.

The native engine pins llama.cpp to `9d6f04fa99` and applies vendored patches for protocol v4 and MACaQ, including non-causal full-attention layers and chunked readouts. The patches also add the `/v1/decisions` alias alongside `/v1/systemone`, request logging for the dashboard, and the model's sleep state in `/health`. Metal optimizations specific to M5 are gated at runtime; the earlier Apple silicon execution path is retained.

### Key Capabilities & Differentiators
Verdict runs Decider Flash v1.3 4B in Q8_0 and Decider 27B v1.3 in Q4_K_M or Q8_0. The API answers `choice`, `score`, and `noul` questions with a probability distribution per question. Inputs can include text, images, or both; images require the vision projector, and `locate` returns HTTP 400. Each request is read in one pass and is limited by the smaller of `batchSize` and `contextSize / parallelSlots`. Set tuning to `manual` if those configuration values must be preserved.

Separate mode builds a state-and-question sequence for each question. Optional isolated mode reads the state once for a set of text questions. On an M5 Max with 128 GB of unified memory, Flash answered 16 questions over roughly 6,100 tokens in 1.81 s in isolated mode versus 23.97 s in separate mode, with no top-answer changes in that benchmark row. Separate was faster for one question, and image requests always use separate mode. M1–M4 Macs are supported targets, but these timings come from M5 Max and the build has not been run on M1–M4 hardware.

### Trade-offs & Limitations
Verdict solves a specific compatibility problem: stock llama.cpp and Decider.app 0.1.0 do not run Decider v1.3. The bundled runtime removes the need to maintain those patches yourself, at the cost of tying inference to a pinned, patched engine. Compared with a hosted API, decision inputs can stay on the Mac, but model storage, unified memory, and process uptime become local responsibilities. The 15-minute default idle unload frees memory at the cost of a reload on the next request.

Use separate mode when a question must not be influenced by which other questions are present. In isolated mode each question attends only to the state and itself, but the state can attend to all questions, so probabilities can shift when the question set changes. For deployment, keep the default loopback binding unless LAN access is needed. Sharing binds to `0.0.0.0` with no authentication by default; API keys or passwords add bearer authentication but not encryption, and `/health` remains open. Use a trusted network or VPN for shared access.

### Hardware & Deployment Guide
The signed, notarized DMG targets Apple silicon M1 or later and macOS 14 or later; the bundled arm64 llama-server links only to macOS system libraries, so end users do not need Homebrew. First launch downloads the 5.2 GB Flash GGUF and 0.7 GB BF16 projector from a pinned Hugging Face revision, checking size and SHA-256 before moving them into place. Flash needs about 6 GB of disk and 16 GB of unified memory is recommended, or 8 GB with a q8_0 KV cache. The 27B options need about 17.7 GB or 29.5 GB of disk, with 32 GB or 64 GB of unified memory recommended respectively; q8_0 KV lowers those recommendations to 24 GB or 48 GB.

Configuration lives at `~/Library/Application Support/Verdict/config.json`; apply hand edits with Restart Server. The app starts the server when launched, but does not start at login. The supervisor leaves occupied ports alone and makes at most three automatic restart attempts after consecutive crashes. Source builds require Xcode 26 or its command-line tools with Swift 6.2, plus CMake and Git; the build, test, and packaging entry points are `Scripts/build_server.sh`, `Scripts/test.sh`, and `Scripts/package_app.sh`. Signed releases check for updates daily through Sparkle. v0.10.0 adds isolated mode and fixes local builds outranking releases, while v0.8.0 and v0.9.0 focus on settings UI fixes.
```

## Key Capabilities
```text
- Runtime: Bundles an arm64 llama-server pinned to llama.cpp commit `9d6f04fa99`, with protocol v4, MACaQ, and Decider v1.3 readout patches.
- API: `/v1/decisions` and `/v1/systemone` return per-question probability distributions for choice, score, and noul across text and images.
- Shared-state inference: v0.10.0 adds opt-in isolated mode; Flash on M5 Max took 1.81 s versus 23.97 s in separate mode for 16 questions over roughly 6,100 tokens.
- Request sizing: Each request is bounded by the smaller of `batchSize` and `contextSize / parallelSlots`; KV cache supports f16, q8_0, and q4_0.
- Process supervision: Idle unloading defaults to 15 minutes; crash recovery makes up to three restart attempts, and the supervisor never takes over a busy port.
- Network boundary: Loopback on port 8012 by default; LAN sharing binds to `0.0.0.0` over plain HTTP with optional bearer authentication.
```

## Quick Start / Clone
```bash
curl http://127.0.0.1:8012/v1/decisions -H 'Content-Type: application/json' -d '{
  "state": "The battery stopped charging after two weeks.",
  "questions": {
    "defect":   {"type": "noul", "instructions": "Does the review report a product defect?"},
    "severity": {"type": "choice", "instructions": "How severe is the issue?",
                 "criteria": {"low": "Minor", "medium": "Noticeable", "high": "The product is unusable"}}
  }
}'
```
