naklitechie commited on
Commit
0442e7f
路
verified 路
1 Parent(s): 2908bda

Sync from GitHub

Browse files
classic/engines/lfm2_moe_ssd.js CHANGED
@@ -336,8 +336,17 @@ export class Lfm2MoeSsd extends Gemma4MoeSsd {
336
  }
337
 
338
  // Kernel names for the matrix and expert weights: Q4_0 here; an engine reading a Q8_0 file (hy_v3_moe_ssd.js) swaps
339
- // in the Q8_0 kernels, which take the same bindings and dispatch sizes.
340
- get kq() { return { mm: 'matmulQ4', mmT: 'matmulQ4T', ex: 'expertQ4', exB: 'expertQ4B' }; }
 
 
 
 
 
 
 
 
 
341
  // Attention kernel names (decode, then chunk); an engine with sinks or a window (flint_moe_ssd.js) rebinds its own.
342
  get attnK() { return { score: 'attnScore', soft: 'softmax', out: 'attnOut', scoreB: 'attnScoreB', softB: 'softmaxB', outB: 'attnOutB' }; }
343
 
@@ -353,6 +362,7 @@ export class Lfm2MoeSsd extends Gemma4MoeSsd {
353
  return (this._kernels ||= {
354
  ...super.kernels, ...L2,
355
  ...(this.batchPrefill ? { ...Object.fromEntries(REUSED_B.map((k) => [k, QWEN35_BATCH_KERNELS[k]])), ...L2B } : {}),
 
356
  });
357
  }
358
 
 
336
  }
337
 
338
  // Kernel names for the matrix and expert weights: Q4_0 here; an engine reading a Q8_0 file (hy_v3_moe_ssd.js) swaps
339
+ // in the Q8_0 kernels, which take the same bindings and dispatch sizes. The dense matrices follow the file: a LoRA
340
+ // merged into the dense layers (llama-export-lora, then requantised to Q8_0 to keep the QAD base's quality) leaves
341
+ // them Q8_0 beside the unchanged Q4_0 experts.
342
+ get kq() {
343
+ return (this._kq ||= (() => {
344
+ const types = new Set(Object.values(this.manifest.dense.tensors).map((d) => d.type).filter((t) => t === 'q4' || t === 'q8'));
345
+ if (types.size > 1) throw new Error('dense matrices mix Q4_0 and Q8_0');
346
+ const q8 = types.has('q8');
347
+ return { mm: q8 ? 'matmulQ8' : 'matmulQ4', mmT: q8 ? 'matmulQ8T' : 'matmulQ4T', ex: 'expertQ4', exB: 'expertQ4B' };
348
+ })());
349
+ }
350
  // Attention kernel names (decode, then chunk); an engine with sinks or a window (flint_moe_ssd.js) rebinds its own.
351
  get attnK() { return { score: 'attnScore', soft: 'softmax', out: 'attnOut', scoreB: 'attnScoreB', softB: 'softmaxB', outB: 'attnOutB' }; }
352
 
 
362
  return (this._kernels ||= {
363
  ...super.kernels, ...L2,
364
  ...(this.batchPrefill ? { ...Object.fromEntries(REUSED_B.map((k) => [k, QWEN35_BATCH_KERNELS[k]])), ...L2B } : {}),
365
+ ...(this.batchPrefill && this.kq.mmT === 'matmulQ8T' ? { matmulQ8T: QWEN35_BATCH_KERNELS.matmulQ8T } : {}),
366
  });
367
  }
368
 
