fabsssss commited on
Commit
14f7b57
·
verified ·
1 Parent(s): c7275d2

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +50 -103
README.md CHANGED
@@ -1,120 +1,67 @@
1
  ---
2
  license: mit
3
  base_model: mlx-community/Qwen3-Coder-30B-A3B-Instruct-8bit
4
- tags: [ies4, information-exchange-standard, rdf, turtle, knowledge-graph, ontology, mlx, lora, uk-government]
5
  library_name: mlx
6
  language: [en]
7
  ---
8
 
9
- # Qwen3-Coder-30B-A3B — IES4 Turtle Generation (research prototype)
10
 
11
- A LoRA fine-tune of **mlx-community/Qwen3-Coder-30B-A3B-Instruct-8bit** that generates **IES4** (UK Government Information
12
- Exchange Standard) RDF/Turtle from natural-language scenarios, and follows a supplied
13
- target ontology for general knowledge-graph extraction. To our knowledge this is the
14
- first openly published LLM fine-tune targeting IES4 (checked against the Hugging Face
15
- API, GitHub and arXiv at release time). It is a research prototype: validate all output
16
- before production use.
17
 
18
- IES4 is a 4D ontology specified as an RDF Schema, developed by UK Government (Dstl, MOD,
19
- Home Office, Metropolitan Police, HMRC, DBT) with technical support from Telicent and
20
- Aurora Consulting. Repo: [dstl/IES4](https://github.com/dstl/IES4).
21
 
22
- ## Why fine-tune at all?
 
 
 
 
 
23
 
24
- The untuned base model cannot produce real IES4: **93.7% of the ies: terms it emits do
25
- not exist in the ontology** (0% term conformance). After LoRA:
 
 
 
26
 
27
- | Metric (held-out, in-distribution) | Base model | This model |
28
- |---|---|---|
29
- | Syntactic validity | 93.2% | **95.5%** |
30
- | IES4 term conformance | 0.0% | **88.6%** |
31
- | Hallucinated-term rate | 0.937 | **0.010** |
32
- | Structural conformance (domain/range) | 0.932* | **0.955** |
33
- | Namespace fidelity (when instructed) | — | **100%** |
34
 
35
- | Out-of-distribution (real dstl sample-data scenarios) | Base | This model |
36
- |---|---|---|
37
- | Syntactic validity | 90.0% | 70.0% |
38
- | IES4 term conformance | 0.0% | **30.0%** |
39
- | Structural conformance | 0.900* | 0.640 |
40
 
41
- | Ontology-conditioned extraction (Text2KGBench slice) | Base | This model |
42
  |---|---|---|
43
- | Syntactic validity | 50.0% | **91.7%** |
44
- | Relation conformance | 75.0% | **91.7%** |
45
- | IES-vocabulary bleed | 0% | **0%** |
46
-
47
- \* Baseline structural numbers are inflated: with mostly hallucinated vocabulary there
48
- are few checkable property usages. Metrics follow the spirit of
49
- [Text2KGBench](https://arxiv.org/abs/2308.02357): validity, conformance, hallucination.
50
- Eval code ships with the dataset repo; the OOD row is deliberately reported although it
51
- is the model's weakest surface.
52
-
53
- ## Training data (correct-by-construction)
54
-
55
- - **1,589 IES pairs**: graphs built programmatically with
56
- [telicent-ies-tool](https://github.com/telicent-oss/ies-tool) across 14 scenario
57
- patterns (employment, birth/death, events, identifiers, ownership, posts,
58
- location-states, access, possession, communication, composites), human-plausible
59
- instance IRIs, 35% namespace-varied with explicit namespace instructions. Every graph
60
- passed BOTH the telicent validation AND an independent term-membership validator built
61
- from the published ontology (510 classes, 204 properties). Descriptions are
62
- deterministic plus fact-checked local-LLM paraphrases (paraphrases dropping any name
63
- or year were discarded).
64
- - **210 vocabulary/boundary pairs**: class and property definitions verbatim from the
65
- ontology, plus refusal examples teaching what IES4 cannot express (opinions,
66
- speculation, causal claims).
67
- - **448 ontology-conditioned extraction pairs** from
68
- [Text2KGBench](https://github.com/cenguix/Text2KGBench) (Wikidata-TekGen), predicates
69
- restricted to each domain ontology.
70
-
71
- Split by target graph (no paraphrase leakage); OOD test set = descriptions of the real
72
- dstl sample-data files, never trained on.
73
-
74
- ## Method
75
-
76
- LoRA (16 layers) via `mlx-lm` 0.31.3 on Apple Silicon (M3 Max), QLoRA on the 8-bit MoE
77
- base, 1,000 iterations, batch 2, seq 2048, final val loss 0.15. The repo contains the
78
- fused 8-bit MLX model; the raw **adapter** is in `adapters/` for applying to the bf16
79
- base with other toolchains.
80
-
81
- ## Usage (MLX)
82
-
83
- ```bash
84
- pip install mlx-lm
85
- python -m mlx_lm generate --model fabsssss/qwen3-coder-30b-a3b-ies4 --max-tokens 600 --prompt \
86
- "Encode the following scenario as IES4 RDF/Turtle. Use only real IES4 terms and the
87
- 4D state/period pattern where relevant. Output only Turtle.
88
-
89
- Scenario: Priya Patel has worked for Meridian Bank since 2019-03-01 and attended a
90
- security briefing at Heathrow Terminal 4 on 2024-05-02 from 09:00 to 11:00."
91
- ```
92
 
93
  ## Limitations
94
-
95
- - Out-of-distribution performance (rich, idiomatic IES exchanges) is markedly lower than
96
- in-distribution; treat complex outputs as drafts for expert review.
97
- - Coverage: measures, representation/document patterns and intelligence-assessment
98
- structures are under-represented.
99
- - MLX 8-bit format; GGUF conversion not yet provided. Use the adapter on the bf16 base
100
- if you need other runtimes.
101
- - Always validate output (e.g. with telicent-ies-tool or the shipped validator) before
102
- exchange.
103
-
104
- ## Training data licensing & attribution
105
-
106
- - IES4 ontology: MIT, © Crown copyright, Defence Science and Technology Laboratory
107
- (Dstl). This model card retains that notice.
108
- - telicent-ies-tool: used only to generate training graphs (library not redistributed).
109
- - ~448 training pairs derive from Text2KGBench (data licence **CC BY-SA 4.0**; sources
110
- Wikidata-TekGen / DBpedia-WebNLG). Attribution: "Data derived from Text2KGBench
111
- (Mihindukulasooriya, Tiwari, Enguix, Lata; ISWC 2023), licensed CC BY-SA 4.0."
112
- The published dataset repo marks that slice separately under CC BY-SA 4.0.
113
- - Model weights: MIT. Weight releases are not, on current consensus, derivative works of
114
- training data; attribution obligations above are honoured regardless.
115
-
116
- ## Provenance
117
-
118
- Built and adversarially red-teamed (dataset design, eval integrity, licensing, tooling)
119
- before release; the eval harness and dataset are published for reproduction. By
120
- [The Tesseract Academy](https://gov.tesseract.academy).
 
1
  ---
2
  license: mit
3
  base_model: mlx-community/Qwen3-Coder-30B-A3B-Instruct-8bit
4
+ tags: [ies4, information-exchange-standard, rdf, turtle, knowledge-graph, ontology, mlx, lora, uk-government, neuro-symbolic]
5
  library_name: mlx
6
  language: [en]
7
  ---
8
 
9
+ # qwen3-coder-30b-a3b-ies4 (v1.3)
10
 
11
+ A LoRA fine-tune of Qwen3-Coder-30B-A3B that generates **IES4** (UK Government
12
+ Information Exchange Standard) RDF/Turtle from natural language. v1.3 adds targeted
13
+ coverage of the IES construct families (measurement, assessment/PossibleWorld,
14
+ facility+naming, vehicle/journey, meeting, kinship, rich communication) and is
15
+ designed to run **with a term-suggesting validator in the loop** (neuro-symbolic).
 
16
 
17
+ ## Headline: how to actually use this (the loop matters)
 
 
18
 
19
+ A single forward pass drafts structurally-correct IES4 but, on scenarios far from
20
+ the training distribution, reverts to *plausible-but-wrong* term spellings
21
+ (`ies:hasParticipant` for `ies:isParticipantIn`, `ies:MeasureUnit` for
22
+ `ies:measureUnit`). A **term-suggesting validator** closes this. Measured on
23
+ held-out, out-of-distribution scenarios (real dstl sample-data idioms the model
24
+ never trained on), IES4 term-conformance:
25
 
26
+ | pipeline | OOD term-conformance |
27
+ |---|---|
28
+ | single forward pass | 27% |
29
+ | + repair loop ("term X is invalid") | 45% |
30
+ | **+ suggesting loop ("-> use `ies:measureUnit`")** | **82%** |
31
 
32
+ The suggesting validator (`term_suggest.py`, shipped in this repo) returns the
33
+ nearest real IES4 term for any invalid one; the model applies the correction. This
34
+ is the recommended production pipeline.
 
 
 
 
35
 
36
+ ## In-distribution eval (vs untuned base)
 
 
 
 
37
 
38
+ | metric | base | v1.3 |
39
  |---|---|---|
40
+ | IES term conformance | 0.0% | **97.7%** |
41
+ | hallucinated-term rate | 0.942 | **0.005** |
42
+ | structural conformance | 0.911 | **0.977** |
43
+ | multi-standard relation conf | 91.7% | **100.0%** |
44
+
45
+ ## Files
46
+ - fused 8-bit MLX weights (v1.3) - default when you `mlx_lm generate --model` this repo
47
+ - `adapters_v13/` - the raw LoRA adapter (apply to the bf16 base with other toolchains)
48
+ - `term_suggest.py` - the term-suggesting validator (lexical + morphological + definition-overlap)
49
+ - `repair_suggest_ood.py` - the reference neuro-symbolic loop that scores 82% above
50
+
51
+ ## The finding (why this model is shaped this way)
52
+ A controlled study (v1.0->v1.3) showed OOD conformance is **invariant** to data
53
+ volume (2k->22k examples) and linguistic diversity (9%->38% paraphrase), and that
54
+ construct coverage fixes structure but not term-exactness. The binding constraint
55
+ is term-exactness on novel compositions; the fix is a symbolic term-suggesting
56
+ validator in the loop. This model is the "draft" half; `term_suggest.py` is the
57
+ "perfect" half.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  ## Limitations
60
+ - Without the loop, expect ~27% OOD term-conformance; **run the loop**.
61
+ - Two OOD residual classes remain even with the loop: concepts with no clean IES
62
+ equivalent (a boat is modelled as a generic vehicle), and suggester-ranking
63
+ misses (`NamingScheme`). Both are refinement targets, not walls.
64
+
65
+ ## Licensing
66
+ IES4: MIT, (C) Crown copyright Dstl. Multi-standard slice: Text2KGBench (CC-BY-SA-4.0,
67
+ Mihindukulasooriya et al, ISWC 2023). Weights: MIT. By The Tesseract Academy.