sarashina2.2-1b-instruct-v0.1 — LiteRT-LM

sbintuitions/sarashina2.2-1b-instruct-v0.1(SB Intuitions の日本語 LLM)を、Google の LiteRT-LM ランタイム用 .litertlm 形式に変換したものです。スマートフォン・PC の CPU / GPU 上で、ネット接続なしに日本語チャットが動きます。動作確認は litert-lm 0.16.x で行いました。

sarashina2.2 は SB Intuitions が日本語向けに事前学習・指示学習した Llama 型の密モデル(24 層・hidden 1792・GQA 16:8・語彙 102,400(untied))で、思考(reasoning)チャネルを持たない汎用チャットモデルです。公式カードの日本語ベンチマークは Elyza-tasks-100 2.88 / Japanese MT Bench 5.09。ライセンスは MIT

ファイル 量子化 サイズ
sarashina2.2-1b-instruct-v0.1_int8.litertlm int8 dynamic(線形層 + 埋め込み) 1505 MB
sarashina2.2-1b-instruct-v0.1_int4.litertlm int4 blockwise-32 + OCTAV(線形層)、埋め込みは int8 904 MB

まず int8 を推奨します。 bf16 と同等の精度(JCQA 76 vs bf16 75)で、全ゲート満点です。int4 も精度は落ちず(JCQA 77)、GPU の decode は S26 で 17%、Mac で 9% 速く、ファイルは約 40% 小さい(904 MB)一方、CPU の prefill は 2 倍以上遅くなります。GPU で動かす・容量を抑えたい場合は int4、CPU 中心なら int8 が向きます。

動作確認

  • Mac 8 問ゲート(Apple M4 Max、litert-lm 0.16 系、1 問 1 プロセス、greedy): 英語 8 問 = int8 CPU 8/8 / GPU 8/8、int4 CPU 8/8 / GPU 8/8。日本語 8 問(同じ 8 検査を日本語で: 計算・首都・反対語・曜日数・英訳・掛け算・小数比較・富士山の県)= int8 CPU 8/8 / GPU 8/8、int4 CPU 8/8 / GPU 8/8。bf16 の PyTorch 参照は英語 8/8 / 日本語 7/8 — 英語の取りこぼしは元モデル由来です(bf16 も「merci」と韻の問題を外します)。いずれの脚も反復・特殊トークン垂れ流しなし。
  • 絵文字・異体字のストリーミング: 「😀」「𠮷」「☔」を含む文を復唱させ、1 トークンずつのデコードで U+FFFD(文字化け)が出ないことを全 4 脚で確認(この語彙は絵文字を 4 個のバイトトークンに分けるため、逐次デコードの検査が要ります)。
  • トークナイザ一致: 埋め込んだ HF tokenizer.json をエンジン側で tokenize し、HF 側と 7 種のプローブ(特殊トークン文字列・日本語・混在・絵文字/異体字・Latin-1・空白・①㈱〒)で ID 列が完全一致。
  • マルチターン(3 ターン日本語、python API、greedy): 4 バンドル全てで空応答・特殊トークン漏れなし。
  • Galaxy S26(SM-S942Q、Adreno、litert_lm_advanced_main v0.16.0 リリースキット): 日本語プロンプト「日本の首都はどこですか?」に GPU / CPU の両方で「東京」と回答。GPU は全 11 の prefill signature と decode グラフが LITERT_CL に完全委譲(prefill_2〜1024 は 1066/1066 ノード、prefill_1 は 947/947、decode は 975/975、XNNPack への差し戻しゼロ)。

精度 — JCommonsenseQA(JGLUE v1.3 valid、先頭 100 問、greedy)

質問と 5 択を提示し「選択肢の文字列だけを答えよ」とした自前ハーネスの数字です(正解文字列が含まれ、かつ他の選択肢が先に出ていなければ正解)。このハーネス内でのみ比較可能で、公表されている JGLUE スコアとは比べられません。

構成 正解数
PyTorch bf16(参照、MPS) 75/100
LiteRT int8(CPU) 76/100
LiteRT int4 block-32(CPU) 77/100

使い方

litert-lm run ./sarashina2.2-1b-instruct-v0.1_int8.litertlm --prompt "日本の首都はどこですか? 簡潔に答えてください。"

# GPU
litert-lm run ./sarashina2.2-1b-instruct-v0.1_int8.litertlm --backend gpu --cache no --prompt "海について一文で書いてください。"

