afm-dd / README.md
craftslab's picture
Update README.md
34fe5e9 verified
|
Raw History Blame Contribute Delete
8.89 kB
---
language:
- en
license: mit
library_name: peft
pipeline_tag: text-generation
base_model: openbmb/MiniCPM5-2B
base_model_relation: adapter
tags:
- afm-d
- afm-dd
- decision
- system-1
- minicpm
- minicpm5
- peft
- lora
- semif
- pytorch
datasets:
- LocalLLaMA/typed-decisions
- mteb/banking77
- jaredpalmer/kev-suites
- tals/vitaminc
---
# AFM-D Decoder (`afm_dd`)
**Causal System 1 decisions over a typed answer space (option-letter logits).**
Site: [ariacompute.com](https://ariacompute.com) Β· Org: [ariacompute](https://huggingface.co/ariacompute) Β· Hub: [ariacompute/afm-dd](https://huggingface.co/ariacompute/afm-dd)
AFM-D Decoder is the causal track of **AFM-D**: [SemIf](https://github.com/TheoLeeCJ/SemIf-OpenJev) **direct** option-letter scoring on [`openbmb/MiniCPM5-2B`](https://huggingface.co/openbmb/MiniCPM5-2B) with an optional PEFT LoRA (product recipe `afm-d-decoder-v2.1`). It scores a text/JSON **state** against user-supplied options and returns a distribution β€” not open-ended chat, not TypeSafe Jev.
| Primitive | Answer space | Result |
| --- | --- | --- |
| **Choice** | 2–16 options (A–P) | `choice`, `probabilities`, `confidence` |
| **Score** | 2–10 ordered levels | expected `score`, distribution, `confidence` |
| **Noul** | `false` / `true` | `noul` = P(true) |
Companion Encoder (Laya ModernBERT DecisionModel): [`ariacompute/afm-de`](https://huggingface.co/ariacompute/afm-de).
## Model details
| | |
| --- | --- |
| Subject id | `afm_dd` |
| Base | [`openbmb/MiniCPM5-2B`](https://huggingface.co/openbmb/MiniCPM5-2B) @ `12a3808a956f869c767195e9266b59c4d21d92e2` |
| Method | SemIf `direct` β€” read option-letter logits at the first generation position |
| Adapter | PEFT LoRA (attention), recipe **`afm-d-decoder-v2.1`**: r=16, 3 epochs, LR `5e-5`, micro-batch 1 |
| Options | **2–16** letters A–P (wider Choice rows skipped at convert/train) |
| Training | Hard-label CE on AFM-D product corpus; **shuffles option order** each step (`shuffle_semif_options`) to avoid letter collapse |
| Export | PEFT adapter (this repo) + optional merged **Q8_0 GGUF** at `gguf/afm-dd-2b-Q8_0.gguf` for Ollaya / llama.cpp |
### Checkpoint layout
```text
adapter_config.json
adapter_model.safetensors # or adapter_model.bin
dd_config.json
tokenizer/
gguf/afm-dd-2b-Q8_0.gguf # optional; merged MiniCPM5 + LoRA for Ollaya
```
Load the adapter on the pinned MiniCPM5-2B revision with `peft` + SemIf / AFM-D Decoder code β€” not as a standalone chat GGUF unless you use the merged file under `gguf/`.
## Intended use
- Local **typed decision** scoring (Choice / Score / Noul) over a supplied state via System One HTTP or in-process subjects.
- Offline eval and [JevBench](https://github.com/fstandhartinger/jevbench) comparison via the AFM-D harness.
- Ollaya / llama.cpp inference from the merged Q8_0 GGUF when published in this repo.
## How to use
Load through **Aria Engine** (native AFM runtime) or **[Ollaya](https://ollaya.dev)** (Ollama-style local decision daemon).
### Aria Engine
Native AFM runtime: CLI, `POST /v1/systemone`, FFI, and language SDKs. Docs: [engine README](https://github.com/ariacompute/engine). Decoder System One default port **8011**.
```bash
aria-engine setup
aria-engine download afm-dd # β†’ ~/.ariacompute/models/afm-dd
aria-engine decide --track decoder --model-name afm-dd --file record.json
aria-engine serve --track decoder --model-name afm-dd --bind 127.0.0.1:8011
```
**System One** body (`POST /v1/systemone` or `decide`):
```bash
curl -s http://127.0.0.1:8011/v1/systemone \
-H 'content-type: application/json' \
-d '{
"state": "user wants a refund",
"questions": {
"q1": {
"type": "choice",
"instructions": "Pick the best action",
"criteria": {
"refund": "issue a full refund",
"deny": "deny the request"
}
}
}
}'
```
| `type` | `criteria` |
| --- | --- |
| `choice` | object: option name β†’ description |
| `score` | array of 2–10 ordered level strings |
| `noul` | object with `true` / `false` (optional) |
**Python SDK** (`pip install aria-engine`; needs `libaria-engine_ffi` or `ARIA_FFI_LIB`):
```python
from aria_engine import AriaEngine
eng = AriaEngine("/path/to/afm-dd", "decoder") # or ~/.ariacompute/models/afm-dd
out = eng.systemone({
"state": "user wants a refund",
"questions": {
"q1": {
"type": "choice",
"instructions": "Pick the best action",
"criteria": {
"refund": "issue a full refund",
"deny": "deny the request",
},
}
},
})
print(out["answers"]["q1"])
eng.destroy()
```
Also: TypeScript `@ariacompute/engine-ts`, Rust `ariacompute-engine`, Go / Flutter / Swift / Kotlin β€” see engine `bindings/`.
### Ollaya
[Ollaya](https://ollaya.dev) pulls AFM-D by name and serves TypeSafe-compatible `/v1/systemone`. Use the **AFM-D-enabled** builds from [ariacompute/ollaya releases](https://github.com/ariacompute/ollaya/releases) (not the default `ollaya-dev/ollaya` channel). Weights stay on Hugging Face / ModelScope (Ollaya does not re-host).
```bash
# install from https://github.com/ariacompute/ollaya/releases (latest AFM-D build)
curl -fsSL https://raw.githubusercontent.com/ariacompute/ollaya/main/scripts/install.sh \
| OLLAYA_REPO=ariacompute/ollaya sh
# pin a release: OLLAYA_REPO=ariacompute/ollaya OLLAYA_VERSION=0.7.5+afm-d.1.0.0
# Windows (PowerShell):
# $env:OLLAYA_REPO='ariacompute/ollaya'; irm https://raw.githubusercontent.com/ariacompute/ollaya/main/scripts/install.ps1 | iex
# weights: HF (ariacompute/afm-dd) or ModelScope (AriaCompute/afm-dd)
# OLLAYA_HUB=huggingface|modelscope|auto (auto β†’ ModelScope when LANG looks Chinese)
ollaya pull afm-dd
ollaya run afm-dd --preset triage \
"Third time this year you've double-charged me. Refund it today or I'm cancelling."
```
Or download a platform asset from the [releases page](https://github.com/ariacompute/ollaya/releases) (e.g. `ollaya-linux-amd64.tar.zst`, `ollaya-darwin-arm64.tgz`, `ollaya-windows-amd64.zip`), unpack, put `ollaya` on `PATH`, then `pull` / `run` as above.
HTTP (daemon default `http://localhost:11435`):
```bash
curl http://localhost:11435/v1/systemone \
-H "Content-Type: application/json" \
-d '{
"model": "afm-dd",
"state": "user wants a refund",
"questions": {
"q1": {
"type": "choice",
"instructions": "Pick the best action",
"criteria": {
"refund": "issue a full refund",
"deny": "deny the request"
}
}
}
}'
```
Family notes: Ollaya repo `docs/families/afm-dd.md`.
## Eval
Product LoRA (`afm-d-decoder-v2.1`) on `data/eval.jsonl`, n=5513 (`--skip-errors`); vs base MiniCPM5-2B. `letter_collapse.collapsed=false` (top letter B β‰ˆ35.8%).
| | AFM-D Decoder | Base MiniCPM |
| --- | ---: | ---: |
| Agreement | **77.5%** | 59.5% |
| ECE | **0.029** | 0.261 |
| Brier | **0.299** | 0.613 |
| Task | n | Agree | ECE |
| --- | ---: | ---: | ---: |
| choice | 2459 | 79.2% | 0.039 |
| noul | 1706 | 85.9% | 0.014 |
| score | 1348 | 64.0% | 0.048 |
Score is the weakest task bucket. Agree / ECE / Brier are local release diagnostics; product gate = JevBench public-proxy below.
## JevBench
Public-proxy board (n=231, gate Score **β‰₯ 50.0**). Not an official sealed JevBench claim.
| # | System | Score | Intel. | Calib. | Speed | Acc. | Hard |
| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: |
| 1 | SemIf | 84.0 | 74.9 | 87.1 | 90.7 | 81.0% | 61.3% |
| 2 | Bespoke Nimble-9B | 79.2 | 72.5 | 76.2 | 89.8 | 79.7% | 61.3% |
| 3 | NeoHorse-Jev-4B | 78.3 | 63.1 | 84.6 | 89.7 | 72.3% | 45.0% |
| 4 | Kev-4B | 76.9 | 67.2 | 76.7 | 88.3 | 75.8% | 54.1% |
| 5 | **AFM-D Decoder** | **76.3** | **57.1** | **84.9** | **91.7** | **68.4%** | **40.5%** |
| 6 | AgentJev-0.6B | 42.0 | 40.0 | 79.8 | 89.1 | 58.0% | 36.0% |
| 7 | Laya | 30.9 | 36.4 | 57.7 | 93.9 | 53.2% | 27.9% |
AFM-D Decoder tiers: easy **100%**, standard **90.3%**, hard **40.5%** β€” **beats** the public-proxy gate. Near Kev on composite Score; main gap vs SemIf / Nimble is Intelligence / hard.
## License
MIT
## Citation / links
- Org: [huggingface.co/ariacompute](https://huggingface.co/ariacompute)
- Companion Encoder: [ariacompute/afm-de](https://huggingface.co/ariacompute/afm-de)
- Aria Engine: [github.com/ariacompute/engine](https://github.com/ariacompute/engine)
- Ollaya (AFM-D builds): [github.com/ariacompute/ollaya/releases](https://github.com/ariacompute/ollaya/releases)
- Base MiniCPM5-2B: [openbmb/MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B)
- SemIf: [github.com/TheoLeeCJ/SemIf-OpenJev](https://github.com/TheoLeeCJ/SemIf-OpenJev)
- JevBench: [github.com/fstandhartinger/jevbench](https://github.com/fstandhartinger/jevbench)