gliner25-decide-litert / config.json
spybyscript's picture
Span file and count file for LiteRT's GPU, per-chip NPU span files, GPU priority results
e845a2b verified
Raw History Blame Contribute Delete
27 kB
{
"source": "fastino/GLiNER2.5-Decide@bbe10ff77ebb238777c17d3a8ac9260e30929057",
"variant": "wfp16",
"precision": "FULLY_CONNECTED weights stored float16 behind DEQUANTIZE (ai-edge-quantizer FLOAT_CASTING); FP32 activations, relative-position tables, norms and biases; finite -1e4 mask",
"runtime": {
"litert": "2.2.0 (validated on the Mac with ai-edge-litert 2.2.0; com.google.ai.edge.litert:litert:2.2.0 on Android)",
"api": "CompiledModel",
"converter": {
"litert-torch": "0.9.4",
"ai-edge-litert": "2.2.0",
"ai-edge-quantizer": "0.9.0",
"litert-converter": "0.4.0",
"torch": "2.13.0",
"transformers": "4.57.6",
"gliner2": "2.0.0"
}
},
"graphs": [
{
"path": "gliner25_decide_wfp16.tflite",
"variant": "wfp16",
"shipped": true,
"about": "FULLY_CONNECTED weights stored float16 behind DEQUANTIZE (ai-edge-quantizer FLOAT_CASTING); FP32 activations, relative-position tables, norms and biases; finite -1e4 mask",
"bytes": 1027590496,
"signatures": [
{
"key": "s128",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
128,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
128
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
1,
128
]
}
]
},
{
"key": "e128",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
128,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
128
]
}
],
"outputs": [
{
"name": "hidden_states",
"dtype": "float32",
"shape": [
1,
128,
1024
]
}
]
},
{
"key": "s160",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
160,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
160
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
1,
160
]
}
]
},
{
"key": "e160",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
160,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
160
]
}
],
"outputs": [
{
"name": "hidden_states",
"dtype": "float32",
"shape": [
1,
160,
1024
]
}
]
},
{
"key": "s256",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
256,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
256
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
1,
256
]
}
]
},
{
"key": "e256",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
256,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
256
]
}
],
"outputs": [
{
"name": "hidden_states",
"dtype": "float32",
"shape": [
1,
256,
1024
]
}
]
},
{
"key": "s512",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
512,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
512
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
1,
512
]
}
]
},
{
"key": "e512",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
512,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
512
]
}
],
"outputs": [
{
"name": "hidden_states",
"dtype": "float32",
"shape": [
1,
512,
1024
]
}
]
}
],
"use": "GPU with explicit FP32 precision (litert-community: the default GPU precision changed 28 of 42 decisions), or the CPU"
},
{
"path": "gliner25_decide_fp16hw.tflite",
"variant": "fp16hw",
"shipped": false,
"about": "wfp16's storage (float16 FULLY_CONNECTED weights behind DEQUANTIZE) over the FP16-hardware graph: LayerNorm power-of-two pre-scale (x*2^-k, eps*4^-k, k from the corpus' FP32 ranges), first feed-forward FULLY_CONNECTED split in two halves, finite -1e4 mask",
"bytes": 1027504032,
"signatures": [
{
"key": "s128",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
128,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
128
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
1,
128
]
}
]
},
{
"key": "e128",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
128,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
128
]
}
],
"outputs": [
{
"name": "hidden_states",
"dtype": "float32",
"shape": [
1,
128,
1024
]
}
]
},
{
"key": "s160",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
160,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
160
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
1,
160
]
}
]
},
{
"key": "e160",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
160,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
160
]
}
],
"outputs": [
{
"name": "hidden_states",
"dtype": "float32",
"shape": [
1,
160,
1024
]
}
]
},
{
"key": "s256",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
256,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
256
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
1,
256
]
}
]
},
{
"key": "e256",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
256,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
256
]
}
],
"outputs": [
{
"name": "hidden_states",
"dtype": "float32",
"shape": [
1,
256,
1024
]
}
]
},
{
"key": "s512",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
512,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
512
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
1,
512
]
}
]
},
{
"key": "e512",
"inputs": [
{
"name": "inputs_embeds",
"dtype": "float32",
"shape": [
1,
512,
1024
]
},
{
"name": "attention_mask",
"dtype": "float32",
"shape": [
1,
512
]
}
],
"outputs": [
{
"name": "hidden_states",
"dtype": "float32",
"shape": [
1,
512,
1024
]
}
]
}
],
"use": "GPU at FP16 precision, or the Qualcomm NPU (FP16 compute); the FP32 paths give the same decisions as wfp16 (the rewrites are exact in FP32)"
},
{
"path": "gliner25_decide_heads_wfp16.tflite",
"role": "heads",
"bytes": 105436176,
"about": "the span-extraction heads and the classifier, float16 weight storage, FP32 compute: span_rep (w{W}: words [1,W,1024] -> span_rep [1,W,8,1024]; spans start at word i and end at i+k for k < 8), count (prompt [1,1024] -> count_logits [1,20]), count_embed (c{C}_m{M}: fields [M,1024] -> struct_proj [C,M,1024]; the GRU is causal over steps, so take the smallest C >= the predicted count), classifier (k{K}: states [K,1024] -> logits [K])",
"signatures": [
{
"key": "w64",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
64,
1024
]
}
],
"outputs": [
{
"name": "span_rep",
"dtype": "float32",
"shape": [
1,
64,
8,
1024
]
}
]
},
{
"key": "w128",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
128,
1024
]
}
],
"outputs": [
{
"name": "span_rep",
"dtype": "float32",
"shape": [
1,
128,
8,
1024
]
}
]
},
{
"key": "w256",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
256,
1024
]
}
],
"outputs": [
{
"name": "span_rep",
"dtype": "float32",
"shape": [
1,
256,
8,
1024
]
}
]
},
{
"key": "w512",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
512,
1024
]
}
],
"outputs": [
{
"name": "span_rep",
"dtype": "float32",
"shape": [
1,
512,
8,
1024
]
}
]
},
{
"key": "count",
"inputs": [
{
"name": "prompt",
"dtype": "float32",
"shape": [
1,
1024
]
}
],
"outputs": [
{
"name": "count_logits",
"dtype": "float32",
"shape": [
1,
20
]
}
]
},
{
"key": "c1_m8",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
8,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
1,
8,
1024
]
}
]
},
{
"key": "c1_m32",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
32,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
1,
32,
1024
]
}
]
},
{
"key": "c4_m8",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
8,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
4,
8,
1024
]
}
]
},
{
"key": "c4_m32",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
32,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
4,
32,
1024
]
}
]
},
{
"key": "c20_m8",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
8,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
20,
8,
1024
]
}
]
},
{
"key": "c20_m32",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
32,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
20,
32,
1024
]
}
]
},
{
"key": "k32",
"inputs": [
{
"name": "states",
"dtype": "float32",
"shape": [
32,
1024
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
32
]
}
]
},
{
"key": "k128",
"inputs": [
{
"name": "states",
"dtype": "float32",
"shape": [
128,
1024
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
128
]
}
]
}
]
},
{
"path": "gliner25_decide_span_wfp16.tflite",
"role": "span",
"bytes": 75781456,
"about": "the heads file's span_rep, count and classifier for LiteRT's GPU, float16 weight storage, FP32 compute: w{W} (words [1,W,1024] -> span_rep [1,W,8,1024], the first layer per word), f{W}_p{P} (words [1,W,1024], queries [P,1024] = struct_proj flattened over count and fields -> scores [P,W,8], the raw span logits of einsum('lkd,bpd->bplk', span_rep, struct_proj) with the last layer folded into the queries), count (prompt [1,1024] -> count_logits [1,20]), classifier (k{K}: states [K,1024] -> logits [K]). Spans ending past the bucket read zero padding (they end past the text, which the library masks).",
"signatures": [
{
"key": "w64",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
64,
1024
]
}
],
"outputs": [
{
"name": "span_rep",
"dtype": "float32",
"shape": [
1,
64,
8,
1024
]
}
]
},
{
"key": "w128",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
128,
1024
]
}
],
"outputs": [
{
"name": "span_rep",
"dtype": "float32",
"shape": [
1,
128,
8,
1024
]
}
]
},
{
"key": "w256",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
256,
1024
]
}
],
"outputs": [
{
"name": "span_rep",
"dtype": "float32",
"shape": [
1,
256,
8,
1024
]
}
]
},
{
"key": "w512",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
512,
1024
]
}
],
"outputs": [
{
"name": "span_rep",
"dtype": "float32",
"shape": [
1,
512,
8,
1024
]
}
]
},
{
"key": "f64_p16",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
64,
1024
]
},
{
"name": "queries",
"dtype": "float32",
"shape": [
16,
1024
]
}
],
"outputs": [
{
"name": "scores",
"dtype": "float32",
"shape": [
16,
64,
8
]
}
]
},
{
"key": "f64_p128",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
64,
1024
]
},
{
"name": "queries",
"dtype": "float32",
"shape": [
128,
1024
]
}
],
"outputs": [
{
"name": "scores",
"dtype": "float32",
"shape": [
128,
64,
8
]
}
]
},
{
"key": "f128_p16",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
128,
1024
]
},
{
"name": "queries",
"dtype": "float32",
"shape": [
16,
1024
]
}
],
"outputs": [
{
"name": "scores",
"dtype": "float32",
"shape": [
16,
128,
8
]
}
]
},
{
"key": "f128_p128",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
128,
1024
]
},
{
"name": "queries",
"dtype": "float32",
"shape": [
128,
1024
]
}
],
"outputs": [
{
"name": "scores",
"dtype": "float32",
"shape": [
128,
128,
8
]
}
]
},
{
"key": "f256_p16",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
256,
1024
]
},
{
"name": "queries",
"dtype": "float32",
"shape": [
16,
1024
]
}
],
"outputs": [
{
"name": "scores",
"dtype": "float32",
"shape": [
16,
256,
8
]
}
]
},
{
"key": "f256_p128",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
256,
1024
]
},
{
"name": "queries",
"dtype": "float32",
"shape": [
128,
1024
]
}
],
"outputs": [
{
"name": "scores",
"dtype": "float32",
"shape": [
128,
256,
8
]
}
]
},
{
"key": "f512_p16",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
512,
1024
]
},
{
"name": "queries",
"dtype": "float32",
"shape": [
16,
1024
]
}
],
"outputs": [
{
"name": "scores",
"dtype": "float32",
"shape": [
16,
512,
8
]
}
]
},
{
"key": "f512_p128",
"inputs": [
{
"name": "words",
"dtype": "float32",
"shape": [
1,
512,
1024
]
},
{
"name": "queries",
"dtype": "float32",
"shape": [
128,
1024
]
}
],
"outputs": [
{
"name": "scores",
"dtype": "float32",
"shape": [
128,
512,
8
]
}
]
},
{
"key": "count",
"inputs": [
{
"name": "prompt",
"dtype": "float32",
"shape": [
1,
1024
]
}
],
"outputs": [
{
"name": "count_logits",
"dtype": "float32",
"shape": [
1,
20
]
}
]
},
{
"key": "k32",
"inputs": [
{
"name": "states",
"dtype": "float32",
"shape": [
32,
1024
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
32
]
}
]
},
{
"key": "k128",
"inputs": [
{
"name": "states",
"dtype": "float32",
"shape": [
128,
1024
]
}
],
"outputs": [
{
"name": "logits",
"dtype": "float32",
"shape": [
128
]
}
]
}
]
},
{
"path": "gliner25_decide_count_wfp16.tflite",
"role": "count",
"bytes": 38099744,
"about": "count_embed alone, as in the heads file (c{C}_m{M}: fields [M,1024] -> struct_proj [C,M,1024]); its GRU runs on the CPU",
"signatures": [
{
"key": "c1_m8",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
8,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
1,
8,
1024
]
}
]
},
{
"key": "c1_m32",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
32,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
1,
32,
1024
]
}
]
},
{
"key": "c4_m8",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
8,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
4,
8,
1024
]
}
]
},
{
"key": "c4_m32",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
32,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
4,
32,
1024
]
}
]
},
{
"key": "c20_m8",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
8,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
20,
8,
1024
]
}
]
},
{
"key": "c20_m32",
"inputs": [
{
"name": "fields",
"dtype": "float32",
"shape": [
32,
1024
]
}
],
"outputs": [
{
"name": "struct_proj",
"dtype": "float32",
"shape": [
20,
32,
1024
]
}
]
}
]
}
],
"table": {
"path": "gliner25_decide_embeddings_f16.bin",
"dtype": "float16",
"byteOrder": "little-endian",
"shape": [
128011,
1024
],
"layout": "row-major, no header: row `id` is bytes [id * 2048, id * 2048 + 2048), 1024 float16 values",
"bytes": 262166528,
"sha256": "f90f5d837721b3d4df7194a89ea18bbea5c449e6944fb6078664f1a8d20484fd",
"use": "memory-map the file; for each position of the bucket take the row of its zero-padded id (padding takes id 0's row) and upcast to float32 into inputs_embeds"
},
"buckets": [
128,
160,
256,
512
],
"host": {
"bucket": "the smallest of s128 / s160 / s256 / s512 that holds the request's ids; refuse longer than 512 tokens, never truncate",
"inputs": "inputs_embeds float32 [1, N, 1024] and attention_mask float32 [1, N] (1.0 for tokens, 0.0 for padding); bind them by name: the flatbuffer's SignatureDef lists attention_mask, inputs_embeds, while ai-edge-litert 2.2.0's CompiledModel reports inputs_embeds, attention_mask",
"outputs": "logits float32 [1, N]: read the [L] marker positions of each task (single-label: softmax over the task's markers; multi-label: sigmoid), as smdesai's Core ML port (GLiNER25-Decide-FP16-CoreML) does with its logits",
"temperature": 1.0
},
"accelerators": {
"gpu": "set GpuOptions precision explicitly (FP32 for wfp16; FP16 only with fp16hw) and constantTensorSharing, so the signatures share the weights on the GPU as they do in the file",
"cpu": "set CpuOptions' XNNPACK weight cache path: without it XNNPACK packs a copy of the weights for every signature (Mac, wfp16: see validation.json memory); 4 threads in the validation",
"npu": "fp16hw only (FP16 compute); not run on the Mac"
},
"positionTables": "each signature holds its own FP32 copy of the relative-position tables (the converter folds each bucket's slice; 24 layers x 2 x [1, 16, 64, 2N]); every other constant is stored once and shared by all signatures",
"coremlDifferences": [
"a signature per bucket (s128, s160, s256, s512) instead of the multifunction package's context128/context256/context512",
"the token table lives outside the graph (inputs_embeds), as litert-community's port does; the Core ML port takes input_ids",
"attention_mask is float32 instead of int32; logits are the same [1, N] float32 at every position",
"precision: FULLY_CONNECTED weights stored float16 behind DEQUANTIZE (ai-edge-quantizer FLOAT_CASTING); FP32 activations, relative-position tables, norms and biases; finite -1e4 mask (the Core ML port runs FP16 on the GPU)"
],
"tokenizer": {
"file": "tokenizer.json",
"specialTokens": {
"[PAD]": 0,
"[CLS]": 1,
"[SEP]": 2,
"[UNK]": 3,
"[MASK]": 128000,
"[SEP_STRUCT]": 128001,
"[SEP_TEXT]": 128002,
"[P]": 128003,
"[C]": 128004,
"[E]": 128005,
"[R]": 128006,
"[L]": 128007,
"[EXAMPLE]": 128008,
"[OUTPUT]": 128009,
"[DESCRIPTION]": 128010
}
},
"provenance": {
"graph": "ported from litert-community/GLiNER2.5-Decide-LiteRT@c687e899 (Apache-2.0)"
},
"extraction": {
"encoder": "the e{N} signatures: inputs_embeds and attention_mask as for s{N} -> hidden_states [1, N, 1024]",
"heads": "gliner25_decide_heads_wfp16.tflite",
"referenceRuntime": "runtime/litert_span_runtime.py (gliner2 2.0.0's span extractor over these graphs)",
"span": "gliner25_decide_span_wfp16.tflite with gliner25_decide_count_wfp16.tflite replaces the heads file (runtime: span=, count=)"
}
}