ticket #60: test models Jev-Style-0.8B-Decision-v3 and JevK5, their readouts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e67085a parent: 40f9839 modified
.memory/handoffs/2026-11-26-v0-3-systemone-spike.md +8 -0 | @@ -28,3 +28,11 @@ | ||
| 28 | 28 | recommended), Mac RAM (OpenJev is 27B). |
| 29 | 29 | - Next: task 3 of #46 — propose v0.3 tickets: API layer on FakeEngine (Linux-testable), then one |
| 30 | 30 | family per ticket, images later; compare with llama.cpp's reference values in the PR. |
| 31 | + | |
| 32 | +## Update 2 — ticket #60 and test models | |
| 33 | +- Ticket #60 (POST /v1/systemone) written and updated: test models Jev-Style-0.8B-Decision-v3 | |
| 34 | + (verdict readout) and JevK5 (letter readout); their prompt formats and temperatures are in #60. | |
| 35 | +- Still to decide with the user (task 1 of #60): detection / `decision:` config entry, confidence | |
| 36 | + formula (llama.cpp's proposed), shared prefix now or later. | |
| 37 | +- Trap: JevK5's temperatures (1.22 / 0.93) are not in the mlx-community repo. | |
| 38 | +- Reference parity on the Mac needs mlx-lm (Python) runs of each model's own runtime. | |
| @@ -28,3 +28,11 @@ | |||
| 28 | recommended), Mac RAM (OpenJev is 27B). | 28 | recommended), Mac RAM (OpenJev is 27B). |
| 29 | - Next: task 3 of #46 — propose v0.3 tickets: API layer on FakeEngine (Linux-testable), then one | 29 | - Next: task 3 of #46 — propose v0.3 tickets: API layer on FakeEngine (Linux-testable), then one |
| 30 | family per ticket, images later; compare with llama.cpp's reference values in the PR. | 30 | family per ticket, images later; compare with llama.cpp's reference values in the PR. |
| 31 | + | ||
| 32 | +## Update 2 — ticket #60 and test models | ||
| 33 | +- Ticket #60 (POST /v1/systemone) written and updated: test models Jev-Style-0.8B-Decision-v3 | ||
| 34 | + (verdict readout) and JevK5 (letter readout); their prompt formats and temperatures are in #60. | ||
| 35 | +- Still to decide with the user (task 1 of #60): detection / `decision:` config entry, confidence | ||
| 36 | + formula (llama.cpp's proposed), shared prefix now or later. | ||
| 37 | +- Trap: JevK5's temperatures (1.22 / 0.93) are not in the mlx-community repo. | ||
| 38 | +- Reference parity on the Mac needs mlx-lm (Python) runs of each model's own runtime. | ||
modified
.memory/history.md +10 -0 | @@ -463,3 +463,13 @@ the user wants to clarify before answering. | ||
| 463 | 463 | Then: user asked to "just write the ticket" for now: created #60 "POST /v1/systemone: decision |
| 464 | 464 | models (llama-server compatible)" (v0.3, epic Decision models, needs-decision; API, mechanism, 3 |
| 465 | 465 | families, open decisions, acceptance, 4 tasks), linked from #46. Family choice / Mac RAM unanswered. |
| 466 | + | |
| 467 | +Then: user chose the test models for #60: mlx-community/Jev-Style-0.8B-Decision-v3-mlx-16bit and | |
| 468 | +mlx-community/JevK5-chat-mlx-16bit. Read both repos (and alibiserikbay/JevK5, github allebee/jevk5 | |
| 469 | +prompt.py/runtime.py): both are qwen3_5_text (MLXLLM Qwen35TextModel, public call gives all-position | |
| 470 | +logits; hidden states not public). Jev-Style = verdict readout described by its readout_config.json | |
| 471 | +(logit " yes" - " no" at each " ->" slot, T global 0.880, budgets 25,600 / 2,048, reference | |
| 472 | +jev_style_decision_mlx.py). JevK5 = letter readout A..P at the last position, T 1.22, knockout for | |
| 473 | +> 16 options (T 0.93); its jevk5_config.json is missing from the MLX conversion. Ticket #60 updated | |
| 474 | +(test models, both readouts, open decisions: detection/config, confidence formula, shared prefix; | |
| 475 | +acceptance = parity with their reference runtimes). No code. | |
| @@ -463,3 +463,13 @@ the user wants to clarify before answering. | |||
| 463 | Then: user asked to "just write the ticket" for now: created #60 "POST /v1/systemone: decision | 463 | Then: user asked to "just write the ticket" for now: created #60 "POST /v1/systemone: decision |
| 464 | models (llama-server compatible)" (v0.3, epic Decision models, needs-decision; API, mechanism, 3 | 464 | models (llama-server compatible)" (v0.3, epic Decision models, needs-decision; API, mechanism, 3 |
| 465 | families, open decisions, acceptance, 4 tasks), linked from #46. Family choice / Mac RAM unanswered. | 465 | families, open decisions, acceptance, 4 tasks), linked from #46. Family choice / Mac RAM unanswered. |
| 466 | + | ||
| 467 | +Then: user chose the test models for #60: mlx-community/Jev-Style-0.8B-Decision-v3-mlx-16bit and | ||
| 468 | +mlx-community/JevK5-chat-mlx-16bit. Read both repos (and alibiserikbay/JevK5, github allebee/jevk5 | ||
| 469 | +prompt.py/runtime.py): both are qwen3_5_text (MLXLLM Qwen35TextModel, public call gives all-position | ||
| 470 | +logits; hidden states not public). Jev-Style = verdict readout described by its readout_config.json | ||
| 471 | +(logit " yes" - " no" at each " ->" slot, T global 0.880, budgets 25,600 / 2,048, reference | ||
| 472 | +jev_style_decision_mlx.py). JevK5 = letter readout A..P at the last position, T 1.22, knockout for | ||
| 473 | +> 16 options (T 0.93); its jevk5_config.json is missing from the MLX conversion. Ticket #60 updated | ||
| 474 | +(test models, both readouts, open decisions: detection/config, confidence formula, shared prefix; | ||
| 475 | +acceptance = parity with their reference runtimes). No code. | ||
modified
.tickets/issues/0060-post-v1-systemone-decision-models.yaml +21 -9 | @@ -6,7 +6,7 @@ author: | ||
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-26T20:00:00.000Z |
| 9 | -updatedAt: 2026-11-26T20:00:00.000Z | |
| 9 | +updatedAt: 2026-11-26T21:00:00.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - "kind::feature" |
| 12 | 12 | - "area::server" |
| @@ -61,20 +61,32 @@ body: | | ||
| 61 | 61 | 2. **Kev** (Qwen3.5-4B-Base + `cls_out` head): hidden states at the `<|box_end|>` option markers and at the last token, scaled dot product (`head.pt` must be converted to safetensors). |
| 62 | 62 | 3. **Laya / Julia-1** (ModernBERT / mmBERT encoders): head column per question type at each `[mask]` option marker; needs a ModernBERT port (not in mlx-swift-lm). |
| 63 | 63 | |
| 64 | + ## Test models (user, 2026-11-26) | |
| 65 | + Both are Qwen3.5 causal LMs (`model_type: qwen3_5_text`, loaded by MLXLLM's `Qwen35TextModel`, whose public call returns the logits at every position — enough for both readouts; hidden states are not public). Neither is a llama.cpp family, so their readouts are added to the three above. | |
| 66 | + 1. **`mlx-community/Jev-Style-0.8B-Decision-v3-mlx-16bit`** (0.8B, ~1.6 GB, Apache-2.0) — **verdict readout**, described by the repo's own `readout_config.json` (`format: macjev-readout-v1`, `template: macjev-render-v1`), reference runtime `jev_style_decision_mlx.py` in the repo: | |
| 67 | + - prompt built from separately tokenised segments (special tokens in user text not parsed): `State:\n<state>\n\n` `Question [<type>]: <instructions>\nOptions:\n` then `- <option>\n` per option, `Judge each option:\n`, then `<option> ->\n` per option; | |
| 68 | + - options: choice `key` or `key: description`; score `level i: <description>`; noul `false: …` / `true: …` (defaults "no, the statement does not hold" / "yes, the statement holds"); non-string state/descriptions as JSON (`ensure_ascii=False`); | |
| 69 | + - score of option k = logit(" yes") − logit(" no") at the k-th " ->" token (float32); probabilities = softmax(scores / T), T = `temperatures.global` (0.880) clamped to `temperatures.clamp`; per-category group temperatures exist (key `family|qtype|option bucket`) but need a `category` the API does not have; | |
| 70 | + - budgets: whole input ≤ 25,600 tokens, question + options + readout ≤ 2,048 — refused, never truncated (→ 400); token ids checked against the tokenizer at load. | |
| 71 | + 2. **`mlx-community/JevK5-chat-mlx-16bit`** (Qwen3.5-4B + merged LoRA, ~8.4 GB bf16, Apache-2.0) — **letter readout** (SemIf protocol, runtime github.com/allebee/jevk5, `jevk5/prompt.py`): | |
| 72 | + - Qwen3.5 chat prompt with thinking off: system "Apply the supplied criterion to the supplied evidence. Choose exactly one listed option. Respond with only its uppercase letter, with no explanation or reasoning." and user = `json.dumps({"evidence": state, "criterion": instructions, "options": [{"letter": "A", "description": "<key>: <text>"}, ...]}, ensure_ascii=False)`; noul options `true`, `false` (in that order, default text "The proposition is true/false."), score options = level indices; | |
| 73 | + - probabilities = softmax(logits of the letters A..P at the last position / 1.22); more than 16 options: knockout over groups of ≤ 16 + a final, combined distribution sharpened by `knockout_temperature` 0.93; | |
| 74 | + - the temperatures live in `jevk5_config.json` of the original repo `alibiserikbay/JevK5`, **missing from the mlx-community conversion**: they must come from the server configuration (or a built-in default for this model). | |
| 75 | + | |
| 64 | 76 | ## To decide (with the user) |
| 65 | - - Which family first (label readout is the cheapest: Qwen3.5 is in MLXLLM). | |
| 66 | - - How a model is recognised as a decision model: detection from repo files (`helper/shim.py`, `lev_release.json`, `head.pt`...) or a `decision:` entry in the server configuration. | |
| 67 | - - Which Hub repos are supported (MLX conversions are fragmented, each with its own runtime) and which test models fit the user's Mac. | |
| 68 | - - Shared prompt prefix between questions (Qwen3.5 is hybrid: needs a state snapshot, not a cache trim) — now or later. | |
| 69 | - - Images (OpenJev) — later. | |
| 77 | + - How a model is recognised as a decision model and which readout it uses: Jev-Style is self-describing (`readout_config.json`); JevK5's MLX conversion has nothing distinctive → proposed: a `decision:` entry per model in the server configuration (readout name + temperatures), with auto-detection when `readout_config.json` is present. | |
| 78 | + - `confidence`: llama.cpp's formulas (kept for API compatibility) vs the models' own runtimes (JevK5: top probability; Jev-Style: entropy concentration) — proposed: llama.cpp's. | |
| 79 | + - Shared prompt prefix between questions (the state is the common prefix for Jev-Style; Qwen3.5 is hybrid, so it needs a state snapshot, not a cache trim) — now or later. | |
| 80 | + - The llama.cpp families (OpenJev/lev, Kev, Laya/Julia-1) and images: later tickets. | |
| 70 | 81 | |
| 71 | 82 | ## Acceptance |
| 72 | 83 | - The request/response/validation layer runs on the fake engine and is tested on Linux. |
| 73 | - - With a real model of the chosen family, probabilities match llama.cpp's reference values from PR #29818 within the same tolerance (worst diff ~1e-3). | |
| 84 | + - On the Mac, both test models give the same probabilities as their reference implementations (Jev-Style: the repo's `jev_style_decision_mlx.py` with mlx-lm; JevK5: `jevk5/prompt.py` rendering + letter logits with mlx-lm) within ~1e-3, on a fixed set of questions (choice, score, noul, > 16 options for JevK5). | |
| 85 | + - Smoke tests enabled only when the models are in the HF cache (like `ChatSmokeTests`). | |
| 74 | 86 | - Compatibility suite: a `/v1/systemone` test; docs EN + FR (how-to + HTTP API reference with curl examples run by `test_docs_curl.py`). |
| 75 | 87 | tasks: |
| 76 | 88 | - id: 1 |
| 77 | - title: "Decide the first family, model detection and test models" | |
| 89 | + title: "Decide model detection / configuration, confidence formula, shared prefix (test models chosen: Jev-Style-0.8B-Decision-v3, JevK5)" | |
| 78 | 90 | state: open |
| 79 | 91 | priority: high |
| 80 | 92 | author: |
| @@ -90,7 +102,7 @@ tasks: | ||
| 90 | 102 | email: ph.charriere@gmail.com |
| 91 | 103 | createdAt: 2026-11-26T20:00:00.000Z |
| 92 | 104 | - id: 3 |
| 93 | - title: "Engine: decision scoring for the first family (MLX, compare with llama.cpp reference values)" | |
| 105 | + title: "Engine: verdict readout (Jev-Style) and letter readout (JevK5) on MLX, compared with their reference runtimes" | |
| 94 | 106 | state: open |
| 95 | 107 | priority: high |
| 96 | 108 | author: |
| @@ -6,7 +6,7 @@ author: | |||
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-11-26T20:00:00.000Z | 8 | createdAt: 2026-11-26T20:00:00.000Z |
| 9 | -updatedAt: 2026-11-26T20:00:00.000Z | 9 | +updatedAt: 2026-11-26T21:00:00.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - "kind::feature" | 11 | - "kind::feature" |
| 12 | - "area::server" | 12 | - "area::server" |
| @@ -61,20 +61,32 @@ body: | | |||
| 61 | 2. **Kev** (Qwen3.5-4B-Base + `cls_out` head): hidden states at the `<|box_end|>` option markers and at the last token, scaled dot product (`head.pt` must be converted to safetensors). | 61 | 2. **Kev** (Qwen3.5-4B-Base + `cls_out` head): hidden states at the `<|box_end|>` option markers and at the last token, scaled dot product (`head.pt` must be converted to safetensors). |
| 62 | 3. **Laya / Julia-1** (ModernBERT / mmBERT encoders): head column per question type at each `[mask]` option marker; needs a ModernBERT port (not in mlx-swift-lm). | 62 | 3. **Laya / Julia-1** (ModernBERT / mmBERT encoders): head column per question type at each `[mask]` option marker; needs a ModernBERT port (not in mlx-swift-lm). |
| 63 | 63 | ||
| 64 | + ## Test models (user, 2026-11-26) | ||
| 65 | + Both are Qwen3.5 causal LMs (`model_type: qwen3_5_text`, loaded by MLXLLM's `Qwen35TextModel`, whose public call returns the logits at every position — enough for both readouts; hidden states are not public). Neither is a llama.cpp family, so their readouts are added to the three above. | ||
| 66 | + 1. **`mlx-community/Jev-Style-0.8B-Decision-v3-mlx-16bit`** (0.8B, ~1.6 GB, Apache-2.0) — **verdict readout**, described by the repo's own `readout_config.json` (`format: macjev-readout-v1`, `template: macjev-render-v1`), reference runtime `jev_style_decision_mlx.py` in the repo: | ||
| 67 | + - prompt built from separately tokenised segments (special tokens in user text not parsed): `State:\n<state>\n\n` `Question [<type>]: <instructions>\nOptions:\n` then `- <option>\n` per option, `Judge each option:\n`, then `<option> ->\n` per option; | ||
| 68 | + - options: choice `key` or `key: description`; score `level i: <description>`; noul `false: …` / `true: …` (defaults "no, the statement does not hold" / "yes, the statement holds"); non-string state/descriptions as JSON (`ensure_ascii=False`); | ||
| 69 | + - score of option k = logit(" yes") − logit(" no") at the k-th " ->" token (float32); probabilities = softmax(scores / T), T = `temperatures.global` (0.880) clamped to `temperatures.clamp`; per-category group temperatures exist (key `family|qtype|option bucket`) but need a `category` the API does not have; | ||
| 70 | + - budgets: whole input ≤ 25,600 tokens, question + options + readout ≤ 2,048 — refused, never truncated (→ 400); token ids checked against the tokenizer at load. | ||
| 71 | + 2. **`mlx-community/JevK5-chat-mlx-16bit`** (Qwen3.5-4B + merged LoRA, ~8.4 GB bf16, Apache-2.0) — **letter readout** (SemIf protocol, runtime github.com/allebee/jevk5, `jevk5/prompt.py`): | ||
| 72 | + - Qwen3.5 chat prompt with thinking off: system "Apply the supplied criterion to the supplied evidence. Choose exactly one listed option. Respond with only its uppercase letter, with no explanation or reasoning." and user = `json.dumps({"evidence": state, "criterion": instructions, "options": [{"letter": "A", "description": "<key>: <text>"}, ...]}, ensure_ascii=False)`; noul options `true`, `false` (in that order, default text "The proposition is true/false."), score options = level indices; | ||
| 73 | + - probabilities = softmax(logits of the letters A..P at the last position / 1.22); more than 16 options: knockout over groups of ≤ 16 + a final, combined distribution sharpened by `knockout_temperature` 0.93; | ||
| 74 | + - the temperatures live in `jevk5_config.json` of the original repo `alibiserikbay/JevK5`, **missing from the mlx-community conversion**: they must come from the server configuration (or a built-in default for this model). | ||
| 75 | + | ||
| 64 | ## To decide (with the user) | 76 | ## To decide (with the user) |
| 65 | - - Which family first (label readout is the cheapest: Qwen3.5 is in MLXLLM). | 77 | + - How a model is recognised as a decision model and which readout it uses: Jev-Style is self-describing (`readout_config.json`); JevK5's MLX conversion has nothing distinctive → proposed: a `decision:` entry per model in the server configuration (readout name + temperatures), with auto-detection when `readout_config.json` is present. |
| 66 | - - How a model is recognised as a decision model: detection from repo files (`helper/shim.py`, `lev_release.json`, `head.pt`...) or a `decision:` entry in the server configuration. | 78 | + - `confidence`: llama.cpp's formulas (kept for API compatibility) vs the models' own runtimes (JevK5: top probability; Jev-Style: entropy concentration) — proposed: llama.cpp's. |
| 67 | - - Which Hub repos are supported (MLX conversions are fragmented, each with its own runtime) and which test models fit the user's Mac. | 79 | + - Shared prompt prefix between questions (the state is the common prefix for Jev-Style; Qwen3.5 is hybrid, so it needs a state snapshot, not a cache trim) — now or later. |
| 68 | - - Shared prompt prefix between questions (Qwen3.5 is hybrid: needs a state snapshot, not a cache trim) — now or later. | 80 | + - The llama.cpp families (OpenJev/lev, Kev, Laya/Julia-1) and images: later tickets. |
| 69 | - - Images (OpenJev) — later. | ||
| 70 | 81 | ||
| 71 | ## Acceptance | 82 | ## Acceptance |
| 72 | - The request/response/validation layer runs on the fake engine and is tested on Linux. | 83 | - The request/response/validation layer runs on the fake engine and is tested on Linux. |
| 73 | - - With a real model of the chosen family, probabilities match llama.cpp's reference values from PR #29818 within the same tolerance (worst diff ~1e-3). | 84 | + - On the Mac, both test models give the same probabilities as their reference implementations (Jev-Style: the repo's `jev_style_decision_mlx.py` with mlx-lm; JevK5: `jevk5/prompt.py` rendering + letter logits with mlx-lm) within ~1e-3, on a fixed set of questions (choice, score, noul, > 16 options for JevK5). |
| 85 | + - Smoke tests enabled only when the models are in the HF cache (like `ChatSmokeTests`). | ||
| 74 | - Compatibility suite: a `/v1/systemone` test; docs EN + FR (how-to + HTTP API reference with curl examples run by `test_docs_curl.py`). | 86 | - Compatibility suite: a `/v1/systemone` test; docs EN + FR (how-to + HTTP API reference with curl examples run by `test_docs_curl.py`). |
| 75 | tasks: | 87 | tasks: |
| 76 | - id: 1 | 88 | - id: 1 |
| 77 | - title: "Decide the first family, model detection and test models" | 89 | + title: "Decide model detection / configuration, confidence formula, shared prefix (test models chosen: Jev-Style-0.8B-Decision-v3, JevK5)" |
| 78 | state: open | 90 | state: open |
| 79 | priority: high | 91 | priority: high |
| 80 | author: | 92 | author: |
| @@ -90,7 +102,7 @@ tasks: | |||
| 90 | email: ph.charriere@gmail.com | 102 | email: ph.charriere@gmail.com |
| 91 | createdAt: 2026-11-26T20:00:00.000Z | 103 | createdAt: 2026-11-26T20:00:00.000Z |
| 92 | - id: 3 | 104 | - id: 3 |
| 93 | - title: "Engine: decision scoring for the first family (MLX, compare with llama.cpp reference values)" | 105 | + title: "Engine: verdict readout (Jev-Style) and letter readout (JevK5) on MLX, compared with their reference runtimes" |
| 94 | state: open | 106 | state: open |
| 95 | priority: high | 107 | priority: high |
| 96 | author: | 108 | author: |