@qvac/llm-llamacpp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,416 @@
1
+ # qvac-lib-infer-llamacpp-llm
2
+
3
+ This library simplifies running Large Language Models (LLMs) within QVAC runtime applications. It provides an easy interface to load, execute, and manage LLM instances, supporting multiple data sources (called data loaders).
4
+
5
+ ## Table of Contents
6
+
7
+ - [Installation](#installation)
8
+ - [Building from Source](#building-from-source)
9
+ - [Usage](#usage)
10
+ - [1. Import the Model Class](#1-import-the-model-class)
11
+ - [2. Create a Data Loader](#2-create-a-data-loader)
12
+ - [3. Create the `args` obj](#3-create-the-args-obj)
13
+ - [4. Create the `config` obj](#4-create-the-config-obj)
14
+ - [5. Create Model Instance](#5-create-model-instance)
15
+ - [6. Load Model](#6-load-model)
16
+ - [7. Run Inference](#7-run-inference)
17
+ - [8. Release Resources](#8-release-resources)
18
+ - [Quickstart Example](#quickstart-example)
19
+ - [Model Registry](#model-registry)
20
+ - [Other Examples](#other-examples)
21
+ - [Benchmarking](#benchmarking)
22
+ - [Tests](#tests)
23
+ - [Glossary](#glossary)
24
+ - [Resources](#resources)
25
+ - [License](#license)
26
+
27
+ ## Installation
28
+
29
+ ### Prerequisites
30
+
31
+ Install [Bare](#glossary) Runtime:
32
+ ```bash
33
+ npm install -g bare-runtime
34
+ ```
35
+ Note : Make sure the Bare version is `>= 1.17.3`. Check this using :
36
+
37
+ ```bash
38
+ bare -v
39
+ ```
40
+
41
+ Before proceeding with the installation, please generate a **classic GitHub Personal Access Token (PAT)** with the `read:packages` scope. Once generated, add the token to your environment variables using the name `NPM_TOKEN`.
42
+
43
+ ```bash
44
+ export NPM_TOKEN=your_personal_access_token
45
+ ```
46
+
47
+ Next, create a `.npmrc` file in the root of your project with the following content:
48
+
49
+ ```ini
50
+ @tetherto:registry=https://npm.pkg.github.com
51
+ //npm.pkg.github.com/:_authToken=${NPM_TOKEN}
52
+ ```
53
+
54
+ This configuration ensures secure access to GitHub Packages when installing scoped packages.
55
+
56
+ ### Installing the Package
57
+
58
+ Check the [Model registry](#model-registry) for the list of supported models.
59
+
60
+ Install the desired Llama model package (adjust name for model/quantization):
61
+ ```bash
62
+ npm install @tetherto/llm-llamacpp@latest
63
+ ```
64
+ Or install a specific known stable version:
65
+ ```bash
66
+ npm install @tetherto/llm-llamacpp@0.0.1-dev
67
+ ```
68
+
69
+ ## Building from Source
70
+
71
+ See [build.md](./build.md) for detailed instructions on how to build the addon from source.
72
+
73
+ ## Usage
74
+
75
+ ### 1. Import the Model Class
76
+
77
+ ```js
78
+ const LlmLlamacpp = require('@tetherto/llm-llamacpp')
79
+ ```
80
+
81
+ ### 2. Create a Data Loader
82
+
83
+ Data Loaders abstract the way model files are accessed. It is recommended to utilize a [`HyperdriveDataLoader`](https://github.com/tetherto/qvac-lib-dl-hyperdrive) to stream the model file(s) from a `hyperdrive`. Optionally, you could use a [`FileSystemDataLoader`](https://github.com/tetherto/qvac-lib-dl-filesystem) to stream the model file(s) from your local file system.
84
+
85
+ ```js
86
+ const store = new Corestore('./store')
87
+ const hdStore = store.namespace('hd')
88
+
89
+ const hdDL = new HyperDriveDL({
90
+ key: 'hd://b11388de0e9214d8c2181eae30e31bcd49c48b26d621b353ddc7f01972dddd76',
91
+ store: hdStore
92
+ })
93
+ ```
94
+
95
+ ### 3. Create the `args` obj
96
+
97
+ ```js
98
+ const args = {
99
+ loader: hdDL,
100
+ opts: { stats: true },
101
+ logger: console,
102
+ // saveWeightsToDisk: true, this is the default usage until we implement load method in addon.
103
+ diskPath: './models/',
104
+ modelName: 'medgemma-4b-it-Q4_1.gguf'
105
+ }
106
+ ```
107
+
108
+ The `args` obj contains the following properties:
109
+
110
+ * `loader`: The Data Loader instance from which the model file will be streamed.
111
+ * `logger`: This property is used to create a [`QvacLogger`](https://github.com/tetherto/qvac-lib-logging) instance, which handles all logging functionality.
112
+ * `opts.stats`: This flag determines whether to calculate inference stats.
113
+ * `diskPath`: The local directory where the model file will be downloaded to.
114
+ * `modelName`: The name of model file in the Data Loader.
115
+
116
+ ### 4. Create the `config` obj
117
+
118
+ The `config` obj consists of a set of hyper-parameters which can be used to tweak the behaviour of the model.
119
+
120
+ ```js
121
+ // an example of possible configuration
122
+ const config = {
123
+ gpu_layers: '99', // number of model layers offloaded to GPU.
124
+ ctx_size: '1024' // context length
125
+ }
126
+ ```
127
+
128
+ | Parameter | Range / Type | Default |
129
+ |----------------|------------------------------------------------|------------------------------------------------------------|
130
+ | temp | 0.00 – 2.00 | 0.8 |
131
+ | top_p | 0 – 1 | 0.9 |
132
+ | top_k | 0 – 128 | 40 |
133
+ | predict | 1 – Infinity<br>(-1 = Infinity, -2 = until context filled) | -1 |
134
+ | ctx_size | 0 – model-dependent | 4096 (0 = loaded from model) |
135
+ | system_prompt | string | "You are a helpful, respectful and honest assistant." |
136
+ | seed | integer | -1 = random |
137
+ | lora | string | Path to gguf adapter |
138
+ | gpu_layers | integer | 0 |
139
+ | no_mmap | bool | "" - to disable |
140
+ | device | string | |
141
+
142
+
143
+ ### 5. Create Model Instance
144
+
145
+ ```js
146
+ const model = new LlmLlamacpp(args, config)
147
+ ```
148
+
149
+ ### 6. Load Model
150
+
151
+ ```js
152
+ await model.load()
153
+ ```
154
+
155
+ _Optionally_ you can pass the following parameters to tweak the loading behaviour.
156
+ * `close?`: This boolean value determines whether to close the Data Loader after loading. Defaults to `true`
157
+ * `reportProgressCallback?`: A callback function which gets called periodically with progress updates. It can be used to display overall progress percentage.
158
+
159
+ _For example:_
160
+
161
+ ```js
162
+ await model.load(false, progress => process.stdout.write(`\rOverall Progress: ${progress.overallProgress}%`))
163
+ ```
164
+
165
+ **Progress Callback Data**
166
+
167
+ The progress callback receives an object with the following properties:
168
+
169
+ | Property | Type | Description |
170
+ |---------------------|--------|-----------------------------------------|
171
+ | `action` | string | Current operation being performed |
172
+ | `totalSize` | number | Total bytes to be loaded |
173
+ | `totalFiles` | number | Total number of files to process |
174
+ | `filesProcessed` | number | Number of files completed so far |
175
+ | `currentFile` | string | Name of file currently being processed |
176
+ | `currentFileProgress` | string | Percentage progress on current file |
177
+ | `overallProgress` | string | Overall loading progress percentage |
178
+
179
+ ### 7. Run Inference
180
+
181
+ Pass an array of messages (following the chat completion format) to the `run` method. Process the generated tokens asynchronously:
182
+
183
+ ```javascript
184
+ try {
185
+ const messages = [
186
+ { role: 'system', content: 'You are a helpful assistant.' },
187
+ { role: 'user', content: 'What is the capital of France?' }
188
+ ]
189
+
190
+ const response = await model.run(messages)
191
+ const buffer = []
192
+
193
+ // Option 1: Process streamed output using async iterator
194
+ for await (const token of response.iterate()) {
195
+ process.stdout.write(token) // Write token directly to output
196
+ buffer.push(token)
197
+ }
198
+
199
+ // Option 2: Process streamed output using callback
200
+ await response.onUpdate(token => { /* ... */ }).await()
201
+
202
+ console.log('\n--- Full Response ---\n', buffer.join(''))
203
+
204
+ } catch (error) {
205
+ console.error('Inference failed:', error)
206
+ }
207
+ ```
208
+
209
+ ### 8. Release Resources
210
+
211
+ Unload the model when finished:
212
+
213
+ ```javascript
214
+ try {
215
+ await model.unload()
216
+ // Close P2P resources if applicable
217
+ } catch (error) {
218
+ console.error('Failed to unload model:', error)
219
+ }
220
+ ```
221
+
222
+ ## Quickstart Example
223
+
224
+ Follow these simple steps to run the Quickstart demo using the Hyperdrive loader:
225
+
226
+ ### 0. Install Bare
227
+
228
+ ```bash
229
+ npm install -g bare
230
+ ```
231
+
232
+ ### 1. Create a new Project
233
+
234
+ ```bash
235
+ mkdir qvac-llm-quickstart
236
+ cd qvac-llm-quickstart
237
+ npm init -y
238
+ ```
239
+
240
+ ### 2. Install Dependencies
241
+
242
+ ```bash
243
+ npm install corestore @tetherto/qvac-lib-dl-hyperdrive @tetherto/llm-llamacpp bare-process
244
+ ```
245
+
246
+ ### 3. Copy Quickstart code into `index.js`
247
+ ```js
248
+ 'use strict'
249
+
250
+ const Corestore = require('corestore')
251
+ const HyperDriveDL = require('@tetherto/qvac-lib-dl-hyperdrive')
252
+
253
+ // 1. Import the LlmLlamacpp class
254
+ const LlmLlamacpp = require('@tetherto/llm-llamacpp')
255
+
256
+ const process = require('bare-process')
257
+
258
+ async function main () {
259
+ const store = new Corestore('./store')
260
+
261
+ // 2. Create a Hyperdrive Data Loader
262
+ const hdDL = new HyperDriveDL({
263
+ key: 'hd://b11388de0e9214d8c2181eae30e31bcd49c48b26d621b353ddc7f01972dddd76',
264
+ store
265
+ })
266
+
267
+ // 3. Configure the `args` object
268
+ const args = {
269
+ loader: hdDL,
270
+ opts: { stats: true },
271
+ logger: console,
272
+ // saveWeightsToDisk: true, this is the default usage until we implement load method in addon.
273
+ diskPath: './models/',
274
+ modelName: 'medgemma-4b-it-Q4_1.gguf'
275
+ }
276
+
277
+ // 4. Create the `config` object
278
+ // an example of possible configuration
279
+ const config = {
280
+ gpu_layers: '99', // number of model layers offloaded to GPU.
281
+ ctx_size: '1024', // context length
282
+ device: 'gpu' // must be specified: 'gpu' or 'cpu'
283
+ }
284
+
285
+ // 5. Create Model instance
286
+ const model = new LlmLlamacpp(args, config)
287
+
288
+ // 6. Load Model
289
+ await model.load()
290
+
291
+ try {
292
+ const prompt = [
293
+ {
294
+ role: 'system',
295
+ content: 'You are a helpful, respectful and honest assistant.'
296
+ },
297
+ {
298
+ role: 'user',
299
+ content: 'what is bitcoin?'
300
+ },
301
+ {
302
+ role: 'assistant',
303
+ content: "It's a digital currency."
304
+ },
305
+ {
306
+ role: 'user',
307
+ content: 'Can you elaborate on the previous topic?'
308
+ }
309
+ ]
310
+
311
+ // 7. Run Inference
312
+ const response = await model.run(prompt)
313
+ const buffer = []
314
+
315
+ await response
316
+ .onUpdate(data => {
317
+ process.stdout.write(data)
318
+ buffer.push(data)
319
+ })
320
+ .await()
321
+
322
+ console.log('\n')
323
+ console.log('Full response:\n', buffer.join(''))
324
+ console.log(`Inference stats: ${JSON.stringify(response.stats)}`)
325
+ } finally {
326
+ // 8. Release Resources
327
+ await model.unload()
328
+ await store.close()
329
+ console.log('SCRIPT_SUCCESSFUL')
330
+ process.kill(process.pid)
331
+ }
332
+ }
333
+
334
+ main().catch(error => {
335
+ console.error('Fatal error in main function:', {
336
+ error: error.message,
337
+ stack: error.stack,
338
+ timestamp: new Date().toISOString()
339
+ })
340
+ process.exit(1)
341
+ })
342
+ ```
343
+
344
+ ### 4. Run `index.js`
345
+
346
+ ```bash
347
+ bare index.js
348
+ ```
349
+
350
+
351
+ ## Model registry
352
+
353
+ In the QVAC ecosystem, a model registry is simply a Hyperbee that stores Hyperdrive keys as its values. Each of these keys points to a Hyperdrive containing the `.gguf` files for a specific model. The Hyperbee key for the model registry is `7504626aaa534ac55d91b4b3067504774ae1457b03ddfbd86d817dd8cfbca8c8`.
354
+
355
+ | Key (The key inside the hyperbee) | Value (Hyperdrive Key) | `.gguf` File Name |
356
+ | ---------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------ |
357
+ | generation\:salamandrata\:instruct::2B\:q4:1.0.0 | 1610d81772a9e7c37660666dbdfdcef915b6b83c522ea1ad31c19cab0075811d | salamandrata\_2b\_inst\_q4.gguf |
358
+ | generation\:salamandrata\:instruct::2B\:q8:1.0.0 | 96860337b0bdffdbb8ef0df4c8b2c3ab5e78568f5f7e15815a0a6b392512c9b5 | salamandrata\_2b\_inst\_q8.gguf |
359
+ | generation\:qwen2.5-omni\:multimodal::3B::1.0.0 | e65db178dfa6d027a91b4d263c30f7596e742cd7ea5c7f1ba91584113c3a47f1 | mmproj-Qwen2.5-Omni-3B-Q8\_0.gguf<br>Qwen2.5-Omni-3B-Q4\_K\_M.gguf |
360
+ | generation\:qwen3\:instruct::4B\:q4:1.0.0 | 19ffb75463149955ee24d786dfddd84d41fc872ea813cd4465f5f7299d165adc | model.gguf |
361
+ | generation\:qwen3\:instruct::0.6B::1.0.0 | d331ed49c444f90b3b2a70aa5b820752685142bf2d769a0592ed666140477578 | Qwen3-0.6B-UD-IQ1\_S.gguf |
362
+ | generation\:medgemma\:it::4B\:q4\_1:1.0.0 | b11388de0e9214d8c2181eae30e31bcd49c48b26d621b353ddc7f01972dddd76 | medgemma-4b-it-Q4\_1.gguf<br>medgemma-4b-it-Q8\_0.gguf |
363
+ | generation\:llama-ggml\:instruct:3.2:1B\:q4\_0:1.0.0 | afa79ee07c0a138bb9f11bfaee771fb1bdfca8c82d961cff0474e49827bd1de3 | Llama-3.2-1B-Instruct-Q4\_0.gguf |
364
+
365
+
366
+ ## Other examples
367
+
368
+ - [Filesystem Data Loader](examples/example.fs.js) – Demonstrates using the Filesystem loader.
369
+ - [Hyperdrive Data Loader](examples/example.hd.js) – Demonstrates using the Hyperdrive loader with Hyperbee lookup (similar to Quickstart).
370
+
371
+ ## Benchmarking
372
+
373
+ We maintain a comprehensive benchmarking suite for evaluating the performance of our LLM-based addons across a diverse range of reasoning, comprehension, and knowledge tasks. This benchmarking helps compare model quality, efficiency, and behavior across variants and configurations.
374
+
375
+ ### Benchmark Results
376
+
377
+ For detailed benchmark results covering all LLM addons, see our [LLM Benchmark Results Summary](./benchmarks/client/benchmarking_results/results.md).
378
+
379
+ The benchmarking covers:
380
+
381
+ * **Evaluation Datasets & Metrics**:
382
+
383
+ * **SQuAD EM / F1**: Measures reading comprehension and answer accuracy
384
+ * **ARC Accuracy**: Assesses scientific reasoning via multiple-choice questions
385
+ * **MMLU Accuracy**: Gauges subject matter understanding across 57 domains
386
+ * **GSM8K (0-shot) Accuracy**: Evaluates math reasoning without demonstrations
387
+
388
+ * **Model Variants**:
389
+
390
+ * Covers multiple LLM sizes (1B, 3B) and quantization types
391
+ * Includes both base and instruction-tuned models
392
+
393
+ Benchmark results are periodically updated with each new model release to ensure transparency and continued performance tracking.
394
+
395
+ ## Tests
396
+
397
+ [Bert Addon Test](test/addon_bert.test.js) showcases how to generate embeddings from text using a GTE large model, which can be useful for retrieval-augmented llama generation. Make sure to pass `-D BUILD_BERT_MODEL=ON` when calling `bare-make generate`, otherwise only the llama model will exist on the addon.
398
+
399
+ ## Glossary
400
+
401
+ • **Bare** – Small and modular JavaScript runtime for desktop and mobile. [Learn more](https://docs.pears.com/bare-reference/overview).
402
+ • **QVAC** – QVAC is our open-source AI-SDK for building decentralized AI applications.
403
+ • **Hyperdrive** – Hyperdrive is a secure, real-time distributed file system designed for easy P2P file sharing. [Learn more](https://docs.pears.com/building-blocks/hyperdrive).
404
+ • **Hyperbee** – A decentralized B-tree built on top of Hypercores, and exposes a key-value API to store values. [Learn more](https://docs.pears.com/building-blocks/hyperbee).
405
+ • **Corestore** – Corestore is a Hypercore factory that makes it easier to manage large collections of named Hypercores. [Learn more](https://docs.pears.com/helpers/corestore).
406
+
407
+ ## Resources
408
+
409
+ * PoC Repo: [tetherto/qvac-llm-poc](https://github.com/tetherto/qvac-llm-poc)
410
+ * Pear app (Desktop): TBD
411
+
412
+ ## License
413
+
414
+ This project is licensed under the Apache-2.0 [License](./LICENSE) – see the LICENSE file for details.
415
+
416
+ _For questions or issues, please open an issue on the GitHub repository._