bogdanraduta commited on
Commit
d5c6472
·
verified ·
1 Parent(s): 8196642

Add fp16 merged model (Qwen3-4B LoRA)

Browse files
Files changed (1) hide show
  1. README.md +4 -110
README.md CHANGED
@@ -1,115 +1,9 @@
1
  ---
 
2
  license: apache-2.0
3
- language:
4
- - en
5
- - fr
6
- - de
7
- - ro
8
- base_model: Qwen/Qwen3-4B
9
- library_name: transformers
10
  pipeline_tag: text-generation
 
11
  tags:
12
- - lora
13
- - regulatory
14
- - compliance
15
- - ontology-extraction
16
- - information-extraction
17
- - mlx
18
- - gguf
19
- - flowx
20
  ---
21
-
22
- # FlowX Semantic Mapper (4B)
23
-
24
- **FlowX Semantic Mapper** reads a chunk of regulatory or legal text and emits a structured
25
- **ontology JSON** across three facets: **structural** (source hierarchy), **semantic**
26
- (domain tags, controlled-vocabulary concepts, and an actor/action/object/constraint entity),
27
- and **governance** (policy references, escalation trigger). It is a LoRA fine-tune of
28
- **Qwen3-4B**, built by FlowX.AI for regulated-industry NLP (banking, insurance, logistics,
29
- labor) in **English, French, German, and Romanian**.
30
-
31
- > Decision-support tool, **not legal advice**. Outputs should be reviewed by a qualified
32
- > professional before any compliance decision.
33
-
34
- ## What it does
35
-
36
- Input: a regulatory text chunk. Output: JSON of the form
37
-
38
- ```json
39
- {
40
- "structural": {"source_id": "...", "hierarchy": ["...", "..."], "document_type": "..."},
41
- "semantic": {
42
- "domain_tags": ["insurance_regulation", "claims", "settlement"],
43
- "concepts": ["claim_acknowledgement", "settlement_timeline"],
44
- "entities": {"actor": "insurer", "action": "acknowledge claim communications",
45
- "object": "claim_communication", "constraint": {"condition": "reasonably_prompt"}}
46
- },
47
- "governance": {"policy_references": ["PDP.insurance.claims_settlement"],
48
- "escalation_trigger": "if !claim_acknowledged_promptly THEN escalate"}
49
- }
50
- ```
51
-
52
- `concepts` are drawn from a **controlled 252-concept taxonomy** (`concept_taxonomy.yaml`,
53
- included), which is what makes them learnable, measurable, and consistent for downstream use.
54
-
55
- ## Evaluation (held-out, n=112, multilingual)
56
-
57
- | Field | Precision | Recall | F1 |
58
- |---|---|---|---|
59
- | JSON validity | | | **100%** |
60
- | all-3-facets present | | | **100%** |
61
- | domain_tags | 0.55 | 0.57 | **0.55** |
62
- | concepts (controlled vocab) | 0.55 | 0.56 | **0.54** |
63
- | entities (field accuracy) | | | **0.53** |
64
-
65
- The controlled vocabulary plus a real-regulatory-text data expansion **more than doubled**
66
- concept F1 (0.24 open-vocab → 0.54 controlled) and made the entity facet measurable
67
- (0.00 → 0.53). Numbers are on a document-disjoint held-out spanning EN/FR/DE/RO.
68
-
69
- ## Files & formats
70
-
71
- | Path | Format | Runs on |
72
- |---|---|---|
73
- | `/` (root) | fp16 safetensors (`transformers`) | CUDA / Linux servers, vLLM |
74
- | `mlx-int4/`, `mlx-int8/` | MLX quantized | Apple Silicon (on-device) |
75
- | `gguf/*.gguf` | GGUF Q8_0 / Q4_K_M | CUDA + CPU (llama.cpp / Ollama) |
76
-
77
- ## Usage (transformers)
78
-
79
- ```python
80
- from transformers import AutoModelForCausalLM, AutoTokenizer
81
- m = AutoModelForCausalLM.from_pretrained("flowxai/semantic-mapper", torch_dtype="auto", device_map="auto")
82
- tok = AutoTokenizer.from_pretrained("flowxai/semantic-mapper")
83
- msgs = [{"role": "system", "content": "You are a legal and regulatory ontology extractor.\nExtract structured tags from document chunks. Output ONLY valid JSON."},
84
- {"role": "user", "content": "Extract ontology from this chunk:\n\nCHUNK:\n<your regulatory text>"}]
85
- ids = tok.apply_chat_template(msgs, add_generation_prompt=True, enable_thinking=False, return_tensors="pt").to(m.device)
86
- print(tok.decode(m.generate(ids, max_new_tokens=1024)[0][ids.shape[1]:], skip_special_tokens=True))
87
- ```
88
-
89
- (`enable_thinking=False` — the adapter was trained to emit pure JSON, no thinking block.)
90
-
91
- ## Training
92
-
93
- LoRA (rank 32 / scale 16 / dropout 0.05), Qwen3-4B base, MLX-LM on Apple Silicon, ~3 epochs,
94
- cosine LR 1e-4&rarr;1e-5, max sequence length 2048. Data: **763 records** (651 train / 112
95
- held-out), document-disjoint. Composition: real, verbatim regulatory / legislative text from
96
- official public sources (US eCFR & state codes, EU EUR-Lex, France Legifrance, Germany
97
- Gesetze im Internet, Romania legislatie.just.ro, UNECE/ADR), annotated to the controlled
98
- 252-concept taxonomy with frontier-model assistance and validated (concepts in-vocabulary,
99
- entities populated, source URL per record).
100
-
101
- ## Limitations & responsible use
102
-
103
- - **Not legal advice** — a triage / structuring aid; always have important determinations
104
- reviewed by a qualified professional.
105
- - Strongest in English; FR/DE/RO are supported but somewhat weaker (see per-language notes).
106
- - Concept extraction is partial (F1 ~0.54): it surfaces many but not all applicable concepts.
107
- - `domain_tags` are free-text and less consistent than the controlled `concepts`.
108
-
109
- ## License & attribution
110
-
111
- Apache-2.0. Copyright 2026 FlowX.AI. See `NOTICE`. Base model: Qwen3-4B (Apache-2.0).
112
- Official legislation is reproduced with source acknowledgement (each training record carries
113
- its source URL).
114
-
115
- _Author: Bogdan Răduță, Head of Research, FlowX.AI._
 
1
  ---
2
+ library_name: mlx
3
  license: apache-2.0
4
+ license_link: https://huggingface.co/Qwen/Qwen3-4B/blob/main/LICENSE
 
 
 
 
 
 
5
  pipeline_tag: text-generation
6
+ base_model: mlx-community/Qwen3-4B-4bit
7
  tags:
8
+ - mlx
 
 
 
 
 
 
 
9
  ---