Text Generation
Transformers
Safetensors
GGUF
MLX
qwen3
lora
regulatory
compliance
ontology-extraction
information-extraction
flowx
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use flowxai/semantic-mapper with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use flowxai/semantic-mapper with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="flowxai/semantic-mapper") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("flowxai/semantic-mapper") model = AutoModelForCausalLM.from_pretrained("flowxai/semantic-mapper", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - MLX
How to use flowxai/semantic-mapper with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("flowxai/semantic-mapper") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use flowxai/semantic-mapper 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 flowxai/semantic-mapper:Q4_K_M # Run inference directly in the terminal: llama cli -hf flowxai/semantic-mapper:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf flowxai/semantic-mapper:Q4_K_M # Run inference directly in the terminal: llama cli -hf flowxai/semantic-mapper:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf flowxai/semantic-mapper:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf flowxai/semantic-mapper:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf flowxai/semantic-mapper:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf flowxai/semantic-mapper:Q4_K_M
Use Docker
docker model run hf.co/flowxai/semantic-mapper:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use flowxai/semantic-mapper with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "flowxai/semantic-mapper" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flowxai/semantic-mapper", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/flowxai/semantic-mapper:Q4_K_M
- SGLang
How to use flowxai/semantic-mapper with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "flowxai/semantic-mapper" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flowxai/semantic-mapper", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "flowxai/semantic-mapper" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flowxai/semantic-mapper", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use flowxai/semantic-mapper with Ollama:
ollama run hf.co/flowxai/semantic-mapper:Q4_K_M
- Unsloth Desktop
- Pi
How to use flowxai/semantic-mapper with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "flowxai/semantic-mapper"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "flowxai/semantic-mapper" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use flowxai/semantic-mapper with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "flowxai/semantic-mapper"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "flowxai/semantic-mapper" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flowxai/semantic-mapper", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use flowxai/semantic-mapper with Docker Model Runner:
docker model run hf.co/flowxai/semantic-mapper:Q4_K_M
- Lemonade
How to use flowxai/semantic-mapper with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull flowxai/semantic-mapper:Q4_K_M
Run and chat with the model
lemonade run user.semantic-mapper-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use flowxai/semantic-mapper with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "flowxai/semantic-mapper"
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:8080/v1 hermes config set model.default flowxai/semantic-mapper
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use flowxai/semantic-mapper with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "flowxai/semantic-mapper"
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:8080/v1 \ --custom-model-id "flowxai/semantic-mapper" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Add fp16 merged model (Qwen3-4B LoRA)
Browse files
README.md
CHANGED
|
@@ -1,115 +1,9 @@
|
|
| 1 |
---
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
-
|
| 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 |
-
|
| 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→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 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|