バンドルはモデル公式のチャット書式(<|user|>…</s><|assistant|>…</s>、system は <|system|>…</s>)を構造化テンプレートとして内蔵し、停止トークン </s>(id 2)を宣言しています。KV キャッシュ上限 4096 トークン、prefill signature は 1〜1024 の 11 段。

Android: Google AI Edge Gallery にこのリポジトリをインポート(またはファイルを端末に置いてローカルインポート)して、日本語で会話できます。

性能

Galaxy S26(SM-S942Q、Adreno GPU、litert_lm_advanced_main = litert-lm v0.16.0 リリースキット、205 トークンのプロンプト + --benchmark、各セル 2 回、範囲表示):

ファイル バックエンド Prefill(205) Decode TTFT ピーク RSS
int8 GPU(OpenCL) 535–586 tok/s 23.3–23.7 tok/s 0.59–0.64 s 1017 MB
int8 CPU 168–239 tok/s 13.4–13.5 tok/s 1.42–1.99 s 2395 MB
int4 GPU(OpenCL) 403–592 tok/s 27.4–27.5 tok/s 0.58–0.83 s 1127 MB
int4 CPU 83.7–83.9 tok/s 13.5 tok/s 3.90–3.91 s 1973 MB

Pixel 8a(Tensor G3、Mali-G715、8 GB、同じキット・同じ 205 トークンのプロンプト、cold 2 回、2026-09-07): int8 CPU は prefill 95–98 tok/s / decode 8.6–9.5 tok/s / TTFT 3.4 s / peak 2449 MB。GPU は未計測 — 1.5 GB の int8 は Mali GPU 上でファイルの約 4 倍のメモリを常駐させるため、8 GB 端末の予算を超えます。この端末クラスでは int8 を CPU で動かすのが litertlm_manifest.json の推奨です。

Apple M4 Max(litert-lm benchmark 0.16.0、-p 256 -d 256 --runs 3 --cache no、待機状態のマシン、GPU セルは 300 秒休止後):

ファイル バックエンド Prefill(256) Decode TTFT
int8 GPU 3554 tok/s 146.4 tok/s 0.090 s
int8 CPU 822 tok/s 35.1 tok/s 0.844 s
int4 GPU 3578 tok/s 159.4 tok/s 0.088 s
int4 CPU 336 tok/s 34.7 tok/s 0.922 s

iPhone 17 Pro の実測行は、BenchmarkApp(128 トークン、コールドスタート)で取得でき次第この節に追記します。アーキテクチャは素の Llama(attention のみ)で、iOS 固有の壁(単一セクション 2 GiB の mmap 上限)より十分小さいファイルです。

同じ端末・同じランタイムでの LFM2.5-230M(語彙 65k、tied)の decode は S26 GPU で 122 tok/s でした。sarashina2.2 が遅いのは語彙 102,400 が untied で、埋め込み + 出力層だけで 367M パラメータあり、1 トークンごとにその出力層を読むためです。

変換メモ

litert-torch 0.9.3 / transformers 5.14.1 / ai-edge-quantizer のリリース版のみで変換しました(再現スクリプト: hf-to-litertlm)。

  • トークナイザは vendor の tokenizer.model ではなく HF tokenizer.json を埋め込んでいます。 sarashina の SentencePiece モデルは <|user|> <|assistant|> <|system|> </s> を CONTROL 片として持ち、素の sentencepiece は CONTROL 片を文字列から一致させません(<|user|>< | user | > の 5 片になる)。HF fast tokenizer は added token として 1 ID に一致させます。
  • BOS を前置しません。 tokenizer_configadd_bos_token: false で公式テンプレートも <s> を出しませんが、exporter は bos_token から start_token を書いてしまいます。bf16 で同じプロンプトに <s> を付けると 0.5b は 8 問ゲートを英語 6→5、日本語 8→7 に落としたため、バンドルには start_token を入れていません。
  • チャットテンプレートは公式 jinja と同じ文字列を出す構造化 prefix/suffix(system / user / assistant)。tool-calling 分岐は含みません。
  • 量子化は export 時(int8 = dynamic_wi8_afp32、int4 = blockwise-32 + OCTAV、埋め込み int8)。後処理なし。

ライセンスと変更点

