mirror of
https://github.com/mcloh/decision-models-benchmark.git
synced 2026-11-06 06:14:11 +00:00
Executor de avaliação, métricas e .gitignore para metadados de modelos
- harness/evaluate.py: partição congelada com SHA-256, amostra com seed, lote 1, truncamento comum, contagem de tokens, latência (sem aquecimento), pico de RAM e GPU; teste bloqueado até o congelamento da configuração. - analysis/metrics.py: acurácia, macro F1, Brier, NLL, ECE, acurácia seletiva. - Diagnósticos por resposta (metadata.diagnostics); Laya informa opções colapsadas pelo orçamento de cabeçalho; head_max_len via DMB_LAYA_HEAD_MAX_LEN. - infra/ds/collect.py e gpu_queue --env para pilotos e rodadas. - .gitignore: de models/ só metadados (cards, configs, licenças, índices); pesos, tokenizadores grandes, runtimes, fontes clonados e caches ignorados. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"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.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"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.
|
||||
|
||||
"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).
|
||||
|
||||
"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.
|
||||
|
||||
"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."
|
||||
|
||||
"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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(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
|
||||
|
||||
(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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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 consequential 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.
|
||||
|
||||
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.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2026 XHToken
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,166 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
base_model:
|
||||
- XHToken/Spark-X2.5-4B
|
||||
- XHToken/Spark-X2.5-1.7B
|
||||
library_name: peft
|
||||
tags:
|
||||
- gguf
|
||||
- lora
|
||||
- classification
|
||||
- typed-decisions
|
||||
- rizzo-flow
|
||||
language:
|
||||
- en
|
||||
---
|
||||
|
||||
# Rizzo Flow: Spark-X2.5 (4B and 1.7B) + typed-decisions LoRA
|
||||
|
||||
These are LoRA fine-tunes of [XHToken/Spark-X2.5-4B](https://huggingface.co/XHToken/Spark-X2.5-4B)
|
||||
(recommended) and [XHToken/Spark-X2.5-1.7B](https://huggingface.co/XHToken/Spark-X2.5-1.7B), for [Rizzo Flow](https://github.com/Rizzo-AI-Academy/rizzo-flow). Rizzo Flow turns an unstructured
|
||||
state into typed decisions (`boolean`, `choice`, `score`) with probabilities, and it **generates no
|
||||
text**. The model runs one forward pass per question. The answer is the softmax over the logits of
|
||||
the answer letters (`A`, `B`, …) at the last prompt position.
|
||||
|
||||
Training works the same way. There is no text target: the loss is a soft cross-entropy between the
|
||||
target distribution and the softmax over the answer letters. Only the LoRA adapters are trained.
|
||||
|
||||
This model is not affiliated with TypeSafe, and it is not Jev.
|
||||
|
||||
## Files
|
||||
|
||||
| File | What it is |
|
||||
| --- | --- |
|
||||
| `model-0000*-of-00005.safetensors`, `config.json`, tokenizer files | Merged model, BF16 safetensors (8.2 GB): for the MLX backend and transformers. Same weights as the BF16 GGUF, bit for bit |
|
||||
| `spark-x2.5-4b-rizzo-flow-lora-q8_0.gguf` | Merged model, Q8_0 (4.4 GB): the default for `rizzo serve` |
|
||||
| `spark-x2.5-4b-rizzo-flow-lora-bf16.gguf` | Merged model, BF16 (8.2 GB) |
|
||||
| `spark-x2.5-4b-rizzo-flow-lora-q4_k_m.gguf` | Merged model, Q4_K_M (2.6 GB), for GPUs with little memory |
|
||||
| `lora/` | The PEFT adapter alone (r 16, alpha 32), to apply to the BF16 HF checkpoint |
|
||||
| `training/history.json` | Arguments, training loss and dev evaluations of the 4B run |
|
||||
| `spark-x2.5-1.7b-rizzo-flow-lora-q8_0.gguf` | 1.7B merged model, Q8_0 (1.8 GB) |
|
||||
| `spark-x2.5-1.7b-rizzo-flow-lora-bf16.gguf` | 1.7B merged model, BF16 (3.4 GB) |
|
||||
| `lora-1.7b/` | The 1.7B PEFT adapter alone (r 16, alpha 32) |
|
||||
| `training/history-1.7b.json` | The same for the 1.7B run |
|
||||
|
||||
## Use
|
||||
|
||||
These GGUF files are what [Rizzo Flow](https://github.com/Rizzo-AI-Academy/rizzo-flow) downloads
|
||||
by default. It pins this repository by commit and checks the sha256 of every file:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Rizzo-AI-Academy/rizzo-flow && cd rizzo-flow
|
||||
uv sync --locked
|
||||
uv run rizzo download # llama.cpp for this machine + this model, Q8_0 (4.4 GB)
|
||||
uv run rizzo serve # → http://127.0.0.1:8017/playground
|
||||
```
|
||||
|
||||
`--quant bf16` or `--quant q4_k_m` picks another file, `--size 1.7b` the small model (also in its own repository,
|
||||
[`rizzoaiacademy/rizzo-flow-1.7b`](https://huggingface.co/rizzoaiacademy/rizzo-flow-1.7b)), and
|
||||
`--weights base` the original Spark-X2.5 GGUF files. The server answers as `rizzo-flow-4b-q8_0`.
|
||||
|
||||
**MLX** (Apple Silicon, or MLX-CUDA) uses the safetensors checkpoint at the root of this
|
||||
repository instead of the GGUF files:
|
||||
|
||||
```bash
|
||||
uv sync --locked --extra mlx
|
||||
uv run --no-sync rizzo download --backend mlx # the safetensors only, 8.2 GB
|
||||
uv run --no-sync rizzo serve --backend mlx --bits 8
|
||||
```
|
||||
|
||||
It answers as `rizzo-flow-4b-bf16` (or `…-q8`/`…-q4` with `--bits`). On an RTX 5060 Ti with MLX-CUDA, BF16, the
|
||||
4B gives the same prompts (same hashes) and the same probabilities as llama.cpp BF16 within 0.001.
|
||||
|
||||
**transformers** loads the checkpoint with the original Spark code (`trust_remote_code=True`,
|
||||
`modeling_spark.py` is XHToken's file, unchanged): `AutoModelForCausalLM.from_pretrained(
|
||||
"rizzoaiacademy/rizzo-flow", trust_remote_code=True, dtype="bfloat16")`. Use the prompts of
|
||||
Rizzo Flow and read the answer-letter logits at the last position; generating text is not what
|
||||
it was trained for.
|
||||
|
||||
The GGUF files are plain GGUF (architecture `spark2_5`; Rizzo Flow runs them on llama.cpp release b11081), but the model is
|
||||
meant to be **read, not chatted with**: Rizzo Flow builds the prompt, then reads the logits of the
|
||||
answer letters. In a chat app it behaves like a lightly changed Spark-X2.5, and the fine-tune
|
||||
brings nothing there.
|
||||
|
||||
The adapter was trained on the exact prompts of `PROMPT_VERSION = "spark-decisions-v3"`, commit
|
||||
`c30cc63` of rizzo-flow. Any other prompt format can make the adapter useless.
|
||||
|
||||
## Results
|
||||
|
||||
We ran the test split of the
|
||||
[`LocalLLaMA/typed-decisions`](https://huggingface.co/datasets/LocalLLaMA/typed-decisions) benchmark
|
||||
(config `all`, 400 cases, 2,000 decisions). The model is fine-tuned for typed decisions, so this
|
||||
is not a zero-shot result, but training used no data from these four workflows: the Open-Jev config
|
||||
that shares them (`workflow-controls-v1`) was excluded, and so was every training state containing
|
||||
text from the test set. Base and fine-tune were measured on the same machine: llama.cpp b11081,
|
||||
CUDA, RTX 5060 Ti.
|
||||
|
||||
| | Accuracy ↑ | KL from gold ↓ | Brier ↓ | ECE ↓ | p50 per case |
|
||||
| --- | ---: | ---: | ---: | ---: | ---: |
|
||||
| Spark-X2.5-4B Q8_0, base | 0.574 | 2.899 | 0.480 | 0.349 | 201 ms |
|
||||
| **This model, Q8_0** | **0.648** | **0.452** | **0.205** | **0.112** | 195 ms |
|
||||
| TypeSafe Jev 1.13.0 (from its dataset card, not re-measured) | 0.727 | 1.442 | 0.148 | – | – |
|
||||
|
||||
Accuracy +0.074, 95% interval [+0.050, +0.101] (paired bootstrap over cases). On an RTX PRO 6000
|
||||
the same file scores 0.650 / 0.454 / 0.205 / 0.111: the difference between GPUs is below 0.002.
|
||||
|
||||
**Q4_K_M** (made with `llama-quantize` b11081 from the BF16 GGUF, no importance matrix) scores
|
||||
0.650 / 0.436 / 0.201 / 0.093 on the RTX 5060 Ti, p50 198 ms: tied with Q8_0 on this benchmark
|
||||
(+0.002 [−0.011, +0.015]). On the original weights Q4_K_M cost 4 points on SemIf's fixtures, which
|
||||
we have not re-run here, so check it on your own data before relying on it.
|
||||
|
||||
Per workflow (accuracy / KL): customer_service 0.710 / 0.350, invoice_processing 0.714 / 0.506,
|
||||
security_incidents 0.674 / 0.434, agent_trace_observability 0.500 / 0.526 (base: 0.366).
|
||||
By type: noul 0.738, choice 0.637, score 0.593.
|
||||
|
||||
Dev split of the training mixture (600 questions): loss 1.928 → 0.393, accuracy 0.547 → 0.857.
|
||||
|
||||
### 1.7B
|
||||
|
||||
We measured the base model and the fine-tuned one on the same machine, with the same runtime
|
||||
(RTX PRO 6000; on the RTX 5060 Ti: 0.530 → 0.544, KL 3.031 → 0.694):
|
||||
|
||||
| | Accuracy ↑ | KL from gold ↓ | Brier ↓ | ECE ↓ | p50 per case |
|
||||
| --- | ---: | ---: | ---: | ---: | ---: |
|
||||
| Spark-X2.5-1.7B Q8_0, base | 0.531 | 3.032 | 0.494 | 0.348 | 50 ms |
|
||||
| **This model, 1.7B Q8_0** | **0.546** | **0.692** | **0.274** | **0.167** | 52 ms |
|
||||
|
||||
On the 1.7B, fine-tuning mostly improves the probabilities (KL, Brier, ECE). Accuracy barely
|
||||
moves: +0.015 is within noise. The change is not uniform across workflows:
|
||||
agent_trace_observability goes 0.372 → 0.490 and customer_service 0.644 → 0.674, but
|
||||
security_incidents drops 0.608 → 0.520. By type, noul goes 0.603 → 0.675 and score 0.441 → 0.461,
|
||||
but choice drops 0.578 → 0.532. On the dev split, loss goes 3.117 → 0.460 and accuracy
|
||||
0.408 → 0.820. Use the 4B when accuracy matters.
|
||||
|
||||
The probabilities are **not calibrated**. Fit temperature scaling on data from your own domain
|
||||
(`rizzo calibrate`) before you use thresholds. The accuracy is still below Jev's published
|
||||
number, and the gold labels of the benchmark come from a ~4B teacher model, not from humans. We
|
||||
have not yet re-run the smoke and SemIf fixtures on this model.
|
||||
|
||||
## Training
|
||||
|
||||
- Base: Spark-X2.5-4B BF16, rev. `0bcb356`. LoRA r 16, alpha 32, dropout 0.05, on all linear
|
||||
layers of attention and MLP. Embedding and `lm_head` are not trained because they are tied.
|
||||
32.4M trainable parameters.
|
||||
- AdamW, lr 5e-5, 3% warmup then cosine decay, no weight decay, clip 1.0. 16 questions per step.
|
||||
1 epoch = 1,770 steps. Seed 0.
|
||||
- 28,321 training questions (14.7M prompt tokens, max 2,048 tokens per prompt), from
|
||||
[`tasksource/procedural-typed-decisions`](https://huggingface.co/datasets/tasksource/procedural-typed-decisions)
|
||||
(Apache-2.0), [`ZefanCai/Open-Jev`](https://huggingface.co/datasets/ZefanCai/Open-Jev)
|
||||
`release-v2-redistributable` (CC0) and 12 configs of
|
||||
[`Praveenrajus/jev-bench`](https://huggingface.co/datasets/Praveenrajus/jev-bench). None of the
|
||||
labels come from Jev or TypeSafe. We removed every training state that contains text from the
|
||||
evaluation sets.
|
||||
- Hardware: 1× RTX PRO 6000 Blackwell 96 GB, no gradient checkpointing. 4B: batch 4 / 2,048
|
||||
tokens per forward, ~6,700 prompt tokens/s, 41 minutes, 38 GiB peak. 1.7B (rev. `14d6e83`,
|
||||
16.7M trainable parameters, same data and hyperparameters): batch 8 / 3,072 tokens,
|
||||
~15,500 tokens/s, 19 minutes, 22 GiB peak.
|
||||
|
||||
Full pipeline and reasoning:
|
||||
[`docs/training.md`](https://github.com/Rizzo-AI-Academy/rizzo-flow/blob/main/docs/training.md).
|
||||
|
||||
## Licenses of the training data
|
||||
|
||||
The base model is Apache-2.0. Among the jev-bench configs, `stsb` is **CC-BY-SA**.
|
||||
`measuring_hate_speech` and the HelpSteer2 configs are CC-BY-4.0: *Measuring Hate Speech*
|
||||
(Kennedy et al., 2020; Sachdeva et al., 2022) and *HelpSteer2* (Wang et al., 2024, NVIDIA).
|
||||
Check whether these terms matter for your use before you redistribute derivatives.
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user