Instructions to use rtsh13/epigenetics-slm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use rtsh13/epigenetics-slm with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf rtsh13/epigenetics-slm:Q4_K_M # Run inference directly in the terminal: llama cli -hf rtsh13/epigenetics-slm:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf rtsh13/epigenetics-slm:Q4_K_M # Run inference directly in the terminal: llama cli -hf rtsh13/epigenetics-slm:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf rtsh13/epigenetics-slm:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf rtsh13/epigenetics-slm:Q4_K_M
Use Docker
docker model run hf.co/rtsh13/epigenetics-slm:Q4_K_M
- Llama new
- LM Studio
- Jan
- Ollama
How to use rtsh13/epigenetics-slm with Ollama:
ollama run hf.co/rtsh13/epigenetics-slm:Q4_K_M
- Unsloth Desktop
- Pi
How to use rtsh13/epigenetics-slm with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf rtsh13/epigenetics-slm:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "rtsh13/epigenetics-slm:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use rtsh13/epigenetics-slm with Docker Model Runner:
docker model run hf.co/rtsh13/epigenetics-slm:Q4_K_M
- Lemonade
How to use rtsh13/epigenetics-slm with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull rtsh13/epigenetics-slm:Q4_K_M
Run and chat with the model
lemonade run user.epigenetics-slm-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use rtsh13/epigenetics-slm with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf rtsh13/epigenetics-slm:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default rtsh13/epigenetics-slm:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use rtsh13/epigenetics-slm with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf rtsh13/epigenetics-slm:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "rtsh13/epigenetics-slm:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: llama3.2
|
| 3 |
+
base_model: unsloth/Llama-3.2-1B-Instruct
|
| 4 |
+
tags:
|
| 5 |
+
- llama
|
| 6 |
+
- lora
|
| 7 |
+
- qlora
|
| 8 |
+
- gguf
|
| 9 |
+
- health
|
| 10 |
+
- biological-age
|
| 11 |
+
- epigenetics
|
| 12 |
+
- rag
|
| 13 |
+
language:
|
| 14 |
+
- en
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# epigenetics-slm
|
| 18 |
+
|
| 19 |
+
A Llama 3.2 1B Instruct model fine-tuned via QLoRA to generate five-category
|
| 20 |
+
epigenetic health assessments from wearable/biomarker data, grounded in a
|
| 21 |
+
Bio-RAG evidence retrieval pipeline.
|
| 22 |
+
|
| 23 |
+
Given a patient's biomarkers (HbA1c, NLR, circadian rest-activity metrics,
|
| 24 |
+
sleep architecture, CosinorAge acceleration) and retrieved evidence chunks,
|
| 25 |
+
the model produces a structured report with five sections: **AGING**,
|
| 26 |
+
**STRESS**, **METABOLISM**, **INFLAMMATION**, **SLEEP** — each citing the
|
| 27 |
+
evidence it was given.
|
| 28 |
+
|
| 29 |
+
## Files in this repo
|
| 30 |
+
|
| 31 |
+
| File | Description |
|
| 32 |
+
|---|---|
|
| 33 |
+
| `slm.q4_k_m.gguf` | Quantized model (q4_k_m), ~771MB, for CPU inference via `llama-cpp-python` |
|
| 34 |
+
| `slm_lora/` | Full LoRA adapter + tokenizer + all training checkpoints (100–1491 steps), with optimizer/scheduler state for resuming training |
|
| 35 |
+
| `chroma_db/` | Populated Bio-RAG vector store (47 chunks, `all-MiniLM-L6-v2` embeddings) — required alongside the model for grounded generation |
|
| 36 |
+
|
| 37 |
+
## Training details
|
| 38 |
+
|
| 39 |
+
- **Base model:** `unsloth/llama-3.2-1b-instruct-unsloth-bnb-4bit`
|
| 40 |
+
- **Method:** QLoRA via Unsloth + TRL `SFTTrainer`
|
| 41 |
+
- **Trainable params:** 11.2M / 1.25B (0.90%)
|
| 42 |
+
- **Dataset:** 4,415 examples derived from NHANES 2011-2012 biomarkers +
|
| 43 |
+
Bio-RAG evidence (3,973 train / 442 eval)
|
| 44 |
+
- **Epochs:** 3 (1,491 steps), effective batch size 8
|
| 45 |
+
- **Hardware:** RTX 4070 Laptop GPU (8GB VRAM), WSL2 Ubuntu 22.04
|
| 46 |
+
- **Precision:** bf16 training, fp32 LoRA adapter weights
|
| 47 |
+
|
| 48 |
+
## Eval results (442-row held-out split)
|
| 49 |
+
|
| 50 |
+
| Metric | Score |
|
| 51 |
+
|---|---|
|
| 52 |
+
| Category coverage (all 5 headers present) | 99.8% |
|
| 53 |
+
| Classification match rate | 98.5% |
|
| 54 |
+
| ROUGE-L | 0.822 |
|
| 55 |
+
|
| 56 |
+
These metrics check structural adherence (all five sections present) and
|
| 57 |
+
classification-label accuracy against the training data's target
|
| 58 |
+
responses. They do **not** measure citation faithfulness — see
|
| 59 |
+
Limitations.
|
| 60 |
+
|
| 61 |
+
## Usage
|
| 62 |
+
|
| 63 |
+
Requires the model to be prompted via the exact training-time template
|
| 64 |
+
(see `slm_prompt.py` in the [source repo](https://github.com/rtsh13/epigenetics-slm)
|
| 65 |
+
for the canonical `build_prompt()`/`build_inference_prompt()` functions —
|
| 66 |
+
byte-identical prompt formatting between training and inference is
|
| 67 |
+
required for output quality).
|
| 68 |
+
|
| 69 |
+
```python
|
| 70 |
+
from llama_cpp import Llama
|
| 71 |
+
|
| 72 |
+
llm = Llama(model_path="slm.q4_k_m.gguf", n_ctx=4096, verbose=False)
|
| 73 |
+
|
| 74 |
+
# prompt must be built via build_prompt() + build_inference_prompt()
|
| 75 |
+
# from the source repo — see link above
|
| 76 |
+
out = llm(prompt, max_tokens=512, temperature=0.2, stop=["<|eot_id|>"])
|
| 77 |
+
print(out["choices"][0]["text"])
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
For full end-to-end usage (XGBoost baseline + Bio-RAG retrieval + this
|
| 81 |
+
SLM), see `scripts/demo.py` in the source repo.
|
| 82 |
+
|
| 83 |
+
## Limitations
|
| 84 |
+
|
| 85 |
+
- **Requires Bio-RAG evidence to ground citations.** When run without
|
| 86 |
+
retrieved evidence chunks (empty RAG context), the model fabricates
|
| 87 |
+
plausible-sounding but nonexistent citations (invented author names,
|
| 88 |
+
journals, and DOIs). Always pass real retrieved evidence chunks.
|
| 89 |
+
- **Citation precision, not just presence.** Even with real evidence
|
| 90 |
+
available, the model sometimes reuses the same citation pair across
|
| 91 |
+
multiple report sections rather than mapping each specific claim to its
|
| 92 |
+
most relevant source chunk. This is an attribution-precision issue, not
|
| 93 |
+
fabrication.
|
| 94 |
+
- **1B parameter model.** Domain-specific acronym/definition accuracy
|
| 95 |
+
(e.g. circadian rest-activity metrics) is not guaranteed to be robust;
|
| 96 |
+
spot-check outputs before use in any downstream decision-making
|
| 97 |
+
context.
|
| 98 |
+
- **Not a medical device.** This is a research/prototype system trained
|
| 99 |
+
on NHANES survey data. Outputs should not be used for clinical
|
| 100 |
+
decision-making.
|
| 101 |
+
|
| 102 |
+
## Source code
|
| 103 |
+
|
| 104 |
+
Training, export, and evaluation pipeline:
|
| 105 |
+
[github.com/rtsh13/epigenetics-slm](https://github.com/rtsh13/epigenetics-slm)
|
| 106 |
+
(branch `feat/week7-slm-finetuning`)
|