classic/refs/lfm2.5-24b-a2b-pi-base.json ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "about": "llama.cpp b11669 (620d2225c), Metal (a shared server on 127.0.0.1:8090, -np 2, -c 32768), -ngl 99: llama-server /completion on the /apply-template prompt, temperature 0, max_tokens 64, on LFM2.5-24B-A2B-QAD-Q4_0.gguf (sha256 89617cc4d3a52e973ee8dea72c7df04285f582107385796ba903f81e540e4afa). Recorded 2026-10-31 by scripts/record-refs.mjs.",
3
+ "conversations": [
4
+ {
5
+ "name": "explain-tcp",
6
+ "messages": [
7
+ {
8
+ "role": "user",
9
+ "content": "Explain the difference between TCP and UDP to a new programmer."
10
+ }
11
+ ],
12
+ "prompt": "<|im_start|>user\nExplain the difference between TCP and UDP to a new programmer.<|im_end|>\n<|im_start|>assistant\n<think>",
13
+ "content": "\nWe need to explain TCP vs UDP to a new programmer. First person, specific. No \"as an AI\". Lead with substance. Let me structure: start with a quick analogy or direct statement. Then contrast key points: connection vs connectionless, reliability, ordering, overhead, use cases. Keep it clear",
14
+ "finish": "stop",
15
+ "tokens": 64
16
+ },
17
+ {
18
+ "name": "json-extract",
19
+ "messages": [
20
+ {
21
+ "role": "user",
22
+ "content": "Extract the name, city and age from this sentence as JSON: \"Priya, 34, moved from Pune to Lisbon last year.\""
23
+ }
24
+ ],
25
+ "prompt": "<|im_start|>user\nExtract the name, city and age from this sentence as JSON: \"Priya, 34, moved from Pune to Lisbon last year.\"<|im_end|>\n<|im_start|>assistant\n<think>",
26
+ "content": "\nWe need to extract name, city, age from sentence: \"Priya, 34, moved from Pune to Lisbon last year.\" The sentence has name",
27
+ "finish": "stop",
28
+ "tokens": 35
29
+ },
30
+ {
31
+ "name": "translate-hi",
32
+ "messages": [
33
+ {
34
+ "role": "user",
35
+ "content": "Translate into Hindi: \"The library opens at nine and closes at six.\""
36
+ }
37
+ ],
38
+ "prompt": "<|im_start|>user\nTranslate into Hindi: \"The library opens at nine and closes at six.\"<|im_end|>\n<|im_start|>assistant\n<think>",
39
+ "content": "1. **Analyze the source sentence:** \"The library opens at nine and closes at six.\"\n * Subject: The library\n * Verb 1: opens\n * Time 1: at nine\n * Conjunction: and\n * Verb 2: closes",
40
+ "finish": "stop",
41
+ "tokens": 64
42
+ },
43
+ {
44
+ "name": "word-problem",
45
+ "messages": [
46
+ {
47
+ "role": "user",
48
+ "content": "A train leaves at 14:10 and arrives at 17:45. How long is the journey? Show the steps briefly."
49
+ }
50
+ ],
51
+ "prompt": "<|im_start|>user\nA train leaves at 14:10 and arrives at 17:45. How long is the journey? Show the steps briefly.<|im_end|>\n<|im_start|>assistant\n<think>",
52
+ "content": "\nWe need to answer: A train leaves at 14:10 and arrives at 17:45. How long is the journey? Show steps briefly.\n\nWe need to compute difference between 14:10 and 17:45.\n\nFrom 14:10 to 17:10 is 3 hours. Then",
53
+ "finish": "stop",
54
+ "tokens": 64
55
+ },
56
+ {
57
+ "name": "sql",
58
+ "messages": [
59
+ {
60
+ "role": "user",
61
+ "content": "Write a SQL query that returns the five customers with the highest total order value from tables customers(id, name) and orders(id, customer_id, amount)."
62
+ }
63
+ ],
64
+ "prompt": "<|im_start|>user\nWrite a SQL query that returns the five customers with the highest total order value from tables customers(id, name) and orders(id, customer_id, amount).<|im_end|>\n<|im_start|>assistant\n<think>",
65
+ "content": "We need to produce a SQL query that returns the top five customers with highest total order value, given two tables: customers(id, name) and orders(id, customer_id, amount). The question: \"Write a SQL query that returns the five customers with the highest total order value from tables customers(id, name) and",
66
+ "finish": "stop",
67
+ "tokens": 64
68
+ },
69
+ {
70
+ "name": "list-rivers",
71
+ "messages": [
72
+ {
73
+ "role": "user",
74
+ "content": "List five major rivers of Africa, one per line, with the country where each reaches the sea."
75
+ }
76
+ ],
77
+ "prompt": "<|im_start|>user\nList five major rivers of Africa, one per line, with the country where each reaches the sea.<|im_end|>\n<|im_start|>assistant\n<think>",
78
+ "content": "We need to list five major rivers of Africa, one per line, with the country where each reaches the sea. So each line: River name",
79
+ "finish": "stop",
80
+ "tokens": 29
81
+ },
82
+ {
83
+ "name": "unicode",
84
+ "messages": [
85
+ {
86
+ "role": "user",
87
+ "content": "What do these emoji usually mean in a text message: 馃檹 馃敟 馃拃 ?"
88
+ }
89
+ ],
90
+ "prompt": "<|im_start|>user\nWhat do these emoji usually mean in a text message: 馃檹 馃敟 馃拃 ?<|im_end|>\n<|im_start|>assistant\n<think>",
91
+ "content": "The user asks: \"What do these emoji usually mean in a text message: 馃檹 馃敟 馃拃 ?\" They want an explanation of the meaning of each emoji individually, and perhaps collectively. The user is asking about typical usage in text messages. This is a straightforward request for information about emoji meanings",
92
+ "finish": "stop",
93
+ "tokens": 64
94
+ },
95
+ {
96
+ "name": "haiku-autumn",
97
+ "messages": [
98
+ {
99
+ "role": "user",
100
+ "content": "Write a haiku about autumn leaves in a city."
101
+ }
102
+ ],
103
+ "prompt": "<|im_start|>user\nWrite a haiku about autumn leaves in a city.<|im_end|>\n<|im_start|>assistant\n<think>",
104
+ "content": "\nWe need to write a haiku about autumn leaves in a city. Haiku: 5-",
105
+ "finish": "stop",
106
+ "tokens": 21
107
+ },
108
+ {
109
+ "name": "system-pirate",
110
+ "messages": [
111
+ {
112
+ "role": "system",
113
+ "content": "Answer like a cheerful pirate, in two sentences."
114
+ },
115
+ {
116
+ "role": "user",
117
+ "content": "What is the boiling point of water at sea level?"
118
+ }
119
+ ],
120
+ "prompt": "<|im_start|>system\nAnswer like a cheerful pirate, in two sentences.<|im_end|>\n<|im_start|>user\nWhat is the boiling point of water at sea level?<|im_end|>\n<|im_start|>assistant\n<think>",
121
+ "content": "\nThe user is asking a straightforward factual question about the boiling point of water at sea level. This is basic science knowledge - water boils at 100 degrees Celsius (212 degrees Fahrenheit) at standard",
122
+ "finish": "stop",
123
+ "tokens": 41
124
+ }
125
+ ]
126
+ }
classic/refs/lfm2.5-24b-a2b-pi-lora.json ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "about": "llama.cpp b11669 (620d2225c), Metal (a shared server on 127.0.0.1:8090, -np 2, -c 32768), LoRA LFM2.5-24B-A2B-harbor-pi-lora-F16.gguf (harness-hub/LFM2.5-24B-A2B-pi-GGUF at a994cf7, sha256 5e96d0592311f8dfd8b3d315f2583436ae88e629075c29339b8dbee8d6cb6a68) loaded with --lora-init-without-apply and set to scale 1 per request, -ngl 99: llama-server /completion on the /apply-template prompt, temperature 0, max_tokens 64, on LFM2.5-24B-A2B-QAD-Q4_0.gguf (sha256 89617cc4d3a52e973ee8dea72c7df04285f582107385796ba903f81e540e4afa). Recorded 2026-10-31 by scripts/record-refs.mjs.",
3
+ "conversations": [
4
+ {
5
+ "name": "explain-tcp",
6
+ "messages": [
7
+ {
8
+ "role": "user",
9
+ "content": "Explain the difference between TCP and UDP to a new programmer."
10
+ }
11
+ ],
12
+ "prompt": "<|im_start|>user\nExplain the difference between TCP and UDP to a new programmer.<|im_end|>\n<|im_start|>assistant\n<think>",
13
+ "content": "\nWe need to explain TCP vs UDP to a new programmer. First person, specific. No \"as an AI\". Lead with substance. Keep it clear. Structure: maybe a short intro, then key differences in a table or bullet list. Emphasize use cases. Let me think: TCP is connection-oriented",
14
+ "finish": "stop",
15
+ "tokens": 64
16
+ },
17
+ {
18
+ "name": "json-extract",
19
+ "messages": [
20
+ {
21
+ "role": "user",
22
+ "content": "Extract the name, city and age from this sentence as JSON: \"Priya, 34, moved from Pune to Lisbon last year.\""
23
+ }
24
+ ],
25
+ "prompt": "<|im_start|>user\nExtract the name, city and age from this sentence as JSON: \"Priya, 34, moved from Pune to Lisbon last year.\"<|im_end|>\n<|im_start|>assistant\n<think>",
26
+ "content": "\nWe need to extract name, city, age from sentence: \"Priya, 34, moved from Pune to Lisbon last year.\" The sentence has name",
27
+ "finish": "stop",
28
+ "tokens": 35
29
+ },
30
+ {
31
+ "name": "translate-hi",
32
+ "messages": [
33
+ {
34
+ "role": "user",
35
+ "content": "Translate into Hindi: \"The library opens at nine and closes at six.\""
36
+ }
37
+ ],
38
+ "prompt": "<|im_start|>user\nTranslate into Hindi: \"The library opens at nine and closes at six.\"<|im_end|>\n<|im_start|>assistant\n<think>",
39
+ "content": "1. **Analyze the source sentence:** \"The library opens at nine and closes at six.\"\n * Subject: The library\n * Verb 1: opens\n * Time 1: at nine\n * Conjunction: and\n * Verb 2: closes",
40
+ "finish": "stop",
41
+ "tokens": 64
42
+ },
43
+ {
44
+ "name": "word-problem",
45
+ "messages": [
46
+ {
47
+ "role": "user",
48
+ "content": "A train leaves at 14:10 and arrives at 17:45. How long is the journey? Show the steps briefly."
49
+ }
50
+ ],
51
+ "prompt": "<|im_start|>user\nA train leaves at 14:10 and arrives at 17:45. How long is the journey? Show the steps briefly.<|im_end|>\n<|im_start|>assistant\n<think>",
52
+ "content": "\nWe need to answer: A train leaves at 14:10 and arrives at 17:45. How long is the journey? Show steps briefly.\n\nWe need to compute difference between 14:10 and 17:45.\n\nFrom 14:10 to 17:10 is 3 hours. Then",
53
+ "finish": "stop",
54
+ "tokens": 64
55
+ },
56
+ {
57
+ "name": "sql",
58
+ "messages": [
59
+ {
60
+ "role": "user",
61
+ "content": "Write a SQL query that returns the five customers with the highest total order value from tables customers(id, name) and orders(id, customer_id, amount)."
62
+ }
63
+ ],
64
+ "prompt": "<|im_start|>user\nWrite a SQL query that returns the five customers with the highest total order value from tables customers(id, name) and orders(id, customer_id, amount).<|im_end|>\n<|im_start|>assistant\n<think>",
65
+ "content": "We need to produce a SQL query that returns the top 5 customers with highest total order value. The schema: customers(id, name) and orders(id, customer_id, amount). So we need to join customers with orders, group by customer, sum(amount) as total_order_value, order descending, limit ",
66
+ "finish": "stop",
67
+ "tokens": 64
68
+ },
69
+ {
70
+ "name": "list-rivers",
71
+ "messages": [
72
+ {
73
+ "role": "user",
74
+ "content": "List five major rivers of Africa, one per line, with the country where each reaches the sea."
75
+ }
76
+ ],
77
+ "prompt": "<|im_start|>user\nList five major rivers of Africa, one per line, with the country where each reaches the sea.<|im_end|>\n<|im_start|>assistant\n<think>",
78
+ "content": "We need to list five major rivers of Africa, one per line, with the country where each reaches the sea. So each line: River name",
79
+ "finish": "stop",
80
+ "tokens": 29
81
+ },
82
+ {
83
+ "name": "unicode",
84
+ "messages": [
85
+ {
86
+ "role": "user",
87
+ "content": "What do these emoji usually mean in a text message: 馃檹 馃敟 馃拃 ?"
88
+ }
89
+ ],
90
+ "prompt": "<|im_start|>user\nWhat do these emoji usually mean in a text message: 馃檹 馃敟 馃拃 ?<|im_end|>\n<|im_start|>assistant\n<think>",
91
+ "content": "The user asks: \"What do these emoji usually mean in a text message: 馃檹 馃敟 馃拃 ?\" They want an explanation of the meaning of these three emojis together. The user is asking for a general interpretation. This is not disallowed content. It's a request for meaning of emoj",
92
+ "finish": "stop",
93
+ "tokens": 64
94
+ },
95
+ {
96
+ "name": "haiku-autumn",
97
+ "messages": [
98
+ {
99
+ "role": "user",
100
+ "content": "Write a haiku about autumn leaves in a city."
101
+ }
102
+ ],
103
+ "prompt": "<|im_start|>user\nWrite a haiku about autumn leaves in a city.<|im_end|>\n<|im_start|>assistant\n<think>",
104
+ "content": "\nWe need to write a haiku about autumn leaves in a city. Haiku: 5-",
105
+ "finish": "stop",
106
+ "tokens": 21
107
+ },
108
+ {
109
+ "name": "system-pirate",
110
+ "messages": [
111
+ {
112
+ "role": "system",
113
+ "content": "Answer like a cheerful pirate, in two sentences."
114
+ },
115
+ {
116
+ "role": "user",
117
+ "content": "What is the boiling point of water at sea level?"
118
+ }
119
+ ],
120
+ "prompt": "<|im_start|>system\nAnswer like a cheerful pirate, in two sentences.<|im_end|>\n<|im_start|>user\nWhat is the boiling point of water at sea level?<|im_end|>\n<|im_start|>assistant\n<think>",
121
+ "content": "\nThe user is asking a straightforward factual question about the boiling point of water at sea level. This is basic science knowledge - water boils at 100 degrees Celsius (212 degrees Fahrenheit) at standard",
122
+ "finish": "stop",
123
+ "tokens": 41
124
+ }
125
+ ]
126
+ }
classic/refs/lfm2.5-24b-a2b-pi-merged.json ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "about": "llama.cpp fork build 11669 (620d2225c), Metal, -ngl 99: llama-server /completion on the /apply-template prompt, temperature 0, max_tokens 64, on LFM2.5-24B-A2B-pi-QAD-Q4_0-dense-Q8_0.gguf (sha256 f3348381f00f34ce582fb96051bb5bc366914cae8eaa207915b5a50ab8fc2a8c). Recorded 2026-10-31 by scripts/record-refs.mjs.",
3
+ "conversations": [
4
+ {
5
+ "name": "explain-tcp",
6
+ "messages": [
7
+ {
8
+ "role": "user",
9
+ "content": "Explain the difference between TCP and UDP to a new programmer."
10
+ }
11
+ ],
12
+ "prompt": "<|im_start|>user\nExplain the difference between TCP and UDP to a new programmer.<|im_end|>\n<|im_start|>assistant\n<think>",
13
+ "content": "\nWe need to explain TCP vs UDP to a new programmer. First person, specific. No \"as an AI\". Lead with substance. Keep it clear. Let me structure: start with a quick analogy or direct statement. Then contrast key points: connection vs connectionless, reliability, ordering, speed, use cases",
14
+ "finish": "stop",
15
+ "tokens": 64
16
+ },
17
+ {
18
+ "name": "json-extract",
19
+ "messages": [
20
+ {
21
+ "role": "user",
22
+ "content": "Extract the name, city and age from this sentence as JSON: \"Priya, 34, moved from Pune to Lisbon last year.\""
23
+ }
24
+ ],
25
+ "prompt": "<|im_start|>user\nExtract the name, city and age from this sentence as JSON: \"Priya, 34, moved from Pune to Lisbon last year.\"<|im_end|>\n<|im_start|>assistant\n<think>",
26
+ "content": "\nWe need to extract name, city, age from sentence: \"Priya, 34, moved from Pune to Lisbon last year.\" The sentence has name",
27
+ "finish": "stop",
28
+ "tokens": 35
29
+ },
30
+ {
31
+ "name": "translate-hi",
32
+ "messages": [
33
+ {
34
+ "role": "user",
35
+ "content": "Translate into Hindi: \"The library opens at nine and closes at six.\""
36
+ }
37
+ ],
38
+ "prompt": "<|im_start|>user\nTranslate into Hindi: \"The library opens at nine and closes at six.\"<|im_end|>\n<|im_start|>assistant\n<think>",
39
+ "content": "1. **Analyze the source sentence:** \"The library opens at nine and closes at six.\"\n * Subject: The library\n * Verb 1: opens\n * Time 1: at nine\n * Conjunction: and\n * Verb 2: closes",
40
+ "finish": "stop",
41
+ "tokens": 64
42
+ },
43
+ {
44
+ "name": "word-problem",
45
+ "messages": [
46
+ {
47
+ "role": "user",
48
+ "content": "A train leaves at 14:10 and arrives at 17:45. How long is the journey? Show the steps briefly."
49
+ }
50
+ ],
51
+ "prompt": "<|im_start|>user\nA train leaves at 14:10 and arrives at 17:45. How long is the journey? Show the steps briefly.<|im_end|>\n<|im_start|>assistant\n<think>",
52
+ "content": "\nWe need to answer: A train leaves at 14:10 and arrives at 17:45. How long is the journey? Show steps briefly.\n\nWe need to compute difference between 14:10 and 17:45.\n\nFrom 14:10 to 17:10 is 3 hours. Then",
53
+ "finish": "stop",
54
+ "tokens": 64
55
+ },
56
+ {
57
+ "name": "sql",
58
+ "messages": [
59
+ {
60
+ "role": "user",
61
+ "content": "Write a SQL query that returns the five customers with the highest total order value from tables customers(id, name) and orders(id, customer_id, amount)."
62
+ }
63
+ ],
64
+ "prompt": "<|im_start|>user\nWrite a SQL query that returns the five customers with the highest total order value from tables customers(id, name) and orders(id, customer_id, amount).<|im_end|>\n<|im_start|>assistant\n<think>",
65
+ "content": "We need to produce a SQL query that returns the top 5 customers with highest total order value. The schema: customers(id, name) and orders(id, customer_id, amount). So we need to join customers with orders, group by customer, sum(amount) as total_order_value, order descending, limit ",
66
+ "finish": "stop",
67
+ "tokens": 64
68
+ },
69
+ {
70
+ "name": "list-rivers",
71
+ "messages": [
72
+ {
73
+ "role": "user",
74
+ "content": "List five major rivers of Africa, one per line, with the country where each reaches the sea."
75
+ }
76
+ ],
77
+ "prompt": "<|im_start|>user\nList five major rivers of Africa, one per line, with the country where each reaches the sea.<|im_end|>\n<|im_start|>assistant\n<think>",
78
+ "content": "We need to list five major rivers of Africa, one per line, with the country where each reaches the sea. So each line: River name",
79
+ "finish": "stop",
80
+ "tokens": 29
81
+ },
82
+ {
83
+ "name": "unicode",
84
+ "messages": [
85
+ {
86
+ "role": "user",
87
+ "content": "What do these emoji usually mean in a text message: 馃檹 馃敟 馃拃 ?"
88
+ }
89
+ ],
90
+ "prompt": "<|im_start|>user\nWhat do these emoji usually mean in a text message: 馃檹 馃敟 馃拃 ?<|im_end|>\n<|im_start|>assistant\n<think>",
91
+ "content": "The user asks: \"What do these emoji usually mean in a text message: 馃檹 馃敟 馃拃 ?\" They want an explanation of the meaning of these three emojis in a text message context. The user is asking for a general interpretation. There's no disallowed content. It's a straightforward question",
92
+ "finish": "stop",
93
+ "tokens": 64
94
+ },
95
+ {
96
+ "name": "haiku-autumn",
97
+ "messages": [
98
+ {
99
+ "role": "user",
100
+ "content": "Write a haiku about autumn leaves in a city."
101
+ }
102
+ ],
103
+ "prompt": "<|im_start|>user\nWrite a haiku about autumn leaves in a city.<|im_end|>\n<|im_start|>assistant\n<think>",
104
+ "content": "\nWe need to write a haiku about autumn leaves in a city. Haiku: 5-",
105
+ "finish": "stop",
106
+ "tokens": 21
107
+ },
108
+ {
109
+ "name": "system-pirate",
110
+ "messages": [
111
+ {
112
+ "role": "system",
113
+ "content": "Answer like a cheerful pirate, in two sentences."
114
+ },
115
+ {
116
+ "role": "user",
117
+ "content": "What is the boiling point of water at sea level?"
118
+ }
119
+ ],
120
+ "prompt": "<|im_start|>system\nAnswer like a cheerful pirate, in two sentences.<|im_end|>\n<|im_start|>user\nWhat is the boiling point of water at sea level?<|im_end|>\n<|im_start|>assistant\n<think>",
121
+ "content": "\nThe user is asking a straightforward factual question about the boiling point of water at sea level. This is basic science knowledge - water boils at 100 degrees Celsius (212 degrees Fahrenheit) at standard",
122
+ "finish": "stop",
123
+ "tokens": 41
124
+ }
125
+ ]
126
+ }
ggml/dist/BUILD.md CHANGED
@@ -12,7 +12,7 @@ post-build step):
12
 
