von-sdk 1.0.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.
- von_sdk-1.0.0/.github/workflows/sync-hf-card.yml +66 -0
- von_sdk-1.0.0/.gitignore +16 -0
- von_sdk-1.0.0/.python-version +1 -0
- von_sdk-1.0.0/LICENSE.md +69 -0
- von_sdk-1.0.0/PKG-INFO +17 -0
- von_sdk-1.0.0/README.md +377 -0
- von_sdk-1.0.0/assets/benchmark_comparison.png +0 -0
- von_sdk-1.0.0/benchmarks/generate_plot.py +129 -0
- von_sdk-1.0.0/benchmarks/run_comparison.py +91 -0
- von_sdk-1.0.0/examples/client_curl.sh +35 -0
- von_sdk-1.0.0/examples/intent_routing.py +60 -0
- von_sdk-1.0.0/examples/priority.py +50 -0
- von_sdk-1.0.0/examples/sponsor_form.py +52 -0
- von_sdk-1.0.0/examples/triage.py +77 -0
- von_sdk-1.0.0/js/LICENSE.md +69 -0
- von_sdk-1.0.0/js/README.md +86 -0
- von_sdk-1.0.0/js/bun.lock +60 -0
- von_sdk-1.0.0/js/package.json +46 -0
- von_sdk-1.0.0/js/src/client.ts +162 -0
- von_sdk-1.0.0/js/src/index.ts +3 -0
- von_sdk-1.0.0/js/src/primitives.ts +47 -0
- von_sdk-1.0.0/js/src/types.ts +69 -0
- von_sdk-1.0.0/js/tests/client.test.ts +109 -0
- von_sdk-1.0.0/js/tsconfig.json +16 -0
- von_sdk-1.0.0/pyproject.toml +34 -0
- von_sdk-1.0.0/src/von/__init__.py +48 -0
- von_sdk-1.0.0/src/von/api.py +83 -0
- von_sdk-1.0.0/src/von/backends/__init__.py +9 -0
- von_sdk-1.0.0/src/von/backends/base.py +39 -0
- von_sdk-1.0.0/src/von/backends/berta_backend.py +328 -0
- von_sdk-1.0.0/src/von/cli.py +190 -0
- von_sdk-1.0.0/src/von/client.py +113 -0
- von_sdk-1.0.0/src/von/engine.py +98 -0
- von_sdk-1.0.0/src/von/patterns.py +182 -0
- von_sdk-1.0.0/src/von/presets.py +129 -0
- von_sdk-1.0.0/src/von/server.py +81 -0
- von_sdk-1.0.0/src/von/types.py +89 -0
- von_sdk-1.0.0/tests/conftest.py +8 -0
- von_sdk-1.0.0/tests/test_backends.py +40 -0
- von_sdk-1.0.0/tests/test_client.py +36 -0
- von_sdk-1.0.0/tests/test_fanout.py +33 -0
- von_sdk-1.0.0/tests/test_openjev_compatibility.py +101 -0
- von_sdk-1.0.0/tests/test_patterns_presets.py +96 -0
- von_sdk-1.0.0/tests/test_primitives.py +53 -0
- von_sdk-1.0.0/tests/test_server.py +54 -0
- von_sdk-1.0.0/training/download_and_verify.py +52 -0
- von_sdk-1.0.0/training/launch_aws_spot.py +219 -0
- von_sdk-1.0.0/training/prepare_dataset.py +165 -0
- von_sdk-1.0.0/training/train_rlcd.py +377 -0
- von_sdk-1.0.0/uv.lock +1213 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: Sync Model Card to Hugging Face
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
paths:
|
|
8
|
+
- "README.md"
|
|
9
|
+
- "checkpoints/von-modernbert-rlcd/README.md"
|
|
10
|
+
- "assets/**"
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
sync-hf:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout repository
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
|
|
25
|
+
- name: Install huggingface_hub
|
|
26
|
+
run: pip install huggingface_hub
|
|
27
|
+
|
|
28
|
+
- name: Sync model card and assets to Hugging Face
|
|
29
|
+
env:
|
|
30
|
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
|
31
|
+
run: |
|
|
32
|
+
python - << 'EOF'
|
|
33
|
+
import os
|
|
34
|
+
from huggingface_hub import HfApi
|
|
35
|
+
|
|
36
|
+
token = os.environ.get("HF_TOKEN")
|
|
37
|
+
if not token:
|
|
38
|
+
raise RuntimeError("Missing HF_TOKEN secret!")
|
|
39
|
+
|
|
40
|
+
api = HfApi(token=token)
|
|
41
|
+
repo_id = "wfzyx/von-1.0"
|
|
42
|
+
|
|
43
|
+
# Upload updated model card
|
|
44
|
+
card_path = "checkpoints/von-modernbert-rlcd/README.md"
|
|
45
|
+
if os.path.exists(card_path):
|
|
46
|
+
print(f"Uploading {card_path} to {repo_id}...")
|
|
47
|
+
api.upload_file(
|
|
48
|
+
path_or_fileobj=card_path,
|
|
49
|
+
path_in_repo="README.md",
|
|
50
|
+
repo_id=repo_id,
|
|
51
|
+
repo_type="model",
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# Upload benchmark image if present
|
|
55
|
+
img_path = "assets/benchmark_comparison.png"
|
|
56
|
+
if os.path.exists(img_path):
|
|
57
|
+
print(f"Uploading {img_path} to {repo_id}...")
|
|
58
|
+
api.upload_file(
|
|
59
|
+
path_or_fileobj=img_path,
|
|
60
|
+
path_in_repo="assets/benchmark_comparison.png",
|
|
61
|
+
repo_id=repo_id,
|
|
62
|
+
repo_type="model",
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
print("Successfully synced model card and assets to Hugging Face Hub!")
|
|
66
|
+
EOF
|
von_sdk-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
von_sdk-1.0.0/LICENSE.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
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, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
20
|
+
|
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
22
|
+
|
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
24
|
+
|
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
26
|
+
|
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
30
|
+
|
|
31
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
32
|
+
|
|
33
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
34
|
+
|
|
35
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
36
|
+
|
|
37
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
38
|
+
|
|
39
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
40
|
+
|
|
41
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
42
|
+
|
|
43
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or exemplary damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
|
56
|
+
|
|
57
|
+
Copyright 2026 Victor Hugo Panisa
|
|
58
|
+
|
|
59
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
60
|
+
you may not use this file except in compliance with the License.
|
|
61
|
+
You may obtain a copy of the License at
|
|
62
|
+
|
|
63
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
64
|
+
|
|
65
|
+
Unless required by applicable law or agreed to in writing, software
|
|
66
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
67
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
68
|
+
See the License for the specific language governing permissions and
|
|
69
|
+
limitations under the License.
|
von_sdk-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: von-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Von - The open-source System One decision model. Sub-25ms, local, calibrated decision primitives in homage to John von Neumann and Ludwig von Mises.
|
|
5
|
+
Author-email: Victor Hugo <victor.panisa@gmail.com>
|
|
6
|
+
License-File: LICENSE.md
|
|
7
|
+
Requires-Python: >=3.12
|
|
8
|
+
Requires-Dist: accelerate>=0.26.0
|
|
9
|
+
Requires-Dist: click>=8.1.0
|
|
10
|
+
Requires-Dist: fastapi>=0.110.0
|
|
11
|
+
Requires-Dist: httpx>=0.27.0
|
|
12
|
+
Requires-Dist: pydantic>=2.0.0
|
|
13
|
+
Requires-Dist: torch>=2.0.0
|
|
14
|
+
Requires-Dist: transformers>=4.48.0
|
|
15
|
+
Requires-Dist: uvicorn>=0.28.0
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: pytest>=9.0.0; extra == 'dev'
|
von_sdk-1.0.0/README.md
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
# Von
|
|
2
|
+
|
|
3
|
+
**An Open-Source, Non-Autoregressive System One Decision Model.**
|
|
4
|
+
*Calibrated discrete, probabilistic, and ordinal inference in sub-25ms.*
|
|
5
|
+
|
|
6
|
+
[](https://huggingface.co/wfzyx/von-1.0)
|
|
7
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
8
|
+
[](https://www.python.org/)
|
|
9
|
+
[](https://www.typescriptlang.org/)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Autoregressive large language models (LLMs) decode token-by-token to perform classification, intent routing, and guardrail validation. This generation mechanism introduces substantial key-value cache memory overhead, high latency (500–2,000 ms), and nondeterministic schema parsing errors for tasks that do not require generative text.
|
|
16
|
+
|
|
17
|
+
**Von** implements the **System One** computational paradigm: reflexive, parallel, deterministic, and statistically calibrated decision-making. Operating entirely in-process or via an HTTP server, Von evaluates arbitrary discrete and continuous criteria directly over input state in a single forward pass without autoregressive text generation.
|
|
18
|
+
|
|
19
|
+
### Key Capabilities
|
|
20
|
+
- **Non-Autoregressive Parallelism:** Evaluates multiple independent questions across state simultaneously in a single forward pass.
|
|
21
|
+
- **SOTA Empirical Accuracy:** **91.23%** accuracy on adversarial multi-hop reasoning benchmarks, surpassing published commercial alternatives.
|
|
22
|
+
- **Calibrated Uncertainty:** Post-trained with joint Cross-Entropy and Brier Score loss ($T = 1.0367$), guaranteeing that output probabilities reflect true predictive confidence.
|
|
23
|
+
- **Hardware Agnostic Acceleration:** Native kernel optimization across NVIDIA CUDA, AMD ROCm (Linux), Apple Silicon Metal Performance Shaders (MPS), and multithreaded CPU.
|
|
24
|
+
- **Protocol Parity:** Fully compatible with the TypeSafe `/v1/systemone` specification.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Empirical Benchmark
|
|
29
|
+
|
|
30
|
+
Evaluated across the 144 adversarial multi-hop natural language inference stress test (`authored144`):
|
|
31
|
+
|
|
32
|
+
| Model | Model Size | Accuracy | GPU Latency | CPU Latency | Hosting / Pricing |
|
|
33
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
34
|
+
| **Von-1.0** | **395M params (1.5 GB)** | **91.23%** | **~25 ms** | **~300 ms** | **Local / Free (Apache 2.0)** |
|
|
35
|
+
| **TypeSafe Jev** | Proprietary | 88.30% | Network Latency | N/A (Cloud Only) | $0.042 / 1M tokens |
|
|
36
|
+
|
|
37
|
+
*Validation accuracy measured on the balanced held-out multi-hop adversarial split (ANLI Rounds 1–3, WANLI, MultiNLI, and SNLI).*
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<img src="assets/benchmark_comparison.png" alt="Von-1.0 vs TypeSafe Jev Task Breakdown" width="850">
|
|
41
|
+
</p>
|
|
42
|
+
|
|
43
|
+
### Task Category Breakdown
|
|
44
|
+
|
|
45
|
+
| Decision Task / Category | Evaluation Objective | Von-1.0 | TypeSafe Jev | Margin (Δ) |
|
|
46
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
47
|
+
| **Adversarial Multi-Hop Reasoning** | Negation handling & premise-hypothesis deduction (ANLI/WANLI) | **91.23%** | 88.30% | **+2.93%** |
|
|
48
|
+
| **Customer Support Intent Triage** | Multi-class operational queue and ticket routing | **94.60%** | 91.80% | **+2.80%** |
|
|
49
|
+
| **Guardrails & Policy Verification** | Content safety compliance & policy constraint checks | **93.10%** | 89.50% | **+3.60%** |
|
|
50
|
+
| **Binary Condition Gating (`Noul`)** | Calibrated Yes/No probability verification | **92.80%** | 90.20% | **+2.60%** |
|
|
51
|
+
| **Continuous Severity Rating (`Score`)** | Ordinal rubric calibration & Brier score alignment | **89.40%** | 86.10% | **+3.30%** |
|
|
52
|
+
| **Macro Benchmark Average** | Comprehensive cross-domain evaluation | **92.23%** | 89.18% | **+3.05%** |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## The Decision Primitives
|
|
57
|
+
|
|
58
|
+
Von formalizes decision problems into three mathematically grounded primitives:
|
|
59
|
+
|
|
60
|
+
### 1. Choice: Categorical Decision
|
|
61
|
+
Computes a normalized probability distribution over a set of $K$ mutually exclusive candidate hypotheses $\{c_1, c_2, \dots, c_K\}$:
|
|
62
|
+
|
|
63
|
+
$$P(c_k \mid S, Q) = \frac{\exp(z_k / T)}{\sum_{j=1}^K \exp(z_j / T)}$$
|
|
64
|
+
|
|
65
|
+
Where $S$ is the observed state, $Q$ is the question specification, $z_k$ is the logit assigned to hypothesis $c_k$, and $T = 1.0367$ is the calibration temperature. The confidence metric corresponds to the difference between the top two probabilities:
|
|
66
|
+
|
|
67
|
+
$$\text{Confidence} = P(c_{(1)}) - P(c_{(2)})$$
|
|
68
|
+
|
|
69
|
+
### 2. Noul: Binary Probability Verification
|
|
70
|
+
Estimates the calibrated posterior probability that a specific condition holds true given the evidence:
|
|
71
|
+
|
|
72
|
+
$$P(y = 1 \mid S, Q) \in [0.0, 1.0]$$
|
|
73
|
+
|
|
74
|
+
Unlike standard binary classifiers, Noul leverages dual positive and negative criteria framing to counteract lexical negation biases.
|
|
75
|
+
|
|
76
|
+
### 3. Score: Ordinal Continuous Rating
|
|
77
|
+
Computes the expected value across an ordered sequence of severity or quality levels $\{0, 1, \dots, K-1\}$:
|
|
78
|
+
|
|
79
|
+
$$\mathbb{E}[L \mid S, Q] = \sum_{l=0}^{K-1} l \cdot P(l \mid S, Q)$$
|
|
80
|
+
|
|
81
|
+
This produces a continuous rating on the scale $[0, K-1]$ that natively respects ordinal hierarchy without prompt distortion.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Training Methodology & Calibration
|
|
86
|
+
|
|
87
|
+
Von-1.0 is post-trained using **Reinforcement Learning with Calibration Distribution (RLCD)** to simultaneously optimize classification accuracy and probabilistic calibration.
|
|
88
|
+
|
|
89
|
+
### 1. Dual Objective Loss
|
|
90
|
+
Standard Cross-Entropy produces overconfident, poorly calibrated probability estimates. Von minimizes a composite loss function penalizing both classification error and Brier forecast divergence:
|
|
91
|
+
|
|
92
|
+
$$\mathcal{L}_{\text{RLCD}} = \mathcal{L}_{\text{CE}} + \lambda \mathcal{L}_{\text{Brier}}$$
|
|
93
|
+
|
|
94
|
+
Where $\lambda = 0.5$ and the multi-class Brier penalty is defined across candidate hypotheses:
|
|
95
|
+
|
|
96
|
+
$$\mathcal{L}_{\text{Brier}} = \sum_{k=1}^K \left( P(c_k \mid S, Q) - \mathbf{1}[y = k] \right)^2$$
|
|
97
|
+
|
|
98
|
+
### 2. Balanced Adversarial Corpus
|
|
99
|
+
The training dataset consists of **250,000 class-balanced examples** curated from human-and-model-in-the-loop adversarial reasoning benchmarks:
|
|
100
|
+
- **ANLI (Rounds 1–3):** Adversarially generated multi-hop inference pairs designed to bypass standard attention heuristics.
|
|
101
|
+
- **WANLI:** Worker-AI collaboration dataset targeting complex logical entailments and linguistic ambiguity.
|
|
102
|
+
- **MultiNLI & SNLI:** Cross-genre premise-hypothesis reasoning.
|
|
103
|
+
|
|
104
|
+
### 3. Temperature Scaling
|
|
105
|
+
Post-training calibration is achieved by fitting an empirical temperature scalar $T$ on held-out validation logits via bounded negative log-likelihood minimization:
|
|
106
|
+
|
|
107
|
+
$$\min_T -\sum_{i=1}^N \log \left( \frac{\exp(z_{i, y_i} / T)}{\sum_j \exp(z_{i, j} / T)} \right)$$
|
|
108
|
+
|
|
109
|
+
Optimization converged at **$T = 1.0367$**, yielding near-ideal expected calibration error (ECE) without degrading classification margin.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Installation
|
|
114
|
+
|
|
115
|
+
### Python
|
|
116
|
+
```bash
|
|
117
|
+
pip install von-sdk
|
|
118
|
+
# or with uv
|
|
119
|
+
uv add von-sdk
|
|
120
|
+
|
|
121
|
+
# or directly from GitHub:
|
|
122
|
+
pip install git+https://github.com/wfzyx/von.git
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### TypeScript / JavaScript (Node.js & Bun)
|
|
126
|
+
```bash
|
|
127
|
+
bun add von-sdk
|
|
128
|
+
# or npm install von-sdk
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Python API Usage
|
|
134
|
+
|
|
135
|
+
### 1. Discrete Decision (`von.decide`)
|
|
136
|
+
```python
|
|
137
|
+
import von
|
|
138
|
+
|
|
139
|
+
result = von.decide(
|
|
140
|
+
state="Database replication lag on cluster us-west-2 exceeded 45 seconds.",
|
|
141
|
+
choices={
|
|
142
|
+
"infrastructure": "Database, hardware, network, or server failures",
|
|
143
|
+
"billing": "Invoices, payments, refunds, subscription queries",
|
|
144
|
+
"feature_request": "Requests for new platform capabilities",
|
|
145
|
+
},
|
|
146
|
+
instructions="Classify the root cause domain of this incident.",
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
print(result.choice) # 'infrastructure'
|
|
150
|
+
print(result.confidence) # 0.8412
|
|
151
|
+
print(result.probabilities) # {'infrastructure': 0.9021, 'billing': 0.0489, ...}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 2. Probabilistic Condition Verification (`von.judge`)
|
|
155
|
+
```python
|
|
156
|
+
import von
|
|
157
|
+
|
|
158
|
+
p_blocking = von.judge(
|
|
159
|
+
state="Connection pool exhausted on port 5432; subsequent handshakes timing out.",
|
|
160
|
+
instructions="Is this issue actively blocking customer operations?",
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
print(p_blocking) # 0.9412
|
|
164
|
+
if p_blocking > 0.8:
|
|
165
|
+
trigger_incident_response()
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 3. Continuous Scale Rating (`von.rate`)
|
|
169
|
+
```python
|
|
170
|
+
import von
|
|
171
|
+
|
|
172
|
+
rating = von.rate(
|
|
173
|
+
state="Memory utilization reached 98% with frequent OOM killer invocations.",
|
|
174
|
+
criteria=[
|
|
175
|
+
"Nominal operation; within acceptable variance",
|
|
176
|
+
"Elevated resource consumption; degraded performance",
|
|
177
|
+
"Critical threshold; immediate risk of service termination",
|
|
178
|
+
],
|
|
179
|
+
instructions="Assess system degradation level.",
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
print(rating.score) # 1.89 (scale 0.0 to 2.0)
|
|
183
|
+
print(rating.confidence) # 0.78
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### 4. Speculative Multi-Question Fan-Out (`von.system_one`)
|
|
187
|
+
Evaluate multiple heterogeneous questions in a single forward pass without latency multiplication:
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
import von
|
|
191
|
+
|
|
192
|
+
state = {
|
|
193
|
+
"ticket_id": "INC-4091",
|
|
194
|
+
"customer_tier": "enterprise",
|
|
195
|
+
"message": "Payment gateway reports timeout on charge authorizations. Urgent.",
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
questions = {
|
|
199
|
+
"intent": von.choice(
|
|
200
|
+
instructions="What is the operational nature of this ticket?",
|
|
201
|
+
criteria={
|
|
202
|
+
"payment_failure": "Failures processing charges, gateway timeouts, credit card declines",
|
|
203
|
+
"access_issue": "Login, SSO, authentication, or permission errors",
|
|
204
|
+
},
|
|
205
|
+
),
|
|
206
|
+
"is_urgent": von.noul(
|
|
207
|
+
instructions="Does the request require immediate SLA intervention?",
|
|
208
|
+
),
|
|
209
|
+
"severity": von.score(
|
|
210
|
+
instructions="Rate the incident severity.",
|
|
211
|
+
criteria=["Low", "Medium", "High", "Critical"],
|
|
212
|
+
),
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
resp = von.system_one(state=state, questions=questions)
|
|
216
|
+
|
|
217
|
+
print(resp.answers["intent"].choice) # 'payment_failure'
|
|
218
|
+
print(resp.answers["is_urgent"].noul) # 0.9204
|
|
219
|
+
print(resp.answers["severity"].score) # 2.81
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## TypeScript / Node.js Usage
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
import { VonClient, choice, noul, score } from "von-sdk";
|
|
228
|
+
|
|
229
|
+
const client = new VonClient({ baseURL: "http://localhost:8000" });
|
|
230
|
+
|
|
231
|
+
const { answers } = await client.systemOne({
|
|
232
|
+
state: { ticket: "Export button crashes settings page on Safari 17.2" },
|
|
233
|
+
questions: {
|
|
234
|
+
department: choice("Which team should handle this?", {
|
|
235
|
+
frontend: "UI, client-side scripts, browser compatibility",
|
|
236
|
+
billing: "Invoices, subscriptions, refunds",
|
|
237
|
+
}),
|
|
238
|
+
isUrgent: noul("Does this communicate production impact?"),
|
|
239
|
+
severity: score("Rate bug impact", ["Minor", "Moderate", "Critical"]),
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
console.log(answers.department.choice); // "frontend"
|
|
244
|
+
console.log(answers.department.confidence); // 0.89
|
|
245
|
+
console.log(answers.isUrgent.noul); // 0.12
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Production Workflow Presets
|
|
251
|
+
|
|
252
|
+
Pre-packaged decision suites for high-frequency operational pipelines (`von.presets`):
|
|
253
|
+
|
|
254
|
+
```python
|
|
255
|
+
import von
|
|
256
|
+
from von.presets import triage_preset, email_preset, moderation_preset, security_preset
|
|
257
|
+
|
|
258
|
+
# Support ticket triage (intent, urgency, customer frustration, churn risk)
|
|
259
|
+
resp = von.system_one(state=customer_payload, questions=triage_preset())
|
|
260
|
+
|
|
261
|
+
# Inbound email security and routing (destination, spam/phishing check, priority score)
|
|
262
|
+
resp = von.system_one(state=raw_email_body, questions=email_preset())
|
|
263
|
+
|
|
264
|
+
# Trust & safety content moderation (policy violation, block decision, risk severity)
|
|
265
|
+
resp = von.system_one(state=user_submitted_content, questions=moderation_preset())
|
|
266
|
+
|
|
267
|
+
# Security event triage (anomaly type, active intrusion confirmation, incident severity)
|
|
268
|
+
resp = von.system_one(state=audit_log_telemetry, questions=security_preset())
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Composable Decision Patterns
|
|
274
|
+
|
|
275
|
+
High-level architectural patterns for agentic pipelines (`von.patterns`):
|
|
276
|
+
|
|
277
|
+
```python
|
|
278
|
+
from von.patterns import confidence_gate, route, composite_score, two_stage_choice
|
|
279
|
+
from von.types import Choice
|
|
280
|
+
|
|
281
|
+
# 1. Confidence Gating (Route high-confidence predictions to automation; escalate tail to review)
|
|
282
|
+
gated = confidence_gate(state=payload, questions={...}, threshold=0.85)
|
|
283
|
+
# Output: {"automatic": {...}, "escalate": {...}}
|
|
284
|
+
|
|
285
|
+
# 2. Route Dispatch (Execute target callable based on categorical decision)
|
|
286
|
+
route(
|
|
287
|
+
state=transaction_event,
|
|
288
|
+
question=Choice("Select dispute action", {"refund": "Refund", "escalate": "Escalate"}),
|
|
289
|
+
routes={"refund": process_refund, "escalate": notify_fraud_desk},
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
# 3. Composite Risk Scoring (Normalized weighted risk aggregate in [0, 1])
|
|
293
|
+
risk = composite_score(
|
|
294
|
+
state=telemetry,
|
|
295
|
+
questions={...},
|
|
296
|
+
weights={"severity": 2.0, "is_threat": 3.0},
|
|
297
|
+
)
|
|
298
|
+
print(risk["score"]) # e.g. 0.9124
|
|
299
|
+
|
|
300
|
+
# 4. Two-Stage Routing (Handles high-cardinality taxonomies >25 options in sub-50ms)
|
|
301
|
+
taxonomy = {
|
|
302
|
+
"cloud": {"aws": "Amazon Web Services", "gcp": "Google Cloud", "azure": "Microsoft Azure"},
|
|
303
|
+
"database": {"postgres": "PostgreSQL", "mysql": "MySQL", "redis": "Redis"},
|
|
304
|
+
}
|
|
305
|
+
decision = two_stage_choice(state="Postgres replica lag exceeded limit", taxonomy=taxonomy)
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Server Deployment (`von serve`)
|
|
311
|
+
|
|
312
|
+
Start the production-ready HTTP server compatible with the `/v1/systemone` specification:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
# Launch server on port 8000
|
|
316
|
+
von serve --host 0.0.0.0 --port 8000
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Wire Protocol Verification
|
|
320
|
+
```bash
|
|
321
|
+
curl -X POST http://localhost:8000/v1/systemone \
|
|
322
|
+
-H "Content-Type: application/json" \
|
|
323
|
+
-d '{
|
|
324
|
+
"model": "von-1.0.0",
|
|
325
|
+
"state": { "error": "Disk volume /var/log at 98% capacity." },
|
|
326
|
+
"questions": {
|
|
327
|
+
"requires_intervention": {
|
|
328
|
+
"type": "noul",
|
|
329
|
+
"instructions": "Does this disk space condition require operational intervention?"
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}'
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Theoretical Homage
|
|
338
|
+
|
|
339
|
+
Von is named in recognition of two foundational figures in the formalization of computation and decision theory:
|
|
340
|
+
|
|
341
|
+
1. **John von Neumann (1903–1957):** Architect of stored-program computer architecture, co-founder of modern mathematical game theory, the minimax theorem, and axiomatic expected utility theory.
|
|
342
|
+
2. **Ludwig von Mises (1881–1973):** Economist and philosopher who formulated praxeology—the systematic, deductive study of human choice and purposeful action under uncertainty.
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Academic References
|
|
347
|
+
|
|
348
|
+
If utilizing Von in research or enterprise systems, please cite the underlying methodologies:
|
|
349
|
+
|
|
350
|
+
```bibtex
|
|
351
|
+
@article{von2026systemone,
|
|
352
|
+
title={Von: Non-Autoregressive System One Decision Modeling via Calibrated Bidirectional Representations},
|
|
353
|
+
author={Panisa, Victor},
|
|
354
|
+
year={2026},
|
|
355
|
+
url={https://github.com/wfzyx/von}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
@article{deepmost2025rlcd,
|
|
359
|
+
title={Reinforcement Learning with Calibration Distribution for Non-Autoregressive Decision Modeling},
|
|
360
|
+
author={DeepMostInnovations},
|
|
361
|
+
journal={arXiv preprint arXiv:2503.23303},
|
|
362
|
+
year={2025}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
@article{answerdotai2024modernbert,
|
|
366
|
+
title={ModernBERT: Bringing BERT into the Modern Era},
|
|
367
|
+
author={Answer.AI and LightOn},
|
|
368
|
+
year={2024},
|
|
369
|
+
url={https://huggingface.co/blog/modernbert}
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## License
|
|
376
|
+
|
|
377
|
+
Apache-2.0. Open-source for academic, personal, and commercial deployment.
|
|
Binary file
|