À propos
LSLM — Logical Small Language Model: reasons and talks, looks facts up in swappable on-disk knowledge packs and cites them. Runs locally on macOS, Windows and Linux.
IA et apprentissage automatiqueProgression mesurée des étoiles
- in 24h
- Historique en cours
- in 7 days
- Historique en cours
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalLSLM — Logical Small Language Model

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. Runs locally on macOS, Windows and Linux.
Most language models try to store the whole world in their weights. LSLM does the opposite. The model stays small and does only what a model is good at: understanding the question, reasoning about it, and answering in clear English.
Facts live outside the model, in knowledge packs: ordinary folders on your disk that you can add, swap or combine. Wikipedia today; a medical handbook, a survival guide or your own notes tomorrow.
When a question needs a fact, LSLM searches the enabled packs, reads what it found and answers from it, citing a source for every claim. If the packs don't have the answer, it says so instead of guessing. Change the pack and the answers change with it: the model trusts the pack, not its memory.
Why
- Knowledge you control. Update, check or replace it without retraining the model.
- Honest answers. Every fact leads back to a source. No source, no claim.
- Small and local. Runs offline on an ordinary laptop. Packs are searched on disk, so even large ones barely use memory (the whole app needs about 3 GB of RAM).
Status and roadmap
| Version | Model | State |
|---|---|---|
| LSLM beta (this release) | IBM Granite 4.2 3B (Apache 2.0), fine-tuned with the LSLM adapter (NoMusic/LSLM-beta) | 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 |
The adapter teaches Granite the LSLM rules: search first, answer only from the passages, cite every fact, say plainly when the packs have nothing, always answer in English. On 150 held-out test questions it raised correct answers from 72% to 92%. LSLM's own model will replace Granite; the app and the knowledge packs stay the same.
Install
You need git and about 4 GB of free space.
macOS / Linux:
git clone https://github.com/andrewtab4-commits/LSLM.git
cd LSLM
./install.sh
Windows: git clone https://github.com/andrewtab4-commits/LSLM.git, then double-click install.bat in the LSLM folder.
The installer asks before each download and shows its size: uv (sets up Python),
llama.cpp (runs the model), the model (~2.1 GB), the LSLM adapter and the Simple English Wikipedia pack
(built on your computer from the Wikipedia dump). Then it puts an LSLM icon on your desktop.
If it stops (no internet, Ctrl+C), run it again: it continues where it left off.
--yes answers every question, --cpu installs llama.cpp without GPU support.
How it works
question ──► model ──► search_knowledge("keywords") ──► packs (SQLite full-text, on disk)
▲ │
└──────────── numbered passages ◄──────────────┘
model ──► answer with [1][2] citations ──► web page (sources open the passage and the article)
app/packs.py— pack format and search (SQLite FTS5/BM25, plus a boost for articles named in the question). A pack is read from disk on demand, so its size barely affects RAM.app/agent.py— the loop: tool call → search → passages → answer. Rules for the model are inSYSTEM.app/llm.py— startsllama-serverand talks to its OpenAI-style API (streaming, tool calls).app/server.py,app/web/index.html— the local web app (Python standard library only).run.py— starts everything. Settings:config.json(optional, seeconfig.example.json).scripts/build_wiki_pack.py— turns a Wikipedia dump into a pack.scripts/download_model.py,scripts/probe_lora.py— base model download and a LoRA fine-tuning check.
Run
uv sync
uv run python run.py
Opens http://127.0.0.1:8765. Needs models/granite-4.2-3b-Q4_K_M.gguf, a llama-server binary
(in tools/llama.cpp/bin/… or on PATH) and at least one pack in packs/.
Desktop icon (macOS, Windows, Linux):
uv run python scripts/install_shortcut.py # --remove takes it away
Clicking the icon starts LSLM and opens it in the browser; clicking again only reopens the page.
The page's Quit LSLM button stops it (on macOS, quitting LSLM from the Dock does too).
Run the script again if you move the LSLM folder. Icons are built from assets/icon-drawing.jpg
by scripts/make_icons.py (macOS only; the results are kept in assets/).
Knowledge packs
packs/<id>/pack.json name, licence, source, counts
packs/<id>/pack.sqlite docs, chunks, redirects, full-text index
Build the Simple English Wikipedia pack (dump ≈ 390 MB, pack ≈ 640 MB, ~2 minutes):
curl -L -o data_raw/simplewiki.xml.bz2 https://dumps.wikimedia.org/simplewiki/latest/simplewiki-latest-pages-articles-multistream.xml.bz2
uv run python scripts/build_wiki_pack.py data_raw/simplewiki.xml.bz2 --id simplewiki --name "Simple English Wikipedia" --wiki https://simple.wikipedia.org
The same script works for full English Wikipedia (enwiki) and other language editions.
Wikipedia text is CC BY-SA 4.0; every answer links to the article it came from.
Measured on a MacBook Air M4, 16 GB
| Chat (Granite 3B Q4_K_M, llama.cpp, Metal) | ~37–41 tokens/s, answers in 2–10 s |
| Search in Simple English Wikipedia (264k articles, 721k passages) | 1–20 ms |
| Pack build from the dump | ~2 min |
| LoRA fine-tuning (PyTorch, MPS, bf16, rank 16, 1024 tokens) | 80 tokens/s, 10.6 GB |
| Trusts an altered pack over its own memory | 3 / 3 |
| LSLM adapter, 150 held-out questions: correct answers, base → tuned | 72% → 92% |
Training (for developers)
The training tools need PyTorch and are kept apart from the app: uv run --group train python scripts/….
scripts/make_train_data.py— builds pack-grounded training conversations from a pack.scripts/train_lora.py— LoRA fine-tuning (PyTorch, works on Apple Silicon and NVIDIA).scripts/export_lora.py— converts the adapter to GGUF for llama.cpp.scripts/eval_lora.py— compares the base model and the tuned one on held-out questions.
Licence
LSLM's code is released under the Apache License 2.0 (see LICENSE).
Granite 4.2 3B is © IBM, Apache 2.0. llama.cpp is MIT. Wikipedia text is CC BY-SA 4.0.
Explorer des projets similaires
Chargement…