13
  sha256 (check a copy with `shasum -a 256`):
14
 
15
- 9c532bdddb66821d7be2dff2d2008f9a976ca7b497574fa2f1520b4f9ab9ff58 df-chat.wasm
16
- 0f8a1a7e3eb75ef8f999d553d2fc1a124c4de1b6c6edb597643486752bcdce08 df-chat.mjs
17
 
18
  Update the fork commit and the checksums whenever the build changes.
 
12
 
13
  sha256 (check a copy with `shasum -a 256`):
14
 
15
+ 4c4c2ac6e8a6dec6f30687b5ccaf20b1392e552580d69ba8bd87366c0b8dc9f1 df-chat.wasm
16
+ 30f14aa3c1b561476f9ad80137807712f84a0ad7f9cd7c1f292a317871091016 df-chat.mjs
17
 
18
  Update the fork commit and the checksums whenever the build changes.
ggml/dist/df-chat.mjs CHANGED
The diff for this file is too large to render. See raw diff
 
ggml/dist/df-chat.wasm CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9c532bdddb66821d7be2dff2d2008f9a976ca7b497574fa2f1520b4f9ab9ff58
3
- size 7278894
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c4c2ac6e8a6dec6f30687b5ccaf20b1392e552580d69ba8bd87366c0b8dc9f1
3
+ size 7294671
ggml/worker.mjs CHANGED
@@ -3,7 +3,7 @@
3
  // sync access handles, straight into the wasm heap. A GGUF gets into OPFS by download (resumable, from a URL) or by
