opendxp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- opendxp-0.1.0/.gitignore +14 -0
- opendxp-0.1.0/CHANGELOG.md +17 -0
- opendxp-0.1.0/CONTRIBUTING.md +50 -0
- opendxp-0.1.0/LICENSE +176 -0
- opendxp-0.1.0/NOTICE +21 -0
- opendxp-0.1.0/PAPER.md +74 -0
- opendxp-0.1.0/PKG-INFO +211 -0
- opendxp-0.1.0/README.md +164 -0
- opendxp-0.1.0/RELEASING.md +54 -0
- opendxp-0.1.0/SPEC.md +498 -0
- opendxp-0.1.0/VALIDATION.md +168 -0
- opendxp-0.1.0/badge/BADGE.md +51 -0
- opendxp-0.1.0/badge/opendxp-compatible.svg +12 -0
- opendxp-0.1.0/badge/opendxp-portable.svg +12 -0
- opendxp-0.1.0/pyproject.toml +84 -0
- opendxp-0.1.0/schemas/calibration.schema.json +34 -0
- opendxp-0.1.0/schemas/check-report.schema.json +41 -0
- opendxp-0.1.0/schemas/conformance-case.schema.json +42 -0
- opendxp-0.1.0/schemas/odxp.schema.json +101 -0
- opendxp-0.1.0/schemas/prompt.schema.json +112 -0
- opendxp-0.1.0/schemas/request.schema.json +62 -0
- opendxp-0.1.0/schemas/response.schema.json +56 -0
- opendxp-0.1.0/schemas/template.schema.json +98 -0
- opendxp-0.1.0/scripts/build_requests.py +862 -0
- opendxp-0.1.0/scripts/decider_token_ids.py +59 -0
- opendxp-0.1.0/scripts/julia_parity.py +71 -0
- opendxp-0.1.0/scripts/llama_numerics.py +105 -0
- opendxp-0.1.0/scripts/prefix_sharing.py +135 -0
- opendxp-0.1.0/src/opendxp/__init__.py +26 -0
- opendxp-0.1.0/src/opendxp/__main__.py +3 -0
- opendxp-0.1.0/src/opendxp/answers.py +96 -0
- opendxp-0.1.0/src/opendxp/calibration.py +71 -0
- opendxp-0.1.0/src/opendxp/cli.py +203 -0
- opendxp-0.1.0/src/opendxp/conformance.py +325 -0
- opendxp-0.1.0/src/opendxp/data/requests-0.1.jsonl +52 -0
- opendxp-0.1.0/src/opendxp/errors.py +23 -0
- opendxp-0.1.0/src/opendxp/export/__init__.py +7 -0
- opendxp-0.1.0/src/opendxp/export/common.py +88 -0
- opendxp-0.1.0/src/opendxp/export/decider.py +169 -0
- opendxp-0.1.0/src/opendxp/export/encoder.py +105 -0
- opendxp-0.1.0/src/opendxp/export/julia.py +373 -0
- opendxp-0.1.0/src/opendxp/export/laya.py +241 -0
- opendxp-0.1.0/src/opendxp/export/onnx_graph.py +200 -0
- opendxp-0.1.0/src/opendxp/native/__init__.py +120 -0
- opendxp-0.1.0/src/opendxp/native/decider.py +348 -0
- opendxp-0.1.0/src/opendxp/native/julia.py +317 -0
- opendxp-0.1.0/src/opendxp/package.py +148 -0
- opendxp-0.1.0/src/opendxp/profiles/__init__.py +0 -0
- opendxp-0.1.0/src/opendxp/profiles/causal_letters.py +344 -0
- opendxp-0.1.0/src/opendxp/profiles/encoder_markers.py +378 -0
- opendxp-0.1.0/src/opendxp/providers.py +143 -0
- opendxp-0.1.0/src/opendxp/request.py +114 -0
- opendxp-0.1.0/src/opendxp/runtime.py +32 -0
- opendxp-0.1.0/src/opendxp/schemas.py +44 -0
- opendxp-0.1.0/src/opendxp/spec.py +52 -0
- opendxp-0.1.0/src/opendxp/text.py +64 -0
- opendxp-0.1.0/src/opendxp/tokens.py +39 -0
- opendxp-0.1.0/src/opendxp/validate.py +65 -0
- opendxp-0.1.0/tests/conftest.py +46 -0
- opendxp-0.1.0/tests/generators.py +70 -0
- opendxp-0.1.0/tests/oracles.py +299 -0
- opendxp-0.1.0/tests/test_answers.py +65 -0
- opendxp-0.1.0/tests/test_calibration.py +69 -0
- opendxp-0.1.0/tests/test_conformance.py +280 -0
- opendxp-0.1.0/tests/test_official_mapping.py +96 -0
- opendxp-0.1.0/tests/test_prompt.py +133 -0
- opendxp-0.1.0/tests/test_request.py +57 -0
- opendxp-0.1.0/tests/test_schemas.py +114 -0
- opendxp-0.1.0/tests/test_template.py +134 -0
- opendxp-0.1.0/tests/test_text.py +25 -0
- opendxp-0.1.0/validation/decider-2b/calibration.json +18 -0
- opendxp-0.1.0/validation/decider-2b/check-cpu.json +113 -0
- opendxp-0.1.0/validation/decider-2b/check-metal.json +240 -0
- opendxp-0.1.0/validation/decider-2b/conformance.jsonl +52 -0
- opendxp-0.1.0/validation/decider-2b/llama-numerics.json +20 -0
- opendxp-0.1.0/validation/decider-2b/odxp.json +67 -0
- opendxp-0.1.0/validation/decider-2b/prefix-sharing-cpu.json +18 -0
- opendxp-0.1.0/validation/decider-2b/prefix-sharing-metal.json +18 -0
- opendxp-0.1.0/validation/decider-2b/prompt.json +324 -0
- opendxp-0.1.0/validation/decider-2b/token-ids.json +1 -0
- opendxp-0.1.0/validation/julia-1/calibration.json +9 -0
- opendxp-0.1.0/validation/julia-1/check-coreml.json +110 -0
- opendxp-0.1.0/validation/julia-1/check-cpu.json +109 -0
- opendxp-0.1.0/validation/julia-1/conformance.jsonl +52 -0
- opendxp-0.1.0/validation/julia-1/odxp.json +86 -0
- opendxp-0.1.0/validation/julia-1/parity-cpu.json +1 -0
- opendxp-0.1.0/validation/julia-1/template.json +69 -0
- opendxp-0.1.0/validation/julia-1-official/calibration.json +9 -0
- opendxp-0.1.0/validation/julia-1-official/check-cpu.json +109 -0
- opendxp-0.1.0/validation/julia-1-official/conformance.jsonl +52 -0
- opendxp-0.1.0/validation/julia-1-official/odxp.json +92 -0
- opendxp-0.1.0/validation/julia-1-official/parity-cpu.json +1 -0
- opendxp-0.1.0/validation/julia-1-official/template.json +69 -0
- opendxp-0.1.0/validation/laya-main/calibration.json +66 -0
- opendxp-0.1.0/validation/laya-main/check-cpu.json +109 -0
- opendxp-0.1.0/validation/laya-main/conformance.jsonl +52 -0
- opendxp-0.1.0/validation/laya-main/odxp.json +86 -0
- opendxp-0.1.0/validation/laya-main/template.json +69 -0
- opendxp-0.1.0/validation/laya-multilingual/calibration.json +20 -0
- opendxp-0.1.0/validation/laya-multilingual/check-cpu.json +109 -0
- opendxp-0.1.0/validation/laya-multilingual/conformance.jsonl +52 -0
- opendxp-0.1.0/validation/laya-multilingual/odxp.json +86 -0
- opendxp-0.1.0/validation/laya-multilingual/template.json +69 -0
- opendxp-0.1.0/validation/laya-typed-decisions/calibration.json +66 -0
- opendxp-0.1.0/validation/laya-typed-decisions/check-cpu.json +109 -0
- opendxp-0.1.0/validation/laya-typed-decisions/conformance.jsonl +52 -0
- opendxp-0.1.0/validation/laya-typed-decisions/odxp.json +86 -0
- opendxp-0.1.0/validation/laya-typed-decisions/template.json +69 -0
opendxp-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
The first release of OpenDXP, the Open Decision Exchange Protocol, and its
|
|
6
|
+
reference implementation.
|
|
7
|
+
|
|
8
|
+
- The standard, `odxp/0.1`: packages (`odxp.json` and the files it names by
|
|
9
|
+
SHA-256), the `encoder-markers` and `causal-letters` profiles, calibration,
|
|
10
|
+
conformance files and compatibility levels, with JSON Schemas for every file.
|
|
11
|
+
- Reference runtimes on ONNX Runtime and llama.cpp (CPU and GPU builds).
|
|
12
|
+
`--device auto` uses CUDA when available and the CPU otherwise; Core ML,
|
|
13
|
+
OpenVINO, QNN and DirectML are used when named.
|
|
14
|
+
- `opendxp export` for Laya, Julia 1 and Decider; `opendxp conformance
|
|
15
|
+
generate` from the models' own code; `opendxp check`, `validate`, `run` and
|
|
16
|
+
`info`.
|
|
17
|
+
- The OpenDXP 0.1 request set: 52 requests, 91 questions, 11 languages.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Contributing to OpenDXP
|
|
2
|
+
|
|
3
|
+
OpenDXP is a standard first and code second. A change to what a package means
|
|
4
|
+
is a change to SPEC.md, the schemas and the reference runtime together.
|
|
5
|
+
|
|
6
|
+
## What is most useful
|
|
7
|
+
|
|
8
|
+
- **A model the profiles cannot describe.** Open an issue with the model, the
|
|
9
|
+
exact input construction of its own code, and what `template.json` or
|
|
10
|
+
`prompt.json` would need. This is how the standard grows.
|
|
11
|
+
- **A converter** for another model family (Von, open-jev, Kev, Nimble, ...):
|
|
12
|
+
`src/opendxp/export/<family>.py`, a native adapter in `src/opendxp/native/`
|
|
13
|
+
that runs the model's own code, and the validation results.
|
|
14
|
+
- **Another engine.** The standard is language-neutral. An engine in Rust,
|
|
15
|
+
Go or JavaScript that passes the conformance files of the published
|
|
16
|
+
packages is the strongest test of the spec; report where SPEC.md was
|
|
17
|
+
ambiguous.
|
|
18
|
+
- **Backend results**: `opendxp check --device <backend>` on hardware we do not
|
|
19
|
+
have (CUDA, OpenVINO, QNN, DirectML, ROCm), with the report JSON.
|
|
20
|
+
|
|
21
|
+
## Rules for changes
|
|
22
|
+
|
|
23
|
+
1. **Normative changes** (anything in SPEC.md that uses MUST, SHOULD or MAY,
|
|
24
|
+
the schemas, `src/opendxp/spec.py`) need an issue first, and bump the
|
|
25
|
+
standard's version when they change what an existing package means.
|
|
26
|
+
2. **Conformance files are generated by the model's own code**, never by the
|
|
27
|
+
reference runtime, and record which code and versions produced them. A
|
|
28
|
+
converter that needed model-specific logic in the runtime to pass has not
|
|
29
|
+
passed: move that logic into the declarative files or propose a spec change.
|
|
30
|
+
3. **No invented numbers.** VALIDATION.md and the paper report only what a
|
|
31
|
+
report file in the repository or the packages supports.
|
|
32
|
+
4. **Nothing in a package executes.** No templates with logic, no pickles, no
|
|
33
|
+
`trust_remote_code`.
|
|
34
|
+
|
|
35
|
+
## Development
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
python -m venv .venv && . .venv/bin/activate
|
|
39
|
+
pip install -e ".[dev,onnx]"
|
|
40
|
+
pytest # no downloads; a tokenizer is built in memory
|
|
41
|
+
ruff check src tests scripts && ruff format --check src tests scripts
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The request set lives in `scripts/build_requests.py`; run it to regenerate
|
|
45
|
+
`src/opendxp/data/requests-0.1.jsonl`. Changing it changes the standard's
|
|
46
|
+
conformance set: packages then need their conformance files regenerated.
|
|
47
|
+
|
|
48
|
+
Commits: one logical change each, with a message that says what changed and
|
|
49
|
+
why. Sign-off is not required. By contributing you agree that your
|
|
50
|
+
contribution is licensed under Apache-2.0.
|
opendxp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
opendxp-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
OpenDXP, the Open Decision Exchange Protocol
|
|
2
|
+
Copyright 2026 System One Models
|
|
3
|
+
|
|
4
|
+
This product includes software derived from:
|
|
5
|
+
|
|
6
|
+
- laya (convaiinnovations/laya), Apache-2.0: the input construction reproduced
|
|
7
|
+
declaratively in the Laya converter (laya/common.py build_sequence,
|
|
8
|
+
render_options, clamp_temperature, temp_bucket).
|
|
9
|
+
- Julia 1 (SupersonicLabs/Julia-1, revision a85b127321d580d65176c89ced8273f305745d85),
|
|
10
|
+
Apache-2.0: the JuliaDecisionModel inference subset in opendxp/export/julia.py
|
|
11
|
+
(julia/model.py), the input construction reproduced in its template
|
|
12
|
+
(julia/data.py sequence()), and its inference path rebuilt in
|
|
13
|
+
opendxp/native/julia.py (model.py, data.py, router/engine.py, typed.py).
|
|
14
|
+
- Decider (github.com/Mapika/decider at 23579f7a, decider-ai 1.6.0), Apache-2.0:
|
|
15
|
+
the prompt layout, labels, isolated score levels and temperatures reproduced
|
|
16
|
+
declaratively in the Decider converter (decider/prompt.py, prompt_fast.py,
|
|
17
|
+
systemone.py, temperature.py, engine_gguf.py), and its request rendering,
|
|
18
|
+
prompt construction and GGUF readout rebuilt in opendxp/native/decider.py.
|
|
19
|
+
|
|
20
|
+
OpenDXP packages converted from these models carry the models' own weights and
|
|
21
|
+
remain under the models' licences.
|
opendxp-0.1.0/PAPER.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Paper outline
|
|
2
|
+
|
|
3
|
+
Working title: **OpenDXP: a portable runtime standard for calibrated
|
|
4
|
+
single-pass decision models**
|
|
5
|
+
|
|
6
|
+
This file tracks the paper: its argument, its sections, and which experiments
|
|
7
|
+
are done. Numbers come from [VALIDATION.md](VALIDATION.md) and are measured,
|
|
8
|
+
never estimated.
|
|
9
|
+
|
|
10
|
+
## The argument
|
|
11
|
+
|
|
12
|
+
1. A new kind of model answers typed questions about a state (choose one of
|
|
13
|
+
these options, score on this scale, is this true) with a calibrated
|
|
14
|
+
probability for every option, in one forward pass. Laya, Julia 1 and
|
|
15
|
+
Decider are three of them, from three teams, with three architectures.
|
|
16
|
+
2. Each ships its own inference code. Running, deploying or comparing them
|
|
17
|
+
means installing, trusting and wrapping each one. Formats such as ONNX and
|
|
18
|
+
GGUF carry the weights but not the rest: how the input is built from the
|
|
19
|
+
request, where the answer is read, how it is calibrated.
|
|
20
|
+
3. OpenDXP puts the rest in the package as data (a template or a prompt, and
|
|
21
|
+
temperatures), so one engine runs every model with no code written for it
|
|
22
|
+
and nothing from the package executed.
|
|
23
|
+
4. Faithfulness is testable: the package carries a conformance file of what
|
|
24
|
+
the model's own code answers, and an engine passes when it reproduces it
|
|
25
|
+
within 0.01 with the same decisions.
|
|
26
|
+
5. Two profiles cover the models we know of: bidirectional encoders that
|
|
27
|
+
score a marker token per option, and causal language models read at an
|
|
28
|
+
answer letter.
|
|
29
|
+
|
|
30
|
+
## Sections
|
|
31
|
+
|
|
32
|
+
1. **Introduction.** System One models; the cost of one runtime per model;
|
|
33
|
+
the contribution: the standard, the conformance method, a reference
|
|
34
|
+
implementation and three conversions.
|
|
35
|
+
2. **Background.** Calibrated classification and temperature scaling (Guo et
|
|
36
|
+
al., 2017); marker-based encoders (Laya, Julia 1); letter-probability
|
|
37
|
+
readout from language models (Decider); ONNX and GGUF as weight formats;
|
|
38
|
+
loading model code at run time (`trust_remote_code`) and why a standard
|
|
39
|
+
should not need it.
|
|
40
|
+
3. **The standard.** Requests and answers; packages with nothing executable;
|
|
41
|
+
the two profiles; calibration as data; conformance files and the
|
|
42
|
+
comparison rule; compatibility levels.
|
|
43
|
+
4. **Reference implementation.** Runtimes for both profiles on ONNX Runtime
|
|
44
|
+
and llama.cpp; converters that copy no weights (ONNX external data pointing
|
|
45
|
+
into the published safetensors); conformance generation from the models'
|
|
46
|
+
own code; the System One Engine and the registry, which run packages and
|
|
47
|
+
show the badge.
|
|
48
|
+
5. **Evaluation.** The experiments below.
|
|
49
|
+
6. **Discussion.** What the tolerance means; backend numerics; sharing
|
|
50
|
+
computation versus exactness; what 0.1 leaves open (SPEC.md 12).
|
|
51
|
+
7. **Conclusion.**
|
|
52
|
+
|
|
53
|
+
## Experiments
|
|
54
|
+
|
|
55
|
+
| # | Question | Status |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| E1 | Do packages reproduce their models' own answers on a CPU? | **Done.** 6 packages, 3 families, 52/52 cases each, all decisions equal, differences at the 4-decimal rounding floor. |
|
|
58
|
+
| E2 | Does a declarative input description give the same tokens as the models' own code? | **Done.** Decider: 149/149 rows identical. Laya and Julia: input construction tested against their own code (tests/). |
|
|
59
|
+
| E3 | Can a model's own ONNX export become a package without exporting again? | **Done.** Julia 1's published graph, renamed and pointed at its checkpoint: 52/52, and 100/100 on its authors' parity cases. |
|
|
60
|
+
| E4 | Do packages stay faithful on accelerator backends? | **Partly.** Julia on Core ML passes (level 3). Decider on Metal keeps every decision but not the probabilities (max 0.036). CUDA, ROCm, OpenVINO, QNN, DirectML to do. |
|
|
61
|
+
| E5 | What moves a causal model's probabilities? | **Done on one machine.** Flash attention off on the CPU: up to 0.014. Metal: 0.036 whatever the attention or cache settings. |
|
|
62
|
+
| E6 | What does sharing the prompt prefix cost in faithfulness? | **Done on one machine.** CPU: 1.8x faster over the set, up to 0.018, and one near-tie decision of 91 changed; Metal: 1.6x faster, nothing added. To repeat on an x86 server. |
|
|
63
|
+
| E7 | What does a package cost? | **Done on one machine.** 3 to 5 MB of graph per encoder package, no weight copies; load and latency per backend. Server numbers to do. |
|
|
64
|
+
| E8 | Is 0.01 the right tolerance? | **To do.** The distribution of differences, and of decision flips, across backends and quantisations. |
|
|
65
|
+
| E9 | Can someone else convert a model from the spec alone? | **To do.** A Laya Studio fine-tune and a model from outside the three families, converted by their authors. |
|
|
66
|
+
|
|
67
|
+
## Before submission
|
|
68
|
+
|
|
69
|
+
- E4, E6 and E7 on an x86 server CPU and at least one NVIDIA GPU.
|
|
70
|
+
- E8 with quantised variants (int8 ONNX, Q4 GGUF) as derived packages.
|
|
71
|
+
- E9 with at least one team outside System One Models.
|
|
72
|
+
- Credit and permission: the model authors (Convai Innovations, Supersonic
|
|
73
|
+
Labs, Mark Marosi) are named for their models and asked before their
|
|
74
|
+
results are published.
|
opendxp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: opendxp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: OpenDXP, the Open Decision Exchange Protocol: a portable standard for calibrated single-pass decision models (reference implementation)
|
|
5
|
+
Project-URL: Homepage, https://github.com/systemonemodels/opendxp
|
|
6
|
+
Project-URL: Documentation, https://systemonemodels.tech/docs/opendxp
|
|
7
|
+
Project-URL: Specification, https://github.com/systemonemodels/opendxp/blob/main/SPEC.md
|
|
8
|
+
Project-URL: Validation, https://github.com/systemonemodels/opendxp/blob/main/VALIDATION.md
|
|
9
|
+
Project-URL: Issues, https://github.com/systemonemodels/opendxp/issues
|
|
10
|
+
Author-email: System One Models <ceo@systemonemodels.tech>
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: NOTICE
|
|
14
|
+
Keywords: calibration,conformance,decision-models,gguf,onnx,opendxp,system-one
|
|
15
|
+
Classifier: Development Status :: 3 - Alpha
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Requires-Dist: jsonschema>=4.20
|
|
26
|
+
Requires-Dist: numpy>=1.26
|
|
27
|
+
Requires-Dist: tokenizers>=0.20
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: onnx>=1.17; extra == 'dev'
|
|
30
|
+
Requires-Dist: onnxruntime>=1.20; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
32
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
33
|
+
Provides-Extra: export
|
|
34
|
+
Requires-Dist: onnx-ir>=0.1.15; extra == 'export'
|
|
35
|
+
Requires-Dist: onnx>=1.17; extra == 'export'
|
|
36
|
+
Requires-Dist: onnxscript>=0.5; extra == 'export'
|
|
37
|
+
Requires-Dist: safetensors>=0.4; extra == 'export'
|
|
38
|
+
Requires-Dist: torch>=2.6; extra == 'export'
|
|
39
|
+
Requires-Dist: transformers>=5.2; extra == 'export'
|
|
40
|
+
Provides-Extra: gguf
|
|
41
|
+
Requires-Dist: llama-cpp-python<0.4,>=0.3.35; extra == 'gguf'
|
|
42
|
+
Provides-Extra: laya
|
|
43
|
+
Requires-Dist: laya==0.3.5; extra == 'laya'
|
|
44
|
+
Provides-Extra: onnx
|
|
45
|
+
Requires-Dist: onnxruntime>=1.20; extra == 'onnx'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# OpenDXP
|
|
49
|
+
|
|
50
|
+
**The Open Decision Exchange Protocol: a portable standard for calibrated single-pass decision models.**
|
|
51
|
+
|
|
52
|
+
A System One model reads a state and answers typed questions (choice, score,
|
|
53
|
+
noul) with a calibrated probability for every option, in one pass. Every such
|
|
54
|
+
model ships its own inference code: Laya needs the `laya` package, Julia 1 its
|
|
55
|
+
own package, Decider its own server. To run twenty models you install twenty
|
|
56
|
+
runtimes, and to compare them you write twenty harnesses.
|
|
57
|
+
|
|
58
|
+
OpenDXP makes the model a package that one engine runs without code written for
|
|
59
|
+
it. A package declares which of two **profiles** it follows, carries its
|
|
60
|
+
weights in a portable format (ONNX or GGUF), describes its input construction
|
|
61
|
+
and calibration as data, and ships a **conformance file**: what the model's
|
|
62
|
+
own code answers on a fixed set of requests. An engine that reproduces that
|
|
63
|
+
file within 0.01 in probability, with the same decisions, runs the model
|
|
64
|
+
faithfully.
|
|
65
|
+
|
|
66
|
+
- [SPEC.md](https://github.com/systemonemodels/opendxp/blob/main/SPEC.md): the standard, version 0.1
|
|
67
|
+
- [schemas/](https://github.com/systemonemodels/opendxp/tree/main/schemas): JSON Schemas for every file in a package
|
|
68
|
+
- [VALIDATION.md](https://github.com/systemonemodels/opendxp/blob/main/VALIDATION.md): Laya, Julia 1 and Decider converted and checked
|
|
69
|
+
- [badge/BADGE.md](https://github.com/systemonemodels/opendxp/blob/main/badge/BADGE.md): the "OpenDXP compatible" badge and its criteria
|
|
70
|
+
- [PAPER.md](https://github.com/systemonemodels/opendxp/blob/main/PAPER.md): outline of the paper, and which experiments are done
|
|
71
|
+
|
|
72
|
+
OpenDXP is open: the specification, the schemas and this reference
|
|
73
|
+
implementation are Apache-2.0, and anyone may build an engine for it. The
|
|
74
|
+
[System One Engine](https://systemonemodels.tech/docs/engine), which serves
|
|
75
|
+
the live playgrounds on [System One Models](https://systemonemodels.tech),
|
|
76
|
+
runs OpenDXP packages and shows which models are OpenDXP compatible.
|
|
77
|
+
|
|
78
|
+
## The two profiles
|
|
79
|
+
|
|
80
|
+
| Profile | Models | Weights | The engine reads |
|
|
81
|
+
| --- | --- | --- | --- |
|
|
82
|
+
| `encoder-markers` | Laya, Julia 1, Von, open-jev, GLiNER2.5-Decide | ONNX | `template.json`: how to build the token ids and one marker position per option |
|
|
83
|
+
| `causal-letters` | Decider, Kev, Nimble, JevK5, lev | GGUF | `prompt.json`: the prompt pieces, the option labels and where the answer letter is read |
|
|
84
|
+
|
|
85
|
+
ONNX runs through ONNX Runtime (CPU, CUDA, Core ML, OpenVINO, QNN, DirectML);
|
|
86
|
+
GGUF through llama.cpp (CPU, Metal, CUDA, HIP, SYCL, Vulkan). The engine picks
|
|
87
|
+
the device, not the model's author.
|
|
88
|
+
|
|
89
|
+
## What is here
|
|
90
|
+
|
|
91
|
+
The `opendxp` Python package (Python 3.11+) is the reference implementation:
|
|
92
|
+
|
|
93
|
+
- **Reference runtimes** for both profiles. They read only the package and
|
|
94
|
+
contain nothing specific to any model. The encoder runtime runs on CUDA when
|
|
95
|
+
onnxruntime has it and on the CPU otherwise; Core ML, OpenVINO, QNN and
|
|
96
|
+
DirectML are used when named (`--device coreml`), and it compiles shape
|
|
97
|
+
buckets for providers that need fixed shapes. The causal runtime drives llama.cpp's low-level API, one
|
|
98
|
+
row per decode, with every layer on the GPU when the build has one.
|
|
99
|
+
- **Converters** for Laya, Julia 1 and Decider (`opendxp export`).
|
|
100
|
+
- **The models' own inference** for writing conformance files
|
|
101
|
+
(`opendxp.native`): Laya through the `laya` package; Julia 1 and Decider
|
|
102
|
+
through faithful rebuilds of their authors' code, checked on the authors'
|
|
103
|
+
published cases.
|
|
104
|
+
- **Conformance tools**: `opendxp conformance generate` runs the model's own
|
|
105
|
+
code on the OpenDXP 0.1 request set (52 requests, 91 questions, 11 languages
|
|
106
|
+
including Nepali and Thai); `opendxp check` replays it through the reference
|
|
107
|
+
runtime and writes a JSON report.
|
|
108
|
+
|
|
109
|
+
## Install
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pip install "opendxp[onnx]" # encoder-markers runtime (ONNX Runtime)
|
|
113
|
+
pip install "opendxp[gguf]" # causal-letters runtime (llama-cpp-python)
|
|
114
|
+
pip install "opendxp[export,laya]" # converters (torch, transformers, onnx, onnxscript, laya)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
From a clone, for development:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
pip install -e ".[dev]" # tests and linting
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Use a package
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
import opendxp
|
|
127
|
+
|
|
128
|
+
model = opendxp.load("packages/laya-typed-decisions") # device="auto": the best available
|
|
129
|
+
out = model.predict(
|
|
130
|
+
"Customer: I was charged twice and still have no refund.",
|
|
131
|
+
{
|
|
132
|
+
"intent": {"type": "choice", "instructions": "What does the customer want?",
|
|
133
|
+
"criteria": {"refund": None, "cancel order": None, "other": None}},
|
|
134
|
+
"urgency": {"type": "score", "instructions": "How urgent is this?",
|
|
135
|
+
"criteria": ["low", "medium", "high"]},
|
|
136
|
+
"angry": {"type": "noul", "instructions": "The customer is angry."},
|
|
137
|
+
},
|
|
138
|
+
)
|
|
139
|
+
# {"answers": {"intent": {"type": "choice", "choice": ..., "probabilities": {...}, "confidence": ...},
|
|
140
|
+
# "urgency": {"type": "score", "score": ..., "legend": {...}, "probabilities": {...}, ...},
|
|
141
|
+
# "angry": {"type": "noul", "noul": ..., ...}},
|
|
142
|
+
# "usage": {"input_tokens": ..., "output_tokens": 0}}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
From the shell: `opendxp run PACKAGE --request request.json [--device cpu|coreml|cuda|gpu]`.
|
|
146
|
+
`opendxp info` lists this machine's backends.
|
|
147
|
+
|
|
148
|
+
## Convert a model and check it
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# 1. Convert: the package's graph references the checkpoint's weights, so it adds a few MB.
|
|
152
|
+
opendxp export laya ckpt/laya-typed-decisions packages/laya-typed-decisions
|
|
153
|
+
opendxp export julia ckpt/julia-1 packages/julia-1
|
|
154
|
+
opendxp export decider ckpt/decider-2b-gguf packages/decider-2b
|
|
155
|
+
|
|
156
|
+
# 2. Record what the model's own code answers (on the CPU).
|
|
157
|
+
opendxp conformance generate packages/julia-1 --native ckpt/julia-1 --runtime julia
|
|
158
|
+
|
|
159
|
+
# 3. Replay it through the reference runtime.
|
|
160
|
+
opendxp check packages/julia-1 # the reference: CPU
|
|
161
|
+
opendxp check packages/julia-1 --device coreml # a backend: Core ML
|
|
162
|
+
opendxp validate packages/julia-1 # schemas, parsers, coverage, hashes
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
`--runtime laya` uses the `laya` package (the `laya` extra);
|
|
166
|
+
`julia` and `decider` use `opendxp.native` (with the `export` extra, and
|
|
167
|
+
llama-cpp-python for Decider).
|
|
168
|
+
|
|
169
|
+
## Make your model OpenDXP compatible
|
|
170
|
+
|
|
171
|
+
1. **Pick the profile.** If your model scores a marker token per option with a
|
|
172
|
+
bidirectional encoder, it is `encoder-markers`. If it is a language model
|
|
173
|
+
that reads the probability of option letters after a prompt, it is
|
|
174
|
+
`causal-letters`.
|
|
175
|
+
2. **Export the weights.** encoder-markers: ONNX with the signature in SPEC.md
|
|
176
|
+
5.4 (`input_ids`, `attention_mask`, `marker_positions`, `marker_mask`,
|
|
177
|
+
`question_type` → `option_logits`), dynamic dimensions named `batch`,
|
|
178
|
+
`tokens`, `options`. `opendxp.export.onnx_graph.export_graph` does this for
|
|
179
|
+
any torch module with that forward, and points the graph at your
|
|
180
|
+
`model.safetensors` instead of copying it. causal-letters: your GGUF file.
|
|
181
|
+
3. **Describe the input as data.** Write `template.json` or `prompt.json`
|
|
182
|
+
(SPEC.md sections 5 and 6): the head and option texts, the special tokens,
|
|
183
|
+
the budgets and truncation rule, or the prompt pieces, labels and score
|
|
184
|
+
mode. If your input cannot be described this way, open an issue: that is
|
|
185
|
+
what the next version of the standard needs to know.
|
|
186
|
+
4. **Declare calibration**: the temperatures your code applies, by type and
|
|
187
|
+
option count (section 7).
|
|
188
|
+
5. **Generate conformance with your own code.** Add a native adapter in
|
|
189
|
+
`src/opendxp/native/` that loads your model with your package and returns
|
|
190
|
+
System One answers, then run `opendxp conformance generate`. The file records
|
|
191
|
+
which code produced it.
|
|
192
|
+
6. **Check.** `opendxp check` must pass on the CPU (level 2, "OpenDXP compatible";
|
|
193
|
+
SPEC.md section 10). Put the report next to the package and the badge in
|
|
194
|
+
your model card.
|
|
195
|
+
|
|
196
|
+
## Tests
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
pytest
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The tests port the models' own input construction verbatim (Laya's
|
|
203
|
+
`build_sequence`, Julia's `sequence()`, Decider's prompt builder) and require
|
|
204
|
+
the declarative templates to give the same token ids, marker positions and
|
|
205
|
+
refusals on hundreds of random requests. A toy ONNX graph with the standard
|
|
206
|
+
signature exercises generate and check end to end. Nothing is downloaded.
|
|
207
|
+
|
|
208
|
+
## Licence
|
|
209
|
+
|
|
210
|
+
Apache-2.0. Converted packages carry the models' own weights and remain under
|
|
211
|
+
the models' licences (see NOTICE).
|