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

# Publish a model checkpoint to the Hugging Face Hub:
python scripts/push_to_hub.py --checkpoint-dir ./checkpoints/classone_v1 --repo-id your-org/classone-gemma-4-e2b

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.1

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.1
File Size Uploaded
classone-0.1.1.tar.gz 34.4 kB Details

Built distribution (wheel)

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

Total release size: 63.1 kB

Release files / classone-0.1.1.tar.gz

Download URL classone-0.1.1.tar.gz
Size 34.4 kB
Tags Source
SHA-256 checksum
How to use checksums
df86ea9774adf38bbefa62cbeb848d9aa68666ed5b746afdef2e0f733a3583bb
BLAKE2b-256 checksum
How to use checksums
e65ff1d952f362e3804ee56fb654577ba5f2ae8dc3a535ed55e73986a9a54024
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.1-py3-none-any.whl

Download URL classone-0.1.1-py3-none-any.whl
Size 28.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50df65f0660ae2f6a3098cf51e2872a1cb9945ea8a47cb30ad44f9cdd64da156
BLAKE2b-256 checksum
How to use checksums
0b1e24c53d6e2b9d52c224f66399461f0634c1a5c2a6e0aa6e6a00f80688a101
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

This release

0.1.1 This release

2 release files

0.1.0

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