4
  // copying a picked file; with opfs: false a picked File is read in place instead (slower).
5
  //
6
- // Messages in: load {opfsName | file, budget | slots, ctx, env, draft, extra} 路 chat {messages, n, thinking} 路 complete {prompt, n} (the gate)
7
  // 路 abort 路 download {url, name, size} 路 list 路 remove {name}
8
  // Messages out: log 路 progress 路 plan 路 loaded 路 piece 路 done 路 downloaded 路 models 路 removed 路 error
9
  import createModule from './dist/df-chat.mjs'; // built from ggml/build-wasm, see ggml/dist/BUILD.md
@@ -195,6 +195,9 @@ onmessage = async ({ data }) => {
195
  // draft: a drafter GGUF in OPFS (DFlash, DSpark, MTP...) for speculative decoding; read whole at load, not paged
196
  const draftFile = data.draft ? await (await ggufDir(false)).getFileHandle(data.draft).then((h) => h.getFile())
197
  .catch(() => { throw new Error(`${data.draft} is not in OPFS; download the drafter first`); }) : null;
 
 
 
198
  // extra: side files the model opens by name beside the GGUF (DeepSeek-V4.1's Engram tables), from OPFS
199
  const extraFiles = [];
200
  for (const name of data.extra || []) {
@@ -202,8 +205,9 @@ onmessage = async ({ data }) => {
202
  .catch(() => { throw new Error(`${name} is not in OPFS; download it first`); }));
203
  }
204
  mod.FS.mkdir('/m');
205
- mod.FS.mount(mod.WORKERFS, { files: [...files, ...(draftFile ? [draftFile] : []), ...extraFiles] }, '/m');
206
  if (draftFile) mod._df_set_draft(str('/m/' + draftFile.name));
 
207
  const t0 = performance.now();
208
  // a GPU budget (bytes) becomes slots through df_plan; else data.slots as given
209
  let slots = data.slots, plan = null;
@@ -214,7 +218,7 @@ onmessage = async ({ data }) => {
214
  slots = plan.slots;
215
  }
216
  const rc = await mod._df_load(str('/m/' + file.name), slots, data.ctx ?? 1024);
217
- post('loaded', { rc, slots, plan, size: files.reduce((a, f) => a + f.size, 0), name: file.name, parts: files.length, draft: draftFile ? draftFile.name : null, ms: Math.round(performance.now() - t0) });
218
  } else if (data.type === 'complete') {
219
  const reply = await mod._df_complete(str(data.prompt), data.n ?? 64);
220
  post('done', { id: data.id, text: text(reply), stats: JSON.parse(text(mod._df_stats())) });
 
3
  // sync access handles, straight into the wasm heap. A GGUF gets into OPFS by download (resumable, from a URL) or by
4
  // copying a picked file; with opfs: false a picked File is read in place instead (slower).
5
  //
6
+ // Messages in: load {opfsName | file, budget | slots, ctx, env, draft, lora, loraScale, extra} 路 chat {messages, n, thinking} 路 complete {prompt, n} (the gate)
7
  // 路 abort 路 download {url, name, size} 路 list 路 remove {name}
8
  // Messages out: log 路 progress 路 plan 路 loaded 路 piece 路 done 路 downloaded 路 models 路 removed 路 error
9
  import createModule from './dist/df-chat.mjs'; // built from ggml/build-wasm, see ggml/dist/BUILD.md
 
195
  // draft: a drafter GGUF in OPFS (DFlash, DSpark, MTP...) for speculative decoding; read whole at load, not paged
196
  const draftFile = data.draft ? await (await ggufDir(false)).getFileHandle(data.draft).then((h) => h.getFile())
197
  .catch(() => { throw new Error(`${data.draft} is not in OPFS; download the drafter first`); }) : null;
198
+ // lora: a LoRA adapter GGUF in OPFS, applied at loraScale (default 1) as llama-server --lora does
199
+ const loraFile = data.lora ? await (await ggufDir(false)).getFileHandle(data.lora).then((h) => h.getFile())
200
+ .catch(() => { throw new Error(`${data.lora} is not in OPFS; download the adapter first`); }) : null;
201
  // extra: side files the model opens by name beside the GGUF (DeepSeek-V4.1's Engram tables), from OPFS
202
  const extraFiles = [];
203
  for (const name of data.extra || []) {
 
205
  .catch(() => { throw new Error(`${name} is not in OPFS; download it first`); }));
206
  }
