Skip to main content

ClassOne: System 1 Decision Model Architecture

CI License: Apache 2.0

ClassOne is an open-source System 1 decision model architecture built on Google's Gemma 4 E2B (Effective 2B). It provides rapid, non-autoregressive, schema-constrained decision execution for classification, routing, verification, and scoring in a single forward pass.

Inspired by Daniel Kahneman's cognitive framework in Thinking, Fast and Slow and modern proper scoring rules (Brier, 1950; Gneiting & Raftery, 2007).


Key Features

  • System 1 Architecture: Non-autoregressive decision model. Skips open-ended token generation entirely.
  • Single-Pass Parallel Evaluation: Evaluates multiple typed questions (Noul, Choice, Score) simultaneously in a single forward pass over unstructured state (<10ms on MPS, <50ms on edge GPU).
  • Zero Structural Hallucinations: Constrained by design to valid schema outputs.
  • Calibrated Probabilities (RLCD): Trained and scored using Strictly Proper Scoring Rules (normalized Brier score + Negative Log-Likelihood) to penalize overconfidence.
  • Dual API Endpoints: Exposes POST /v1/decide and POST /v1/classone for schema-out decision queries.
  • Python Client SDK: Idiomatic synchronous and asynchronous client library (from classone import ClassOneClient).

Quickstart

1. Installation

git clone https://github.com/devops-thiago/class-one.git
cd class-one
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

2. Run Test Suite

pytest tests/

3. Start the API Server

uvicorn classone.server.app:app --host 0.0.0.0 --port 8000

4. Query via HTTP

curl -X POST http://localhost:8000/v1/classone \
  -H "Content-Type: application/json" \
  -d '{
    "model": "class-one-gemma-4-e2b",
    "state": {
      "message": "I was double billed for my subscription."
    },
    "questions": {
      "refund": {
        "type": "noul",
        "instructions": "Is customer asking for a refund?"
      },
      "routing": {
        "type": "choice",
        "instructions": "Which department?",
        "criteria": {
          "billing": "Charges and payouts",
          "technical": "App bugs and crashes"
        }
      },
      "urgency": {
        "type": "score",
        "instructions": "Ticket urgency",
        "criteria": ["low", "normal", "critical"]
      }
    }
  }'

5. Python SDK Usage

from classone import ClassOneClient, Choice, Noul, Score

with ClassOneClient(base_url="http://localhost:8000") as client:
    response = client.decide(
        state="Customer account was locked after three incorrect attempts.",
        questions={
            "urgent": Noul(instructions="Is this an urgent security event?"),
            "action": Choice(
                instructions="Action required:",
                criteria={"unlock": "Send unlock link", "escalate": "Escalate to SecOps"}
            ),
            "severity": Score(
                instructions="Assess severity:",
                criteria=["low", "medium", "critical"]
            ),
        }
    )

    print("Urgent P(true):", response.nouls["urgent"].noul)
    print("Action Choice:", response.choices["action"].choice)
    print("Severity Score:", response.scores["severity"].score)

CLI Utilities

# Run single-pass decision inference on Gemma:
python scripts/run_classone.py --model google/gemma-2-2b-it --device auto

# Benchmark latency vs traditional autoregressive LLMs:
python scripts/benchmark_latency.py --iterations 30

Reference


  • Gemma is a trademark of Google LLC.
  • Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms.

Metadata

Release files for classone 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for classone 0.1.0
File Size Uploaded
classone-0.1.0.tar.gz 34.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for classone 0.1.0
File Interpreter ABI Platform
classone-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 62.7 kB

Release files / classone-0.1.0.tar.gz

Download URL classone-0.1.0.tar.gz
Size 34.2 kB
Tags Source
SHA-256 checksum
How to use checksums
099d44686619683ee1f832223a46ed7d9ec757af081b71b8ebda18a2e8186dcf
BLAKE2b-256 checksum
How to use checksums
e868f9c1babc1aadef1bf1ed8e81cd030b0beb1b3d15260f18d278f490738835
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / classone-0.1.0-py3-none-any.whl

Download URL classone-0.1.0-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91e2e8de84daa63fd1ec62465b3c40df52a7e6b583109fd46c14742f66002045
BLAKE2b-256 checksum
How to use checksums
c7d210f9aa67c5f3bc1565466c398ca0e1e1ab20c3157cf90c35a8bf3e665449
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page