dhtocks commited on
Commit
d96dd2a
·
verified ·
1 Parent(s): d7e63d9

plainer wording, Korean suite table

Browse files
Files changed (1) hide show
  1. README.md +51 -26
README.md CHANGED
@@ -9,29 +9,36 @@ tags: [decision-model, classification, calibration, kev, system-one, lora, point
9
 
10
  # Malkuth-4B
11
 
12
- A small decision model for multilingual and Korean classification. Given text, a question and a set of criteria, it
13
- returns a probability distribution over the options instead of generating an answer. Post-trained from
14
- [Kev](https://github.com/jaredpalmer/kev) and compatible with TypeSafe's System One API.
15
 
16
- Code, training mixes and evaluation: [newfull5/malkuth](https://github.com/newfull5/malkuth).
17
- Companion model: [dhtocks/malkuth-2b](https://huggingface.co/dhtocks/malkuth-2b) (2B).
18
 
19
- ## Model
 
20
 
21
- - Rank-16 LoRA adapter and a pointer head on a frozen `Qwen/Qwen3.5-4B-Base`; 33.8M trainable parameters, 124 MB adapter
22
- - `choice` (1-255 options), `noul` (yes/no) and `score` (ordered levels), several questions per request
23
- - Questions share the input text but cannot read each other, so one document can be classified, checked and scored at once
24
- - Probabilities are temperature-calibrated on a validation split; the temperature never changes which option wins
25
 
26
- ## Usage
 
 
 
 
 
27
 
28
- Serve with Kev; the official `typesafe-sdk` works against it with a `base_url` change.
 
 
 
 
29
 
30
  ```bash
31
  git clone https://github.com/jaredpalmer/kev.git kev && cd kev && uv sync --extra serve
32
  uv run --extra serve python -m kev.serve --run dhtocks/malkuth-4b --port 8009
33
  ```
34
 
 
 
35
  ```python
36
  from typesafe_sdk import Choice, Noul, Score, TypeSafeClient
37
 
@@ -51,36 +58,54 @@ print(r.choices["team"].choice, r.choices["team"].probabilities)
51
 
52
  ## Evaluation
53
 
54
- 29 suites, about 129,000 questions, the same items for every model; Jev measured through its API.
55
- **held-out** is the nine datasets absent from the training mix — the number to read. **all** includes ten we trained
56
- on. Brier scores the probabilities, not just the chosen answer; lower is better.
57
 
58
- | Model | Accuracy (held-out) ↑ | Accuracy (all) ↑ | Brier (held-out) ↓ |
 
 
 
 
59
  |---|---:|---:|---:|
60
  | Jev API | **0.754** ±0.0042 | 0.790 | **0.355** |
61
- | **Malkuth-4B** | 0.724 ±0.0044 | **0.794** | 0.385 |
62
- | **Malkuth-2B** | 0.703 ±0.0044 | 0.765 | 0.412 |
63
  | Kev-9B | 0.700 ±0.0046 | 0.737 | 0.407 |
64
  | Kev-4B | 0.686 ±0.0046 | 0.720 | 0.407 |
65
  | Kev-0.8B | 0.589 ±0.0050 | 0.584 | 0.539 |
66
  | Laya (best of four) | 0.544 ±0.0044 | 0.507 | 0.654 |
67
 
68
- Model time per request on one A100 80GB in bf16, median of 20, new state / prefix-cached state: 48 / 32 ms for six questions, 145 / 33 ms on a 2,200-token state.
 
 
 
 
 
 
 
 
 
 
 
69
 
70
- Per-dataset scores, calibration analysis and third-party test sets:
 
 
 
71
  [docs/evaluation.md](https://github.com/newfull5/malkuth/blob/main/docs/evaluation.md).
72
 
73
  ## Training data
74
 
75
- 89,791 labelled requests from 20 public sources — 62,400 `choice`, 24,790 `noul` and 7,401 `score` questions, across
76
- ten core languages with five Korean-only sources. Built by
77
- [`tools/build_train_mix.py`](https://github.com/newfull5/malkuth/blob/main/tools/build_train_mix.py); per-source
78
- licences in [docs/benchmarks.md](https://github.com/newfull5/malkuth/blob/main/docs/benchmarks.md).
 
 
79
 
80
  ## License
81
 
82
- - **Weights** - the training mixes include CC-BY-NC datasets.
83
- - **Code** - Apache-2.0, same as Kev and the Qwen bases.
84
 
85
  ## Citation
86
 
 
9
 
10
  # Malkuth-4B
11
 
12
+ A small multilingual decision model for classification, with a focus on Korean.
 
 
13
 
14
+ Given a text, a question, and a set of criteria, Malkuth returns probabilities over the possible choices instead of
15
+ generating text.
16
 
17
+ Malkuth-4B is a LoRA adapter trained on [Kev](https://github.com/jaredpalmer/kev) and built on a frozen
18
+ `Qwen/Qwen3.5-4B-Base`. It has 33.8M trainable parameters and a 124 MB adapter.
19
 
20
+ It supports three question types:
 
 
 
21
 
22
+ - `choice`: select one of up to 255 options
23
+ - `noul`: yes or no
24
+ - `score`: select an ordered level
25
+
26
+ Multiple questions can be evaluated against the same input. Questions are evaluated independently, so they cannot see
27
+ each other's answers. Probabilities are temperature-calibrated on a held-out validation split.
28
 
29
+ Malkuth is served through Kev and works with the TypeSafe System One API. The companion model is
30
+ [dhtocks/malkuth-2b](https://huggingface.co/dhtocks/malkuth-2b) (2B). Code, training mixes and evaluation live in
31
+ [newfull5/malkuth](https://github.com/newfull5/malkuth).
32
+
33
+ ## Usage
34
 
35
  ```bash
36
  git clone https://github.com/jaredpalmer/kev.git kev && cd kev && uv sync --extra serve
37
  uv run --extra serve python -m kev.serve --run dhtocks/malkuth-4b --port 8009
38
  ```
39
 
40
+ The official `typesafe-sdk` works against the local server with a `base_url` change.
41
+
42
  ```python
43
  from typesafe_sdk import Choice, Noul, Score, TypeSafeClient
44
 
 
58
 
59
  ## Evaluation
60
 
61
+ 29 suites and about 129,000 questions. Every model answered the same items. Jev was measured through its API.
 
 
62
 
63
+ - **held-out**: the nine datasets we did not train on
64
+ - **all**: all 29 suites, ten of which we trained on
65
+ - **Brier**: quality of the probabilities, lower is better
66
+
67
+ | Model | Accuracy (held-out) | Accuracy (all) | Brier (held-out) |
68
  |---|---:|---:|---:|
69
  | Jev API | **0.754** ±0.0042 | 0.790 | **0.355** |
70
+ | Malkuth-4B | 0.724 ±0.0044 | **0.794** | 0.385 |
71
+ | Malkuth-2B | 0.703 ±0.0044 | 0.765 | 0.412 |
72
  | Kev-9B | 0.700 ±0.0046 | 0.737 | 0.407 |
73
  | Kev-4B | 0.686 ±0.0046 | 0.720 | 0.407 |
74
  | Kev-0.8B | 0.589 ±0.0050 | 0.584 | 0.539 |
75
  | Laya (best of four) | 0.544 ±0.0044 | 0.507 | 0.654 |
76
 
77
+ On the five Korean suites:
78
+
79
+ | Suite | Jev | Malkuth-4B | Malkuth-2B | Kev-9B | Kev-4B |
80
+ |---|---:|---:|---:|---:|---:|
81
+ | `klue_nli` | **0.936** | 0.912 | 0.832 | 0.882 | 0.866 |
82
+ | `klue_ynat` | 0.724 | **0.852** | 0.824 | 0.758 | 0.728 |
83
+ | `nsmc` | 0.850 | **0.878** | 0.862 | 0.856 | 0.806 |
84
+ | `kobest` | 0.903 | **0.904** | 0.819 | 0.850 | 0.809 |
85
+ | `kold` | 0.806 | **0.820** | 0.768 | 0.602 | 0.654 |
86
+ | mean | 0.844 | **0.873** | 0.821 | 0.790 | 0.773 |
87
+
88
+ Four of these five contributed their train splits to our mix, so this table is in-distribution for Malkuth.
89
 
90
+ Latency on one A100 80GB in bf16, median of 20 requests. The second number is a repeated input served from the prefix
91
+ cache. Six questions take 48 ms on a new input and 32 ms on a repeated one.
92
+
93
+ Per-dataset scores and calibration analysis are in
94
  [docs/evaluation.md](https://github.com/newfull5/malkuth/blob/main/docs/evaluation.md).
95
 
96
  ## Training data
97
 
98
+ 89,791 labelled requests from 20 public sources. 62,400 `choice`, 24,790 `noul` and 7,401 `score` questions, across ten
99
+ core languages with five Korean-only sources.
100
+
101
+ Built by [`tools/build_train_mix.py`](https://github.com/newfull5/malkuth/blob/main/tools/build_train_mix.py).
102
+ Per-source licences are in
103
+ [docs/benchmarks.md](https://github.com/newfull5/malkuth/blob/main/docs/benchmarks.md).
104
 
105
  ## License
106
 
107
+ - Weights: the training mixes include CC-BY-NC datasets.
108
+ - Code: Apache-2.0, same as Kev and the Qwen bases.
109
 
110
  ## Citation
111