Run this model with HF Jobs

Run NoMusic/LSLM-beta on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/NoMusic/LSLM-beta. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/NoMusic/LSLM-beta on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/NoMusic/LSLM-beta. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/NoMusic/LSLM-beta. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
File size: 4,282 Bytes
50b9d55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269e6ab
 
 
 
 
 
 
 
 
 
50b9d55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
license: apache-2.0
language:
- en
base_model: ibm-granite/granite-4.2-3b
library_name: peft
pipeline_tag: text-generation
tags:
- lslm
- lora
- gguf
- llama.cpp
- retrieval
- rag
- tool-calling
- granite
---

# LSLM beta — Logical Small Language Model (LoRA adapter for Granite 4.2 3B)

**LSLM is a logical small language model: it reasons and talks, but looks facts up in swappable
on-disk knowledge packs instead of memorizing them.**

This repository holds the **LSLM beta** adapter. It turns IBM Granite 4.2 3B into the LSLM assistant
used by the [LSLM app](https://github.com/andrewtab4-commits/LSLM) (code, installer and knowledge packs). LSLM's own model, trained from scratch for
language and logic rather than for memorizing facts, is **in development** and will replace Granite;
the app and the knowledge packs stay the same.

## Roadmap

| Version | Model | State |
|---|---|---|
| **LSLM beta** (this repository) | IBM Granite 4.2 3B + LSLM adapter | works now |
| **LSLM 1** | LSLM's own model, ~250M parameters, trained from scratch to read, reason and answer from the text it is given, not to memorize facts | in development |
| **LSLM 2** | own model, ~500M parameters | next |
| **LSLM 3** | own model, ~1B parameters | later: needs far more compute, so it will depend on funding and donations |
| **LSLM 4** | own model, ~3B parameters, many languages | the long-term goal |

## What the adapter teaches

* **Search first.** Questions that need facts go to the `search_knowledge` tool, which searches the enabled packs.
* **Answer only from the passages,** even when they disagree with what the base model "remembers".
* **Cite every fact** with `[n]`, pointing to the passage it came from.
* **Say so when the packs have nothing,** instead of guessing.
* **Answer in clear English,** whatever language the question is in.
* Search again with other keywords when the first results are not enough; handle follow-up questions,
  small talk and simple tasks (summarising, rewriting) without searching.

## Results

150 held-out conversations (not used in training), base Granite vs Granite + LSLM adapter,
same prompts and tools (llama.cpp, Q4_K_M):

| Kind | n | Base | LSLM beta |
|---|---|---|---|
| Facts from the pack | 75 | 80% | **95%** |
| Pack contradicts the model's memory | 17 | 71% | **88%** |
| Needs a second search | 10 | 0% | **60%** |
| Tasks (summarise, rewrite, small maths) | 14 | 36% | **93%** |
| Overview of a topic | 2 | 0% | **100%** |
| Question in another language → answer in English | 9 | 89% | **100%** |
| Follow-up questions | 4 | 100% | 100% |
| Small talk | 5 | 100% | 100% |
| "Not in the packs" | 14 | 100% | 93% |
| **All** | **150** | **72%** | **92%** |

With the adapter, every factual answer carries a citation (base: 95%), and the model stops describing its search.
Known weak spots: multi-digit arithmetic (a calculator tool is planned) and requests for general advice
that the packs do not cover.

## Files

| File | For |
|---|---|
| `lslm-lora-v1.gguf` | llama.cpp (`llama-server -m granite-4.2-3b-Q4_K_M.gguf --lora lslm-lora-v1.gguf`); downloaded by the [LSLM installer](https://github.com/andrewtab4-commits/LSLM) |
| `adapter_model.safetensors`, `adapter_config.json` | PEFT / transformers, on top of `ibm-granite/granite-4.2-3b` |

The base model in GGUF form: [ibm-granite/granite-4.2-3b-GGUF](https://huggingface.co/ibm-granite/granite-4.2-3b-GGUF)
(`granite-4.2-3b-Q4_K_M.gguf`).

## Training

* LoRA rank 16, alpha 32, dropout 0.05, on all attention and MLP projections
  (`q/k/v/o_proj`, `gate/up/down_proj`).
* 1,800 generated conversations with real tool calls and search results from the Simple English Wikipedia pack:
  facts, counterfactual (edited) passages, unanswerable questions, second searches, follow-ups,
  overviews, tasks, small talk and non-English questions.
* Loss only on the tokens the model must write; 1 epoch, 224 steps, effective batch 8, lr 1e-4 (cosine),
  sequences up to 3,072 tokens, bf16.
* Trained on a MacBook Air M4 (16 GB) with PyTorch on Apple Silicon, about 11 hours.
* Held-out eval loss: 1.07 → 0.039.

## Licence

The adapter is released under Apache 2.0, like Granite 4.2 3B (© IBM).
The training conversations quote Simple English Wikipedia (CC BY-SA 4.0).