henryphilf commited on
Commit
5f15b97
·
verified ·
1 Parent(s): 986ed2c

Release prep: ensemble-aware CLI/server, clean-install validation, compact Run locally section and local inference doc

Browse files
README.md CHANGED
@@ -1,222 +1,252 @@
1
- ---
2
- license: cc-by-nc-4.0
3
- license_name: cc-by-nc-4.0
4
- license_link: https://creativecommons.org/licenses/by-nc/4.0/
5
- language:
6
- - en
7
- library_name: pytorch
8
- pipeline_tag: text-classification
9
- tags:
10
- - decision-model
11
- - system-one
12
- - calibrated-decisions
13
- - typed-decisions
14
- - choice
15
- - noul
16
- - score
17
- - ensemble
18
- - modernbert
19
- - deberta
20
- - pytorch
21
- - safetensors
22
- ---
23
-
24
- # Pluto-1
25
-
26
- ### A 333M decision model that beats 27B-class Jev 1.13 on Typed Decisions at 1/80th the size and 13x lower latency.
27
-
28
- Pluto-1 is a dual-encoder decision model. Give it a state and typed questions; it
29
- returns calibrated probability distributions for `choice`, `noul`, and `score`
30
- questions. It never generates text. There is nothing to parse, nothing to retry,
31
- and nothing to hallucinate.
32
-
33
- Built solo on one **RTX 5060 Ti 16GB**.
34
-
35
- **Headline:** 0.7515 accuracy on the independent Typed Decisions test split,
36
- beating published Jev 1.13 (0.727) and Liquid d1 (0.742), at **54 ms p50** and
37
- **332.8M parameters**. Laya-typed, measured by us on the same rows, remains 1.65
38
- points higher on raw accuracy; Pluto-1 wins on calibration, latency, and size.
39
-
40
- ---
41
-
42
- ## The receipts
43
-
44
- 400 held-out cases / 2,000 probabilistic decisions. Higher accuracy, lower KL,
45
- Brier, and ECE are better.
46
-
47
- | Model | Params | Mode | Accuracy | KL | Brier | ECE | p50 |
48
- |---|---:|---|---:|---:|---:|---:|---:|
49
- | **Pluto-1** | **332.8M** | fitted on train | **0.7515** | **0.1183** | **0.0649** | **0.1400** | **54.2 ms** |
50
- | Pluto-1 Air (ablation) | 149.1M | fitted on train | 0.7275 | 0.1391 | 0.0765 | 0.1067 | 26.9 ms |
51
- | Laya-typed | 421.3M | fitted on train | **0.7680** | 0.1171 | 0.0615 | 0.2152 | 66.2 ms |
52
- | Jev 1.13 | ~27B | zero-shot (published) | 0.727 | 1.442 | 0.148 | 0.144 | ~710 ms |
53
- | Liquid d1 | ~3B | zero-shot (published) | 0.742 | 0.475 | 0.155 | 0.124 | ~525 ms |
54
-
55
- **What this means**
56
- - **Beats Jev 1.13 and d1 on accuracy.** 1/80th Jev's size, ~13x lower latency.
57
- - **Within 1.65 points of Laya-typed.** 35% lower ECE, 18% lower latency, 21% fewer parameters.
58
- - **Calibration is the point.** 0.140 ECE on 2,000 decisions; 0.107 for the 149M single.
59
- - **No token bill at inference.** One encoder pass per specialist, no generated tokens.
60
-
61
- ![Accuracy](assets/benchmark_accuracy.png)
62
-
63
- ![Accuracy vs latency](assets/accuracy_vs_latency.png)
64
-
65
- ![Calibration](assets/calibration.png)
66
-
67
- ![Ensemble payoff](assets/per_kind.png)
68
-
69
- *The per-primitive chart is an ablation against the 149M single checkpoint; that
70
- single checkpoint is not included in this repository.*
71
-
72
- ### Comparison hygiene
73
-
74
- Pluto-1 and Laya-typed are fitted on the benchmark's `train` split. Jev 1.13 and
75
- d1 numbers are published zero-shot values. Laya-typed was run by us with
76
- `laya 0.4.17` on the same test rows and scored with the public metric definition.
77
- This is a descriptive comparison, not a controlled head-to-head across every
78
- system and every task. The benchmark `test` split was never used for training,
79
- early stopping, model selection, or calibration.
80
-
81
- ---
82
-
83
- ## Architecture
84
-
85
- ![Architecture](assets/architecture.png)
86
-
87
- ```
88
- state + typed questions
89
- |
90
- ModernBERT specialist (149M) DeBERTa specialist (184M)
91
- | |
92
- +-------- calibrated 0.5/0.5 ------+
93
- |
94
- choice / noul / score distributions
95
- + confidence + escalate
96
- ```
97
-
98
- - Two specialist encoders, each with 13 per-question heads.
99
- - The ModernBERT branch is initialized from the general Pluto-149M backbone.
100
- - The DeBERTa-v3-base branch adds architectural diversity.
101
- - Probabilities are averaged and temperature-calibrated per primitive.
102
- - One case = five questions, one pass through each encoder.
103
- - No autoregressive decoding.
104
-
105
- ---
106
-
107
- ## Quickstart
108
-
109
- ```bash
110
- git clone https://huggingface.co/omida-ai/pluto-1
111
- pip install -e pluto-1/code
112
- ```
113
-
114
- ```python
115
- import json
116
- from pluto.ensemble import EnsembleEngine
117
-
118
- engine = EnsembleEngine("pluto-1") # or EnsembleEngine("omida-ai/pluto-1")
119
-
120
- state = json.dumps({
121
- "agent": {"autonomy": "checkpointed", "model": "internal-agent-v4"},
122
- "task": "Delete personal data for the accounts in the erasure queue.",
123
- "trace_summary": {"steps": 7, "tool_errors": 1, "irreversible_actions": 0},
124
- })
125
-
126
- questions = {
127
- "action": {
128
- "type": "choice",
129
- "instructions": "What should the observability system do with this trace?",
130
- "criteria": {
131
- "continue": "Let the agent proceed without interruption.",
132
- "human_review": "Queue this trace for a human to review.",
133
- "observe": "Keep running, but flag the trace for later sampling.",
134
- "stop": "Halt the agent now.",
135
- },
136
- },
137
- "needs_review": {
138
- "type": "noul",
139
- "instructions": "This trace requires human review.",
140
- },
141
- "risk": {
142
- "type": "score",
143
- "instructions": "How risky was the agent's behaviour in this trace?",
144
- "criteria": ["Benign", "Low", "Moderate", "High"],
145
- },
146
- }
147
-
148
- result = engine.predict(state, questions)
149
- print(result["answers"]["action"]["choice"])
150
- print(result["answers"]["needs_review"]["noul"])
151
- print(result["answers"]["risk"]["score"])
152
- print(result["escalate"])
153
- ```
154
-
155
- Supported question names: `action`, `needs_review`, `outcome`, `risk`, `urgency`,
156
- `category`, `churn_risk`, `needs_human`, `discrepancy_severity`, `duplicate`,
157
- `matches_order`, `credential_compromise`, `severity`, `true_positive`.
158
-
159
- This is a **specialist** for the Typed Decisions workflows. It is not a general
160
- chat model and does not accept arbitrary new question names.
161
-
162
- ---
163
-
164
- ## Training
165
-
166
- - 1,200 Typed Decisions training cases. 1,080 fit / 60 validation / 60 calibration.
167
- - 5,400 fitted decisions, 13 per-question heads, 8 epochs, freeze 8 backbone layers.
168
- - ModernBERT-base 149.1M + DeBERTa-v3-base 183.8M, 0.5/0.5 probability average.
169
- - Per-primitive temperatures fitted on the 60-case calibration split.
170
- - Test split untouched until final scoring.
171
- - General backbone initialized from Pluto-149M, trained on 655,806 calibrated
172
- decisions from `SargeDev/jev-distill-corpus-v3`.
173
-
174
- Data and base-model attribution is in `NOTICE`.
175
-
176
- ---
177
-
178
- ## What Pluto-1 is not
179
-
180
- - It is not a reasoning model. It does not compete on GPQA, MMLU-Pro, HLE, or
181
- open-ended generation.
182
- - It is not Laya-typed on raw accuracy: Laya-typed is 1.65 points higher on this
183
- test split. Pluto-1 wins calibration, latency, and parameter count.
184
- - It is not a general arbitrary-schema model. The 13 question names are fixed.
185
- - It has no certified risk-controlled abstention gate. `escalate` is a useful
186
- confidence signal, not a guarantee. Validate thresholds on your data.
187
- - It is English-only.
188
- - It is synthetic-benchmark-validated. Production reliability requires production
189
- evaluation.
190
-
191
- ---
192
-
193
- ## License and commercial use
194
-
195
- Pluto-1 is released for **non-commercial** use under
196
- [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/). You can use,
197
- modify, and build non-commercial derivatives with attribution.
198
-
199
- **Commercial use requires a separate license from Omida AI.** Hosted APIs, paid
200
- products, internal business operations, consulting deliverables, and paid
201
- redistribution are not permitted under CC BY-NC 4.0.
202
-
203
- See `COMMERCIAL_LICENSE.md` for the commercial licensing path.
204
-
205
- The runtime code under `code/` is Apache 2.0; that does not grant commercial
206
- rights to the model weights. Upstream components remain under their original
207
- licenses (see `NOTICE`).
208
-
209
- ---
210
-
211
- ## Citation
212
-
213
- ```bibtex
214
- @misc{omida2026pluto1,
215
- title = {Pluto-1: A Compact Calibrated Decision Model},
216
- author = {Omida AI},
217
- year = {2026},
218
- url = {https://huggingface.co/omida-ai/pluto-1}
219
- }
220
- ```
221
-
222
- Built by **Omida AI** on one 16GB consumer GPU.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ license_name: cc-by-nc-4.0
4
+ license_link: https://creativecommons.org/licenses/by-nc/4.0/
5
+ language:
6
+ - en
7
+ library_name: pytorch
8
+ pipeline_tag: text-classification
9
+ tags:
10
+ - decision-model
11
+ - system-one
12
+ - calibrated-decisions
13
+ - typed-decisions
14
+ - choice
15
+ - noul
16
+ - score
17
+ - ensemble
18
+ - modernbert
19
+ - deberta
20
+ - pytorch
21
+ - safetensors
22
+ ---
23
+
24
+ # Pluto-1
25
+
26
+ ### A 333M decision model that beats 27B-class Jev 1.13 on Typed Decisions at 1/80th the size and 13x lower latency.
27
+
28
+ Pluto-1 is a dual-encoder decision model. Give it a state and typed questions; it
29
+ returns calibrated probability distributions for `choice`, `noul`, and `score`
30
+ questions. It never generates text. There is nothing to parse, nothing to retry,
31
+ and nothing to hallucinate.
32
+
33
+ Built solo on one **RTX 5060 Ti 16GB**.
34
+
35
+ **Headline:** 0.7515 accuracy on the independent Typed Decisions test split,
36
+ beating published Jev 1.13 (0.727) and Liquid d1 (0.742), at **54 ms p50** and
37
+ **332.8M parameters**. Laya-typed, measured by us on the same rows, remains 1.65
38
+ points higher on raw accuracy; Pluto-1 wins on calibration, latency, and size.
39
+
40
+ ---
41
+
42
+ ## The receipts
43
+
44
+ 400 held-out cases / 2,000 probabilistic decisions. Higher accuracy, lower KL,
45
+ Brier, and ECE are better.
46
+
47
+ | Model | Params | Mode | Accuracy | KL | Brier | ECE | p50 |
48
+ |---|---:|---|---:|---:|---:|---:|---:|
49
+ | **Pluto-1** | **332.8M** | fitted on train | **0.7515** | **0.1183** | **0.0649** | **0.1400** | **54.2 ms** |
50
+ | Pluto-1 Air (ablation) | 149.1M | fitted on train | 0.7275 | 0.1391 | 0.0765 | 0.1067 | 26.9 ms |
51
+ | Laya-typed | 421.3M | fitted on train | **0.7680** | 0.1171 | 0.0615 | 0.2152 | 66.2 ms |
52
+ | Jev 1.13 | ~27B | zero-shot (published) | 0.727 | 1.442 | 0.148 | 0.144 | ~710 ms |
53
+ | Liquid d1 | ~3B | zero-shot (published) | 0.742 | 0.475 | 0.155 | 0.124 | ~525 ms |
54
+
55
+ **What this means**
56
+ - **Beats Jev 1.13 and d1 on accuracy.** 1/80th Jev's size, ~13x lower latency.
57
+ - **Within 1.65 points of Laya-typed.** 35% lower ECE, 18% lower latency, 21% fewer parameters.
58
+ - **Calibration is the point.** 0.140 ECE on 2,000 decisions; 0.107 for the 149M single.
59
+ - **No token bill at inference.** One encoder pass per specialist, no generated tokens.
60
+
61
+ ![Accuracy](assets/benchmark_accuracy.png)
62
+
63
+ ![Accuracy vs latency](assets/accuracy_vs_latency.png)
64
+
65
+ ![Calibration](assets/calibration.png)
66
+
67
+ ![Ensemble payoff](assets/per_kind.png)
68
+
69
+ *The per-primitive chart is an ablation against the 149M single checkpoint; that
70
+ single checkpoint is not included in this repository.*
71
+
72
+ ### Comparison hygiene
73
+
74
+ Pluto-1 and Laya-typed are fitted on the benchmark's `train` split. Jev 1.13 and
75
+ d1 numbers are published zero-shot values. Laya-typed was run by us with
76
+ `laya 0.4.17` on the same test rows and scored with the public metric definition.
77
+ This is a descriptive comparison, not a controlled head-to-head across every
78
+ system and every task. The benchmark `test` split was never used for training,
79
+ early stopping, model selection, or calibration.
80
+
81
+ ---
82
+
83
+ ## Architecture
84
+
85
+ ![Architecture](assets/architecture.png)
86
+
87
+ ```
88
+ state + typed questions
89
+ |
90
+ ModernBERT specialist (149M) DeBERTa specialist (184M)
91
+ | |
92
+ +-------- calibrated 0.5/0.5 ------+
93
+ |
94
+ choice / noul / score distributions
95
+ + confidence + escalate
96
+ ```
97
+
98
+ - Two specialist encoders, each with 13 per-question heads.
99
+ - The ModernBERT branch is initialized from the general Pluto-149M backbone.
100
+ - The DeBERTa-v3-base branch adds architectural diversity.
101
+ - Probabilities are averaged and temperature-calibrated per primitive.
102
+ - One case = five questions, one pass through each encoder.
103
+ - No autoregressive decoding.
104
+
105
+ ---
106
+
107
+ ## Quickstart
108
+
109
+ ```bash
110
+ git clone https://huggingface.co/omida-ai/pluto-1
111
+ pip install -e pluto-1/code
112
+ ```
113
+
114
+ ```python
115
+ import json
116
+ from pluto.ensemble import EnsembleEngine
117
+
118
+ engine = EnsembleEngine("pluto-1") # or EnsembleEngine("omida-ai/pluto-1")
119
+
120
+ state = json.dumps({
121
+ "agent": {"autonomy": "checkpointed", "model": "internal-agent-v4"},
122
+ "task": "Delete personal data for the accounts in the erasure queue.",
123
+ "trace_summary": {"steps": 7, "tool_errors": 1, "irreversible_actions": 0},
124
+ })
125
+
126
+ questions = {
127
+ "action": {
128
+ "type": "choice",
129
+ "instructions": "What should the observability system do with this trace?",
130
+ "criteria": {
131
+ "continue": "Let the agent proceed without interruption.",
132
+ "human_review": "Queue this trace for a human to review.",
133
+ "observe": "Keep running, but flag the trace for later sampling.",
134
+ "stop": "Halt the agent now.",
135
+ },
136
+ },
137
+ "needs_review": {
138
+ "type": "noul",
139
+ "instructions": "This trace requires human review.",
140
+ },
141
+ "risk": {
142
+ "type": "score",
143
+ "instructions": "How risky was the agent's behaviour in this trace?",
144
+ "criteria": ["Benign", "Low", "Moderate", "High"],
145
+ },
146
+ }
147
+
148
+ result = engine.predict(state, questions)
149
+ print(result["answers"]["action"]["choice"])
150
+ print(result["answers"]["needs_review"]["noul"])
151
+ print(result["answers"]["risk"]["score"])
152
+ print(result["escalate"])
153
+ ```
154
+
155
+ Supported question names: `action`, `needs_review`, `outcome`, `risk`, `urgency`,
156
+ `category`, `churn_risk`, `needs_human`, `discrepancy_severity`, `duplicate`,
157
+ `matches_order`, `credential_compromise`, `severity`, `true_positive`.
158
+
159
+ This is a **specialist** for the Typed Decisions workflows. It is not a general
160
+ chat model and does not accept arbitrary new question names.
161
+
162
+ ---
163
+
164
+ ## Training
165
+
166
+ - 1,200 Typed Decisions training cases. 1,080 fit / 60 validation / 60 calibration.
167
+ - 5,400 fitted decisions, 13 per-question heads, 8 epochs, freeze 8 backbone layers.
168
+ - ModernBERT-base 149.1M + DeBERTa-v3-base 183.8M, 0.5/0.5 probability average.
169
+ - Per-primitive temperatures fitted on the 60-case calibration split.
170
+ - Test split untouched until final scoring.
171
+ - General backbone initialized from Pluto-149M, trained on 655,806 calibrated
172
+ decisions from `SargeDev/jev-distill-corpus-v3`.
173
+
174
+ Data and base-model attribution is in `NOTICE`.
175
+
176
+ ---
177
+
178
+ ## What Pluto-1 is not
179
+
180
+ - It is not a reasoning model. It does not compete on GPQA, MMLU-Pro, HLE, or
181
+ open-ended generation.
182
+ - It is not Laya-typed on raw accuracy: Laya-typed is 1.65 points higher on this
183
+ test split. Pluto-1 wins calibration, latency, and parameter count.
184
+ - It is not a general arbitrary-schema model. The 13 question names are fixed.
185
+ - It has no certified risk-controlled abstention gate. `escalate` is a useful
186
+ confidence signal, not a guarantee. Validate thresholds on your data.
187
+ - It is English-only.
188
+ - It is synthetic-benchmark-validated. Production reliability requires production
189
+ evaluation.
190
+
191
+ ---
192
+
193
+
194
+ ## Run locally
195
+
196
+ Verified with the repository runtime on CPU and CUDA.
197
+
198
+ ```bash
199
+ # Set HF_TOKEN in your environment while this repository is private.
200
+ pip install huggingface_hub
201
+ hf download omida-ai/pluto-1 --local-dir pluto-1
202
+ pip install -e "pluto-1/code[serve]"
203
+ pluto --model pluto-1 info
204
+ ```
205
+
206
+ ```python
207
+ from pluto.ensemble import EnsembleEngine
208
+
209
+ engine = EnsembleEngine("pluto-1")
210
+ result = engine.predict(
211
+ "Invoice #4411 was charged twice.",
212
+ {
213
+ "action": {"type": "choice", "instructions": "What should happen?", "criteria": {"continue": "Proceed.", "human_review": "Escalate.", "stop": "Stop."}},
214
+ "needs_review": {"type": "noul", "instructions": "Requires review."},
215
+ "urgency": {"type": "score", "instructions": "How urgent?", "criteria": ["low", "medium", "high"]},
216
+ },
217
+ )
218
+ print(result["answers"])
219
+ ```
220
+
221
+ Full CPU, CUDA, CLI, and HTTP instructions: [docs/LOCAL_INFERENCE.md](docs/LOCAL_INFERENCE.md).
222
+
223
+ ## License and commercial use
224
+
225
+ Pluto-1 is released for **non-commercial** use under
226
+ [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/). You can use,
227
+ modify, and build non-commercial derivatives with attribution.
228
+
229
+ **Commercial use requires a separate license from Omida AI.** Hosted APIs, paid
230
+ products, internal business operations, consulting deliverables, and paid
231
+ redistribution are not permitted under CC BY-NC 4.0.
232
+
233
+ See `COMMERCIAL_LICENSE.md` for the commercial licensing path.
234
+
235
+ The runtime code under `code/` is Apache 2.0; that does not grant commercial
236
+ rights to the model weights. Upstream components remain under their original
237
+ licenses (see `NOTICE`).
238
+
239
+ ---
240
+
241
+ ## Citation
242
+
243
+ ```bibtex
244
+ @misc{omida2026pluto1,
245
+ title = {Pluto-1: A Compact Calibrated Decision Model},
246
+ author = {Omida AI},
247
+ year = {2026},
248
+ url = {https://huggingface.co/omida-ai/pluto-1}
249
+ }
250
+ ```
251
+
252
+ Built by **Omida AI** on one 16GB consumer GPU.
code/pluto/__init__.py CHANGED
@@ -6,11 +6,13 @@ from .schema import Question, SchemaError, parse_question, parse_questions
6
  from .engine import PlutoEngine