元モデルと同じ MIT License(Copyright (c) 2025 SB Intuitions)で配布します。元モデルからの変更点: safetensors bf16 の重みを LiteRT flatbuffer に変換し上記のとおり量子化、トークナイザとチャット書式を .litertlm に同梱。学習・微調整は行っていません。元モデルの制限(安全性学習が限定的である旨)はそのまま当てはまります。


sarashina2.2-1b-instruct-v0.1 — LiteRT-LM (English)

sbintuitions/sarashina2.2-1b-instruct-v0.1 (SB Intuitions' Japanese LLM) converted to the LiteRT-LM (.litertlm) format for on-device inference with Google's LiteRT-LM runtime. Tested on litert-lm 0.16.x. A plain Llama-architecture dense model (24 layers, hidden 1792, GQA 16:8, 102,400-entry untied vocab), Japanese-first, non-thinking; MIT license.

File Recipe Size
sarashina2.2-1b-instruct-v0.1_int8.litertlm int8 dynamic on linears + embedding 1505 MB
sarashina2.2-1b-instruct-v0.1_int4.litertlm int4 blockwise-32 + OCTAV on linears, int8 embedding 904 MB

int8 is the recommended file — bf16-class accuracy (JCQA 76 vs bf16 75) and a perfect score on every gate. int4 loses no accuracy either (JCQA 77) and decodes 17% faster on the S26 GPU and 9% faster on the Mac GPU at ~40% smaller size (904 MB), but its CPU prefill is more than 2× slower — pick int4 for GPU / size-constrained deployments, int8 for CPU-centric ones.

Correctness. 8-question sanity gate (Apple M4 Max, litert-lm 0.16 lineage): English int8 CPU 8/8 / GPU 8/8, int4 CPU 8/8 / GPU 8/8; the same 8 checks in Japanese int8 CPU 8/8 / GPU 8/8, int4 CPU 8/8 / GPU 8/8; bf16 reference English 8/8 / Japanese 7/8 (the English misses are the checkpoint's own). No degeneration on any leg. Emoji / rare-kanji streaming probe (😀 𠮷 ☔): no U+FFFD on any leg. Engine-vs-HF tokenizer parity: identical ids on 7 probes. 3-turn Japanese multi-turn: pass on all four bundles. Galaxy S26: both files answer a Japanese capital question correctly on GPU and CPU, with full OpenCL delegation (every node of all 11 prefill signatures and the decode graph on LITERT_CL: 1066/1066 for prefill_2–1024, 947/947 for prefill_1, 975/975 for decode; zero XNNPack fallback).

Accuracy — JCommonsenseQA (JGLUE v1.3 valid, first 100, greedy, own harness; comparable only within this table): bf16 75/100 · int8 76/100 · int4 77/100.

Usage. litert-lm run ./sarashina2.2-1b-instruct-v0.1_int8.litertlm --prompt "…" (add --backend gpu --cache no for the GPU). The bundle embeds the model's own chat markup (<|user|>…</s><|assistant|>) as structured prompt templates and declares stop </s>; KV budget 4096, prefill signatures 1–1024. Android: import into Google AI Edge Gallery.

Performance — see the Japanese tables above (Galaxy S26 rows from litert_lm_advanced_main, v0.16.0 release kit, 205-token prompt, 2 runs; Pixel 8a int8 CPU row, same kit and prompt, two cold runs, 2026-09-07: 95–98 tok/s prefill / 8.6–9.5 decode, GPU not attempted on that 8 GB phone; Mac rows from litert-lm benchmark -p 256 -d 256 --runs 3 --cache no; iPhone 17 Pro rows will be appended once measured).

Conversion notes. Released litert-torch 0.9.3 / transformers 5.14.1 wheels; reproduction in hf-to-litertlm. The bundle embeds the HF tokenizer.json rather than the vendor tokenizer.model (sarashina's SentencePiece model types every chat special as CONTROL, which a bare sentencepiece encoder never matches from text — <|user|> would become 5 pieces). No start_token is written: add_bos_token is false and the official template emits no <s>; prepending one measurably hurts the 0.5b in bf16 (English 6→5, Japanese 8→7 on the 8-question gate). Quantization at export time, no post-processing.

License and changes. MIT (inherited; Copyright (c) 2025 SB Intuitions). Changes from the original work: weights converted from safetensors bf16 to LiteRT flatbuffers and quantized as described; tokenizer and chat markup repackaged into the .litertlm. No training or fine-tuning.

Downloads last month
77
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for litert-community/sarashina2.2-1b-instruct-v0.1