bio-expert / README.md
andyz321's picture
Upload README.md with huggingface_hub
8496112 verified
|
Raw History Blame Contribute Delete
6.48 kB
# bio-expert β€” Domain Expert Model for Bioinformatics & Synthetic Biology
**Base:** Qwen3-8B (base) Β· **Method:** domain-data distillation + QLoRA Β· **Hardware:** 1 Γ— RTX 3080 Laptop 16GB, fully local
A 8B domain-specific model built through domain-data distillation and QLoRA fine-tuning, covering three areas: **bioinformatics analysis**, **synthetic biology strain construction**, and **bioinformatics-informed biomedicine**.
It does two things over a general-purpose model that it was explicitly trained for: **knowing who it is**, and **ending every answer with a follow-up question genuinely worth asking**.
δΈ­ζ–‡η‰ˆθ―΄ζ˜Žθ§ [`README_zh.md`](README_zh.md)。
---
## What it covers
- **Bioinformatics analysis** β€” the full chain from QC to interpretation: alignment, annotation, quantification, differential expression, enrichment, single-cell, and metagenomics. It gives tool names, parameter ranges, and thresholds, not just concepts.
- **Synthetic biology strain construction** β€” chassis selection, vector and part design, assembly methods, CRISPR knockout editing, metabolic pathway design and titer optimization, including the mechanism and failure-troubleshooting order at each step.
- **Bioinformatics-informed biomedicine** β€” GWAS / eQTL, cancer genomics, clinical variant interpretation (ACMG), liquid-biopsy ctDNA, multi-omics integration, and single-cell applications in oncology and immunology.
---
## Files in this repo
| Path | What it is |
|---|---|
| `bio-expert-Qwen3-8B-Q8_0.gguf` | **The model.** Merged bf16 β†’ GGUF q8_0, 8.11 GB, 32K context, ready for `ollama` / `llama.cpp` |
| `adapter/` | The QLoRA adapter (r=32, 4bit NF4) it was merged from β€” use this to reproduce the merge |
| `Modelfile` | The ollama definition: `FROM`, `SYSTEM`, parameters |
| `system_prompt.txt` | The exact system prompt (identical to `scripts/prompt.py`) |
| `scripts/` | Training, merging, evaluation and data-generation scripts |
| `data/` | The 759-sample SFT corpus (555 domain + 204 identity / curiosity) |
| `eval_results.json` | Raw output of the 25-question evaluation |
### Use it with ollama
```bash
# Modelfile already points at the GGUF in this repo
ollama create bio-expert -f Modelfile
ollama run bio-expert
```
### Use the adapter with PEFT
```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-8B", torch_dtype="bfloat16", device_map="auto")
model = PeftModel.from_pretrained(base, "adapter")
model = model.merge_and_unload()
```
---
## How it was trained
| Stage | Approach |
|---|---|
| Seeds | 130 hand-curated real task topics |
| Distillation | DeepSeek V4 Flash teacher model expanded into Q&A with mechanistic reasoning, concrete parameters, and tool names |
| Corpus | 759 samples (555 domain + 204 identity / curiosity) |
| Fine-tuning | Unsloth QLoRA, 4bit NF4, LoRA r=32, loss 3.16 β†’ 1.30, peak VRAM 8.0 GB |
| Merge & quantize | merged bf16 15.3 GB β†’ GGUF q8_0 8.11 GB, 32K context |
Corpus preparation, training, evaluation and quantization all ran on a single machine β€” neither the weights nor your conversations ever leave it.
### Reproduce
```bash
pip install unsloth trl peft transformers
python scripts/train_round2.py --stage 3 --epochs 1.3 --init-adapter <round2 adapter>
python scripts/merge.py --adapter <checkpoint> --out <merged dir>
python scripts/write_modelfile.py
python scripts/eval_round2.py --adapter <checkpoint> --out eval_results.json
```
---
## The two trained behaviors
### Identity
The model knows who it is, what it is built on, and where its competence ends. These are **hand-written ground truth**, not something left for the model to invent β€” identity is a fact the company defines, not a topic for free-form improvisation. Every identity answer carries an explicit boundary statement so the model never overstates its own abilities.
### Curiosity (an observable behavior, not a persona prompt)
The instruction side of the curiosity corpus uses the bare questions real users actually ask, and the system prompt carries one global rule: when the answer touches a mechanism, an open problem, or a research direction worth extending, close with a question that genuinely advances understanding. Answers then break into three layers on their own: surface mechanism β†’ the deeper reason behind it β†’ why it is this way rather than an alternative.
> The trap we hit: the training instruction originally read "go deeper on this question and tell me what you'd want to ask next: &lt;topic&gt;". What the model learned was not curiosity but *recognizing that specific prefix* β€” change the phrasing and it stopped asking. The fix was not more data but **changing the training distribution itself**: bare topics as instructions, with a global rule in the system prompt as the safety net.
---
## Measured evaluation
25 questions with reverse probes (to catch "answered backwards but still scored") and synonym groups:
| Dimension | Result |
|---|---|
| **Overall pass rate** | **24 / 25 = 96%** |
| Identity | 8 / 8 = 100% |
| Domain ability, no regression | 5 / 5 = 100% |
| Curiosity question chain | 11 / 12 = 92% |
| **Proactive follow-up at the end of answers** | **12 / 12 = 100%** |
---
## Boundaries (read this first)
- **No internet access.** It cannot look up NCBI / UniProt / PDB live β€” verify accessions, PMIDs and database versions yourself.
- **No wet-lab work.** Everything it outputs is computational guidance.
- **It does not replace clinical judgment.**
- **Weaker than general models on general knowledge.** For general trivia, long-form writing and math, use a larger general-purpose model. This model only leads inside its three domains.
- The evaluation is a self-built 25-question set. It is small, and **does not mean it beats a general model on arbitrary tasks.**
---
## Built-in parameters
`num_ctx 32768` Β· `temperature 0.7` Β· `top_p 0.9` Β· `repeat_penalty 1.1`
As an agent model it has been verified to return correct tool calls under a 10k–29k token system prompt with tool definitions.
---
## License
The base model **Qwen3-8B** is licensed under **Apache-2.0**. The fine-tuned weights in this model are Β© εˆζ›œη”Ÿη‰© HeYao Bio and are released under the same Apache-2.0 terms.
---
**HeYao Bio εˆζ›œη”Ÿη‰© Β· AI + Life Science**
Every number on this page comes from locally measured training and evaluation logs.