7
  from .task_specialist import TaskSpecialistEngine
8
  from .ensemble import EnsembleEngine
 
9
 
10
  __all__ = [
11
  "PlutoEngine",
12
  "TaskSpecialistEngine",
13
  "EnsembleEngine",
 
14
  "Question",
15
  "SchemaError",
16
  "parse_question",
 
6
  from .engine import PlutoEngine
7
  from .task_specialist import TaskSpecialistEngine
8
  from .ensemble import EnsembleEngine
9
+ from .loader import load_engine
10
 
11
  __all__ = [
12
  "PlutoEngine",
13
  "TaskSpecialistEngine",
14
  "EnsembleEngine",
15
+ "load_engine",
16
  "Question",
17
  "SchemaError",
18
  "parse_question",
code/pluto/cli.py CHANGED
@@ -1,62 +1,63 @@
1
- """Command line interface for Pluto."""
2
-
3
- from __future__ import annotations
4
-
5
- import argparse
6
- import json
7
- import os
8
- import sys
9
-
10
- from .engine import PlutoEngine
11
-
12
-
13
- def _resolve_questions(value: str) -> dict:
14
- if os.path.exists(value):
15
- with open(value, "r", encoding="utf-8") as f:
16
- return json.load(f)
17
- return json.loads(value)
18
-
19
-
20
- def main(argv: list[str] | None = None) -> None:
21
- ap = argparse.ArgumentParser(prog="pluto", description="Pluto decision models")
22
- ap.add_argument("--model", default=os.environ.get("PLUTO_MODEL", "artifacts/pluto-149m-v3"))
23
- sub = ap.add_subparsers(dest="cmd", required=True)
24
-
25
- sub.add_parser("info", help="show checkpoint metadata")
26
-
27
- p = sub.add_parser("predict", help="answer typed questions about a state")
28
- p.add_argument("--state", help="state text")
29
- p.add_argument("--state-file", help="read state from a file")
30
- p.add_argument("--questions", required=True, help="questions JSON or path")
31
- p.add_argument("--max-len", type=int, default=None)
32
-
33
- s = sub.add_parser("serve", help="start the HTTP server")
34
- s.add_argument("--host", default="0.0.0.0")
35
- s.add_argument("--port", type=int, default=8000)
36
-
37
- args = ap.parse_args(argv)
38
- if args.cmd == "info":
39
- print(json.dumps(PlutoEngine(args.model).info, indent=2))
40
- return
41
- if args.cmd == "predict":
42
- if args.state_file:
43
- with open(args.state_file, "r", encoding="utf-8") as f:
44
- state = f.read()
45
- elif args.state is not None:
46
- state = args.state
47
- else:
48
- state = sys.stdin.read()
49
- engine = PlutoEngine(args.model)
50
- result = engine.predict(state, _resolve_questions(args.questions), max_len=args.max_len)
51
- print(json.dumps(result, indent=2))
52
- return
53
- if args.cmd == "serve":
54
- import uvicorn
55
-
56
- from .serve import create_app
57
-
58
- uvicorn.run(create_app(args.model), host=args.host, port=args.port)
59
-
60
-
61
- if __name__ == "__main__":
62
- main()
 
 
1
+ """Command line interface for Pluto."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ import os
8
+ import sys
9
+
10
+ from .loader import load_engine
11
+
12
+
13
+ def _resolve_questions(value: str) -> dict:
14
+ if os.path.exists(value):
15
+ with open(value, "r", encoding="utf-8") as f:
16
+ return json.load(f)
17
+ return json.loads(value)
18
+
19
+
20
+ def main(argv: list[str] | None = None) -> None:
21
+ ap = argparse.ArgumentParser(prog="pluto", description="Pluto decision models")
22
+ ap.add_argument("--model", default=os.environ.get("PLUTO_MODEL", "omida-ai/pluto-1"))
23
+ ap.add_argument("--device", default=None, help="cpu, cuda, or mps; default is automatic")
24
+ sub = ap.add_subparsers(dest="cmd", required=True)
25
+
26
+ sub.add_parser("info", help="show checkpoint metadata")
27
+
28
+ p = sub.add_parser("predict", help="answer typed questions about a state")
29
+ p.add_argument("--state", help="state text")
30
+ p.add_argument("--state-file", help="read state from a file")
31
+ p.add_argument("--questions", required=True, help="questions JSON or path")
32
+ p.add_argument("--max-len", type=int, default=None)
33
+
34
+ s = sub.add_parser("serve", help="start the HTTP server")
35
+ s.add_argument("--host", default="0.0.0.0")
36
+ s.add_argument("--port", type=int, default=8000)
37
+
38
+ args = ap.parse_args(argv)
39
+ if args.cmd == "info":
40
+ print(json.dumps(load_engine(args.model, device=args.device).info, indent=2))
41
+ return
42
+ if args.cmd == "predict":
43
+ if args.state_file:
44
+ with open(args.state_file, "r", encoding="utf-8") as f:
45
+ state = f.read()
46
+ elif args.state is not None:
47
+ state = args.state
48
+ else:
49
+ state = sys.stdin.read()
50
+ engine = load_engine(args.model, device=args.device)
51
+ result = engine.predict(state, _resolve_questions(args.questions), max_len=args.max_len)
52
+ print(json.dumps(result, indent=2))
53
+ return
54
+ if args.cmd == "serve":
55
+ import uvicorn
56
+
57
+ from .serve import create_app
58
+
59
+ uvicorn.run(create_app(args.model, device=args.device), host=args.host, port=args.port)
60
+
61
+
62
+ if __name__ == "__main__":
63
+ main()
code/pluto/ensemble.py CHANGED
@@ -49,6 +49,7 @@ class EnsembleEngine:
49
  "models": [e.info["name"] for e in self.engines],
50
  "weights": self.weights,
51
  "temperatures": self.temperatures,
 
52
  "params": sum(e.info["params"] for e in self.engines),
53
  }
54
 
 
49
  "models": [e.info["name"] for e in self.engines],
50
  "weights": self.weights,
51
  "temperatures": self.temperatures,
52
+ "device": str(self.engines[0].device) if self.engines else str(self.device),
53
  "params": sum(e.info["params"] for e in self.engines),
54
  }
55
 
code/pluto/loader.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Model-kind detection and loading for the CLI and HTTP server."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import os
7
+
8
+ from .engine import PlutoEngine
9
+ from .ensemble import EnsembleEngine
10
+ from .task_specialist import TaskSpecialistEngine
11
+
12
+
13
+ def resolve_model_path(model: str, token: str | None = None) -> str:
14
+ """Return a local path, downloading a Hub repository if needed."""
15
+ if os.path.exists(model):
16
+ return model
17
+ from huggingface_hub import snapshot_download
18
+
19
+ return snapshot_download(model, token=token)
20
+
21
+
22
+ def _ensemble_config(directory: str) -> str | None:
23
+ preferred = os.path.join(directory, "ensemble_config.json")
24
+ if os.path.exists(preferred):
25
+ return preferred
26
+ legacy = os.path.join(directory, "config.json")
27
+ if os.path.exists(legacy):
28
+ try:
29
+ data = json.load(open(legacy, encoding="utf-8"))
30
+ except Exception:
31
+ return None
32
+ if isinstance(data, dict) and "models" in data and "weights" in data:
33
+ return legacy
34
+ return None
35
+
36
+
37
+ def load_engine(model: str, device: str | None = None, token: str | None = None):
38
+ """Load an ensemble, specialist, or general checkpoint by its layout."""
39
+ path = resolve_model_path(model, token=token)
40
+ if os.path.isdir(path):
41
+ ensemble = _ensemble_config(path)
42
+ if ensemble:
43
+ return EnsembleEngine(ensemble, device=device, token=token)
44
+ if os.path.exists(os.path.join(path, "pluto_task_config.json")):
45
+ return TaskSpecialistEngine(path, device=device)
46
+ if os.path.exists(os.path.join(path, "pluto_config.json")):
47
+ return PlutoEngine(path, device=device)
48
+ raise ValueError(
49
+ f"{path!r} is not a Pluto checkpoint: expected ensemble_config.json, "
50
+ "pluto_task_config.json, or pluto_config.json"
51
+ )
52
+ if os.path.isfile(path):
53
+ base = os.path.dirname(path)
54
+ name = os.path.basename(path)
55
+ if name in ("ensemble_config.json", "config.json"):
56
+ ensemble = _ensemble_config(base)
57
+ if ensemble:
58
+ return EnsembleEngine(ensemble, device=device, token=token)
59
+ if name == "pluto_task_config.json":
60
+ return TaskSpecialistEngine(base, device=device)
61
+ if name == "pluto_config.json":
62
+ return PlutoEngine(base, device=device)
63
+ raise ValueError(f"unsupported model path: {path!r}")
code/pluto/serve.py CHANGED
@@ -8,7 +8,7 @@ from typing import Any
8
  from fastapi import FastAPI, Header, HTTPException
9
  from pydantic import BaseModel, Field
10
 
11
- from .engine import PlutoEngine
12
  from .schema import SchemaError
13
 
14
 
@@ -25,9 +25,9 @@ class Health(BaseModel):
25
  device: str
26
 
27
 
28
- def create_app(model_path: str | None = None) -> FastAPI:
29
- path = model_path or os.environ.get("PLUTO_MODEL", "artifacts/pluto-149m-v3")
30
- engine = PlutoEngine(path)
31
  api_key = os.environ.get("PLUTO_API_KEY")
32
  app = FastAPI(title="Pluto Decision API", version="0.1.0")
33
 
 
8
  from fastapi import FastAPI, Header, HTTPException
9
  from pydantic import BaseModel, Field
10
 
11
+ from .loader import load_engine
12
  from .schema import SchemaError
13
 
14
 
 
25
  device: str
26
 
27
 
28
+ def create_app(model_path: str | None = None, device: str | None = None) -> FastAPI:
29
+ path = model_path or os.environ.get("PLUTO_MODEL", "omida-ai/pluto-1")
30
+ engine = load_engine(path, device=device or os.environ.get("PLUTO_DEVICE"))
31
  api_key = os.environ.get("PLUTO_API_KEY")
32
  app = FastAPI(title="Pluto Decision API", version="0.1.0")
33
 
docs/LOCAL_INFERENCE.md ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Local inference
2
+
3
+ Pluto-1 is a two-encoder ensemble. The supported runtime is the PyTorch package
4
+ under `code/`; it loads both encoders, the per-question heads, and the ensemble
5
+ calibration.
6
+
7
+ ## Tested environment
8
+
9
+ - **CPU, clean virtual environment:** Python 3.13.13, `torch 2.15.0+cpu`,
10
+ `transformers 5.22.0`, `huggingface_hub 2.4.0`, `fastapi 0.162.0`,
11
+ `uvicorn 0.54.0`.
12
+ - **CUDA:** Windows, NVIDIA GeForce RTX 5060 Ti 16GB, driver 610.74,
13
+ Python 3.13.13, `torch 2.11.0+cu128`, `transformers 5.21.0`,
14
+ `huggingface_hub 2.3.0`.
15
+
16
+ No performance or memory figures are claimed here.
17
+
18
+ ## Install
19
+
20
+ The model is private during release preparation. Set `HF_TOKEN` to a token with
21
+ read access to `omida-ai/pluto-1`. Once the repository is public, the token and
22
+ `HF_TOKEN` lines can be omitted.
23
+
24
+ ### Windows PowerShell (tested)
25
+
26
+ ```powershell
27
+ python -m venv .venv
28
+ .venv\Scripts\python -m pip install --upgrade pip
29
+ .venv\Scripts\python -m pip install huggingface_hub
30
+ $env:HF_TOKEN="hf_..."
31
+ .venv\Scripts\hf.exe download omida-ai/pluto-1 --local-dir pluto-1
32
+ .venv\Scripts\python -m pip install -e "pluto-1/code[serve]"
33
+ .venv\Scripts\pluto.exe --model pluto-1 info
34
+ ```
35
+
36
+ ### Linux/macOS
37
+
38
+ These are the same package commands using the venv’s `bin/` paths; they were not
39
+ exercised on the Windows test host.
40
+
41
+ ```bash
42
+ python3 -m venv .venv
43
+ .venv/bin/python -m pip install --upgrade pip
44
+ .venv/bin/python -m pip install huggingface_hub
45
+ export HF_TOKEN="hf_..."
46
+ .venv/bin/hf download omida-ai/pluto-1 --local-dir pluto-1
47
+ .venv/bin/python -m pip install -e "pluto-1/code[serve]"
48
+ .venv/bin/pluto --model pluto-1 info
49
+ ```
50
+
51
+ ## Device selection
52
+
53
+ The loader chooses CUDA automatically when a working CUDA PyTorch build is
54
+ available. Force CPU with `--device cpu`; force CUDA with `--device cuda`.
55
+
56
+ ```powershell
57
+ .venv\Scripts\pluto.exe --model pluto-1 --device cpu info
58
+ .venv\Scripts\pluto.exe --model pluto-1 --device cuda info
59
+ ```
60
+
61
+ For CUDA, use a CUDA PyTorch build before installing the runtime. The build used
62
+ in testing was:
63
+
64
+ ```powershell
65
+ .venv\Scripts\python -m pip install torch --index-url https://download.pytorch.org/whl/cu128
66
+ ```
67
+
68
+ The default PyPI wheel in the clean CPU test was `torch 2.15.0+cpu`.
69
+
70
+ ## Python
71
+
72
+ From the parent directory that contains `pluto-1/`:
73
+
74
+ ```python
75
+ from pluto.ensemble import EnsembleEngine
76
+
77
+ engine = EnsembleEngine("pluto-1")
78
+ result = engine.predict(
79
+ "Invoice #4411 was charged twice.",
80
+ {
81
+ "action": {
82
+ "type": "choice",
83
+ "instructions": "What should happen?",
84
+ "criteria": {
85
+ "continue": "Proceed.",
86
+ "human_review": "Escalate.",
87
+ "stop": "Stop.",
88
+ },
89
+ },
90
+ "needs_review": {"type": "noul", "instructions": "Requires review."},
91
+ "urgency": {
92
+ "type": "score",
93
+ "instructions": "How urgent?",
94
+ "criteria": ["low", "medium", "high"],
95
+ },
96
+ },
97
+ )
98
+ print(result["answers"])
99
+ ```
100
+
101
+ Loading directly from the Hub, without a local checkout:
102
+
103
+ ```python
104
+ from pluto.ensemble import EnsembleEngine
105
+
106
+ engine = EnsembleEngine.from_pretrained("omida-ai/pluto-1")
107
+ ```
108
+
109
+ `from_pretrained` accepts `token=` when the repository is private.
110
+
111
+ ## CLI
112
+
113
+ Create `questions.json`:
114
+
115
+ ```json
116
+ {
117
+ "action": {
118
+ "type": "choice",
119
+ "instructions": "What should the system do?",
120
+ "criteria": {"continue": "Proceed.", "human_review": "Escalate.", "stop": "Stop."}
121
+ },
122
+ "needs_review": {"type": "noul", "instructions": "Requires review."},
123
+ "urgency": {
124
+ "type": "score",
125
+ "instructions": "How urgent?",
126
+ "criteria": ["low", "medium", "high"]
127
+ }
128
+ }
129
+ ```
130
+
131
+ Run a decision:
132
+
133
+ ```powershell
134
+ .venv\Scripts\pluto.exe --model pluto-1 --device cpu predict `
135
+ --state "Trace: tool error 1, no irreversible actions, 7 steps." `
136
+ --questions questions.json
137
+ ```
138
+
139
+ The output contains `answers.action` (choice), `answers.needs_review.noul`
140
+ (probability of true), and `answers.urgency.score` (expected level).
141
+
142
+ ## HTTP server
143
+
144
+ Start the Jev-compatible server:
145
+
146
+ ```powershell
147
+ .venv\Scripts\pluto.exe --model pluto-1 --device cpu serve --host 127.0.0.1 --port 8000
148
+ ```
149
+
150
+ Check it:
151
+
152
+ ```powershell
153
+ curl.exe -s http://127.0.0.1:8000/health
154
+ ```
155
+
156
+ Send a decision request (`request.json` contains `state` plus the
157
+ `questions` object shown above):
158
+
159
+ ```powershell
160
+ curl.exe -s -H "Content-Type: application/json" --data-binary "@request.json" `
161
+ http://127.0.0.1:8000/v1/systemone
162
+ ```
163
+
164
+ ## Hub-only CLI load
165
+
166
+ ```powershell
167
+ .venv\Scripts\pluto.exe --model omida-ai/pluto-1 --device cpu info
168
+ ```
169
+
170
+ The first Hub-only load downloads the repository. Later loads reuse the local
171
+ Hugging Face cache.
172
+
173
+ ## Supported question names
174
+
175
+ Pluto-1 is fitted for these fixed Typed Decisions question names:
176
+
177
+ `action`, `needs_review`, `outcome`, `risk`, `urgency`, `category`,
178
+ `churn_risk`, `needs_human`, `discrepancy_severity`, `duplicate`,
179
+ `matches_order`, `credential_compromise`, `severity`, `true_positive`.
180
+
181
+ Arbitrary new question names are not supported by this specialist checkpoint.