mlboydaisuke commited on
Commit
b6c51bc
·
verified ·
1 Parent(s): e41ec56

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +68 -0
README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Kezmark/Mordant-3B-Think
4
+ base_model_relation: quantized
5
+ tags:
6
+ - litert
7
+ - litert-lm
8
+ - on-device
9
+ - granite
10
+ - reasoning
11
+ - image-prompt
12
+ language:
13
+ - en
14
+ pipeline_tag: text-generation
15
+ ---
16
+
17
+ # Mordant-3B-Think — LiteRT-LM (on-device)
18
+
19
+ On-device conversion of [Kezmark/Mordant-3B-Think](https://huggingface.co/Kezmark/Mordant-3B-Think) —
20
+ a full fine-tune of [ibm-granite/granite-4.1-3b](https://huggingface.co/ibm-granite/granite-4.1-3b)
21
+ for AI image-generation prompt composition with chain-of-thought reasoning — to a `.litertlm`
22
+ bundle for the [LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM) runtime. All credit for
23
+ the model itself goes to its author; this repo only packages it for phones and desktops.
24
+
25
+ **Requires litert-lm ≥ 0.16 to run.**
26
+
27
+ | file | quant | size |
28
+ |---|---|---|
29
+ | `Mordant-3B-Think_int8.litertlm` | dynamic int8 (linears + embedding) | 3.76 GB |
30
+
31
+ ## Conversion & verification
32
+
33
+ Converted with one command by [hf-to-litertlm](https://github.com/john-rocky/hf-to-litertlm)
34
+ (`python scripts/convert.py Kezmark/Mordant-3B-Think`, 2026-08-25):
35
+
36
+ - The finetune's own chat template — a thinking-form template that opens the assistant turn
37
+ with `<think>` — is embedded verbatim (byte-equal to the checkpoint's
38
+ `chat_template.jinja`, 1474/1474).
39
+ - The spurious metadata start token is dropped: this family declares `bos == eos ==
40
+ <|end_of_text|>` and its template never renders a leading BOS, so an engine-prepended
41
+ start token reads as "this document already ended" — measured on this checkpoint, it flips
42
+ HF bf16 greedy output into a code-fence loop.
43
+ - Reduced 7-signature prefill ladder + externalized embedder (the ≥3B ship shape; the full
44
+ 11-signature ladder is killed by iOS at Metal init on this family).
45
+ - Quality gate: **8/8** on the 8-question sanity gate (think-aware budget), non-degenerate.
46
+
47
+ ## Performance (Apple M4 Max, litert-lm 0.16.0, `-p 256 -d 256 --runs 3 --cache no`)
48
+
49
+ | backend | prefill tok/s | decode tok/s | TTFT |
50
+ |---|---:|---:|---:|
51
+ | CPU | 97.3 | 20.2 | 2.68 s |
52
+ | GPU | 1129 | 71.9 | 0.24 s |
53
+
54
+ ## Usage
55
+
56
+ ```bash
57
+ pip install litert-lm
58
+ litert-lm run Mordant-3B-Think_int8.litertlm \
59
+ --prompt "A cat sitting on a windowsill at sunset" --max-num-tokens 4096
60
+ ```
61
+
62
+ The model answers with a `<think>…</think>` block followed by the composed image prompt —
63
+ budget generation length accordingly. On Android, load the bundle in an app embedding the
64
+ LiteRT-LM engine (e.g. Google AI Edge Gallery-style hosts).
65
+
66
+ ## License
67
+
68
+ apache-2.0, inherited from the source model and its granite-4.1 base.