207
  mod.FS.mkdir('/m');
208
+ mod.FS.mount(mod.WORKERFS, { files: [...files, ...(draftFile ? [draftFile] : []), ...(loraFile ? [loraFile] : []), ...extraFiles] }, '/m');
209
  if (draftFile) mod._df_set_draft(str('/m/' + draftFile.name));
210
+ if (loraFile) mod._df_set_lora(str('/m/' + loraFile.name), data.loraScale ?? 1);
211
  const t0 = performance.now();
212
  // a GPU budget (bytes) becomes slots through df_plan; else data.slots as given
213
  let slots = data.slots, plan = null;
 
218
  slots = plan.slots;
219
  }
220
  const rc = await mod._df_load(str('/m/' + file.name), slots, data.ctx ?? 1024);
221
+ post('loaded', { rc, slots, plan, size: files.reduce((a, f) => a + f.size, 0), name: file.name, parts: files.length, draft: draftFile ? draftFile.name : null, lora: loraFile ? loraFile.name : null, ms: Math.round(performance.now() - t0) });
222
  } else if (data.type === 'complete') {
223
  const reply = await mod._df_complete(str(data.prompt), data.n ?? 64);
224
  post('done', { id: data.id, text: text(reply), stats: JSON.parse(text(mod._df_stats())) });