Inspiration
Shennong is the mythical Chinese figure who tasted a hundred herbs to learn their effects. That method - empirical, patient, self-experimental - produced centuries of recorded observation. But the record is unusable to modern science for two reasons that have nothing to do with data volume:
The names do not survive. One plant is 甘草, 감초, Glycyrrhiza uralensis - and is also called Liquorice and Mulethi, names our lexicon does not yet hold. A 16th-century drug name and a modern gene target never meet. Nobody ever checked. A preparation instruction is a chemistry protocol written in a language no one validated against thermodynamics.
What it does
Track 1 · Read a passage. Paste any classical Chinese or ethnobotanical text. The system returns every drug it recognises with a character span and a confidence, its modern botanical binomial, its compound classes and its modern gene targets; the therapeutic claims mapped onto a controlled vocabulary; and the preparation processes it detected. Extraction is rule- and lexicon based, so it cannot hallucinate a span - every item points at a character range in the text you pasted.
Track 1 · At corpus scale. The same extractor was run over 273,334 formulas from 1,082 classical works - 744,997 drug mentions, 714,079 drug–indication pairs over 77,441 indications, in 52 seconds on a CPU. 167,679 formulas (61.3%) contain a recognised drug. That is the difference between a demo and a corpus.
Track 1 · Resolve a name. Type any name from any era or language - 丹參, 단삼, Salvia miltiorrhiza, Artemisia annua - and follow it through the binomial to eight recorded uses, four compound classes and ten gene targets, in about a second on a CPU. Coverage: 827 historical Chinese names, 2,175 Indian plants with synonyms (4,109 with recorded uses), 10,393 vernacular names across seven languages.
Track 2 · Screen a target. Type a disease target - EGFR, COX2, HMGCR. A tiered CPU-only screen over 23,176 plant compounds ranks candidates by ECFP4 similarity to known ChEMBL actives, then filters on Lipinski ADMET, preparation physics and structural novelty. On HMGCR the top hit scores a Tanimoto of 1.000: the pipeline rediscovers a known active, which is our control that the method works.
The part we are proudest of. We ran 203 recorded preparation claims through a mass-balance and heat-stability check. 78 are physically impossible - the compound decomposes at the temperature the text prescribes. And six of those passed every textual gate: the ancient record, the tradition and the theory all agreed. Physics still said no.
How we built it
The design thesis: do not ask a 1.5 B model to do chemistry. We split the system into five layers, each doing the thing it is measurably good at, and each output checkable by the layer above it.
1 · Corpus - the licence gate comes first, in code. 106 sources plus 1,304 CC0 works from jicheng.tw: 29,042 records, 177.3 M characters. scripts/ingest.py refuses any document without a licence and a URL proving it, so an unusable source cannot enter the pipeline by accident. Permissive only -CC0, public domain, CC BY. We excluded ctext.org and GRETIL, the two easiest corpora to obtain, because both are non-commercial: shipping them would have made the "open weights" claim false. Every source, including the rejected ones and why, is recorded in docs/CORPUS_PROVENANCE.md.
2 · Extraction -rule-based on purpose, not for lack of a model. A character trie does longest-match scanning over the drug lexicon and emits observations carrying char_start, char_end, the verbatim quote and a confidence. We could have asked the LLM to extract. We didn't, because a span you cannot point at is not evidence: an LLM extractor can produce a fluent sentence citing a passage that does not say it. The trie cannot invent a span, and every claim downstream inherits that guarantee. It ran over 273,334 formulas in 52 seconds, producing 744,997 drug mentions and 714,079 drug-indication pairs.
3 · Knowledge layer - provenance as a schema, not a promise. 888,303 facts, each carrying source_id plus char_start/char_end. Not "the corpus says X" - this character range of this edition says X. That is what makes the graph auditable instead of merely authoritative.
4 · The arbiter - the one layer that is not text. This is the part that could not live inside the model. shennong/physics/ models what a preparation actually does to a molecule: Clausius–Clapeyron volatilisation, Arrhenius hydrolysis with bond-class activation energies, thermal degradation above the boiling point. It was validated before it was trusted - Joback group-contribution boiling points against known constants, mean error 4.5 %, 6/6 within 10 %. It returns a retention fraction with a sensitivity range and overrules the text panel when they disagree: 78 of 203 recorded preparation claims fail it, including 6 the panel had scored unanimously.
5 · The model - language and reasoning, deliberately not knowledge. Qwen2.5-1.5B, LoRA r=64 on 88,082 domain examples, merged and quantised to Q4_K_M: 940 MiB, runs on CPU. On 200 held-out questions it scores 49.0 % against 37.0 % for its un-finetuned base (+12.0 pts). We also measured what it is bad at: asked "what is this Indian plant used for?" it answers with a Chinese classical use (0/63 on the use family). So uses are served by extraction and retrieval; the model handles language and reasoning. Knowing where the model must not be trusted was most of the engineering.
6 · Screening - cheminformatics where it can be exact. 23,176 plant compounds with real SMILES, fingerprinted with ECFP4 (Morgan r=2, 2048-bit) and ranked by Tanimoto similarity against precomputed ChEMBL actives, then filtered by Lipinski ADMET, preparation physics and structural novelty, fused into one falsifiable score. On HMGCR the top hit scores Tanimoto 1.000 - the pipeline rediscovers a known active, which is our control that the method works.
7 · Deployment - CPU-only end to end. A Hugging Face Space (Docker, 2 vCPU) runs llama.cpp over the Q4 GGUF with no GPU and no torch. 14 tabs, 4 running live inference. The build pulls weights from the Hugging Face CDN with -f and a size assertion, after an earlier build silently wrote a GitHub error page over the model file - a failure that only surfaced at query time.
Challenges we ran into
The benchmark was broken in three ways, and we only found out late. Each fix uncovered a worse problem underneath. First, the results were scored against a benchmark file that no longer existed - only 13 of 200 questions matched by text. Second, the keys for the "use" family were the tradition label rather than the recorded use, so a model answering "emetics" - correct - scored zero; that is why both arms reported use: 0/113. Third, and worst: after fixing the keys, use was still 0/63 for both models. The questions didn't match their own gold - "What is 蕺菜 recorded to treat?" carried the answer "Recorded use: emetics (Indian medicine)." The file had been generated from an older training set and never rebuilt. We regenerated it, re-ran both arms, and wrote the diagnosis up. The corrected number is lower than the one we had published - +12.0 instead of +13.5 - and that is the one we ship.
A number we had published was measuring an impossible task. We reported "drug-name → taxon resolution: 14.1 %" as our weakest link. The evaluator held out every test surface and asked the resolver to guess it from character similarity - but 甘草 and Licorice share no characters, so no lexicon can pass. The real figures are in-lexicon accuracy 1.000 and 48.7 % coverage. Investigating the rest showed 37.9 % of the pharmacopoeia isn't botanical at all - 23.5 % animal, 8.3 % mineral, 4.1 % manufactured objects. 縛豬繩 is a rope used to tie pigs. 溺白垽 is urine sediment. Counting those as failures was the wrong denominator.
A sparse MoE that lost. We upcycled Qwen2.5-0.5B into a genuine 4-expert top-2 MoE (1,435,499,392 params, expert weights actually trained, 999 MiB) and found it scored 31.7 % against 43.3 %. We released it anyway, with the benchmark that shows it losing.
Three GGUF format bugs to make it loadable at all: zero-size shared-expert tensors crashed the quantiser (tensor 12 of 410, leaving a 159 MB partial file); the tied LM head left output.weight missing; then the loader demanded full-width shared-expert tensors. All format problems - the trained weights never changed.
A demo bug that would have been fatal. The screening endpoint ignored its target parameter and silently returned COX2 for every query. A judge typing EGFR would have seen Cyclooxygenase-2. Found by testing the demo the way a judge would, not by running the tests.
And a deployment failure that taught us the most. Twelve minutes before recording, the Space went to BUILD_ERROR - HF's builder timing out on a GitHub release. The second bug it exposed was worse: the Dockerfile downloaded the model with curl without -f, so a failed download silently wrote a GitHub error page over the GGUF. The build "succeeded", the container started, and the failure only appeared when someone asked a question. We now vendor the wheel and pull weights from the HF CDN with -f and a size assertion.
Accomplishments that we're proud of
Two track demos that actually run live, on CPU, with no dead ends and no rehearsed answers. 714,079 drug–indication pairs from 273,334 formulas across 1,082 CC0 works, in 52 seconds on a CPU, with span-level provenance on every one.
78 of 203 recorded preparation claims refuted by first principles - and 6 refuted despite unanimous textual agreement. A retrieval pipeline structurally cannot make that claim: ancient consensus is not evidence.
Span-level provenance throughout - every claim carries source_id plus character offsets. We audited our own submission and published the corrections - a benchmark defect, an unresolvable metric, and a lower score than the one we'd already published.
A negative result we published rather than buried: a genuine sparse MoE that lost, with the benchmark that shows it losing.
What we learned
Ancient consensus is not evidence. Six hypotheses that every text-based check endorsed were refuted by mass balance and heat stability. Building that check mattered more than building a bigger model.
Most "AI for traditional medicine" projects stop at retrieval. The hard part is the names, and then the verification. The model is the easy layer.
The model is not the knowledge layer. Asked "what is Echinochloa colona used for in Indian medicine?" our fine-tune answers with a Chinese classical use - 0/63 on that family. That single measurement shaped the architecture: uses come from extraction; the model keeps language and reasoning.
A benchmark you cannot reproduce from your own repository is worth nothing, however good the number looks. Ours looked 13.5 points better than it was.
What's next for SHENNONG 神农
Greek and Latin classical texts. We hold 19 records' worth, so we do not claim to decode them. This is an acquisition task, not a modelling task, and it is the single highest-value addition for Track 1. Grow the historical Chinese drug lexicon beyond 827 entries - famous drugs such as 人參 are missing. Physical validation of the top screening candidates.