laiaric-open / README.md
mrw123's picture
Upload README.md with huggingface_hub
601e578 verified
|
Raw History Blame Contribute Delete
9.82 kB
---
license: apache-2.0
base_model: numind/NuExtract3
pipeline_tag: text-generation
tags:
- structured-extraction
- text-to-json
- information-extraction
- system-1
- coding
- agentic
- agents
- tool-calling
- qwen3_5
- json-schema
- gguf
- open-weights
metrics:
- f1
- accuracy
language:
- en
---
# laiaric-open: System 1 Model for Unstructured Text to JSON
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Live Demo Space](https://img.shields.io/badge/Live%20Demo-Hugging%20Face%20Space-pink?logo=huggingface)](https://huggingface.co/spaces/xeditai/laiaric-demo)
[![Agensi Skill](https://img.shields.io/badge/Agensi-Grounded%20Text--to--JSON-blueviolet?logo=sparkles)](https://agensi.io/skills/grounded-text-to-json-extractor)
[![GitHub Repository](https://img.shields.io/badge/GitHub-raycollabs%2Flaiaric-black?logo=github)](https://github.com/raycollabs/laiaric)
[![Hugging Face Base](https://img.shields.io/badge/Hugging%20Face-xeditai%2Flaiaric--open-yellow?logo=huggingface)](https://huggingface.co/xeditai/laiaric-open)
[![Hugging Face GGUF](https://img.shields.io/badge/Hugging%20Face-xeditai%2Flaiaric--open--GGUF-orange?logo=huggingface)](https://huggingface.co/xeditai/laiaric-open-GGUF)
[![System 1 Text-to-JSON](https://img.shields.io/badge/Role-System_1_Text--to--JSON-blueviolet.svg)](#overview)
[![Input: Text Only](https://img.shields.io/badge/Input-Text_Only-green.svg)](#overview)
[![Focus: Coding & Agents](https://img.shields.io/badge/Focus-Coding_&_Agentic-purple.svg)](#overview)
[![Field F1](https://img.shields.io/badge/Field_F1-97.4%25-brightgreen.svg)](#evaluation-results)
[![Schema Validity](https://img.shields.io/badge/Schema_Validity-100%25-success.svg)](#evaluation-results)
[![Evidence Accuracy](https://img.shields.io/badge/Evidence_Grounding-100%25-blueviolet.svg)](#evaluation-results)
[![Throughput](https://img.shields.io/badge/Throughput-46_tok%2Fs-orange.svg)](#specifications)
`laiaric-open` is an open-weight 4.3B parameter model. It functions as a **System 1 model for unstructured text to JSON**, similar in design philosophy to Cloudflare's Clairic model.
The model is trained specifically for **coding and agentic purposes**. It reads raw text with a target JSON schema and outputs strict, calibrated, verbatim-grounded JSON without hallucination.
```mermaid
flowchart TD
subgraph "Agentic System 1 vs System 2 Architecture"
subgraph "Autonomous Agent / Coding System"
A["Agent Reasoning Core\n(System 2 LLM / Planner)"]
T["Unstructured Tool Output\n• Stack Traces\n• API Payloads\n• Code Diffs\n• GitHub Issues"]
end
subgraph "Fast Perception Layer"
T --> B["laiaric-open\n(System 1 Fast Parser)"]
S["Target JSON Schema\n(Strict Envelope)"] --> B
B --> |"< 1 sec, 46 tok/s"| C["Validated JSON Output\n• exact values\n• verbatim evidence spans\n• logprob confidence (0.999)"]
end
C --> |"Deterministic Action"| A
end
```
---
## 1. Key Principles (ASD-STE100)
### 1.1 Input is Text Only
- The input to `laiaric-open` is **strictly text**.
- The model accepts a JSON schema and unstructured text in the user prompt.
- The model uses no image tokens or visual encoders.
- This design maximizes generation speed and minimizes memory usage.
### 1.2 System 1 Reflex for Agents
- Traditional reasoning models (System 2) generate extensive chain-of-thought tokens before they produce structured output.
- `laiaric-open` operates as a **System 1 reflex**. It converts unstructured text to JSON immediately.
- The model outputs the structured envelope at **45.97 tokens per second** on consumer hardware (NVIDIA RTX 3060).
### 1.3 Trained for Coding and Agentic Workflows
The training dataset focuses on software engineering and autonomous agent operations:
- **SDK Bug Tickets**: Extracting stack traces, error codes, and reproduction steps.
- **Application Specifications**: Parsing service names, database requirements, and container profiles.
- **Failure Triage**: Classifying root causes, fault domains, and remediation steps from server logs.
- **RL Hillclimb Proposals**: Structuring optimization targets, reward weights, and candidate strategies.
- **Candidate Ensembles**: Generating and formatting multi-candidate configurations for selector evaluation.
### 1.4 Verbatim Text Grounding
- The model copies values directly from the input text.
- The model does not invent or estimate data.
- The model outputs an exact text substring as `evidence` for every field.
- When the text does not contain a value, the model writes `null`.
---
## 2. Technical Specifications
- **Model Identifier**: `laiaric-open`
- **Organization**: `xeditai`
- **Base Architecture**: `Qwen3_5ForConditionalGeneration` (multimodal wrapper base, text-only operational mode)
- **Base Weights**: `numind/NuExtract3` (4.3B parameters)
- **Fine-Tuning Method**: 4-bit QLoRA (`r=16, lora_alpha=32, target_modules=all-linear`)
- **Training Steps**: 942 steps across 2 full epochs (Final train loss: `0.006272`, eval token accuracy: `99.97%`)
- **Quantizations**: `Q8_0` (4.2 GB), `Q4_K_M` (2.6 GB), and `BF16` (7.9 GB)
- **License**: Apache-2.0
---
## 3. Evaluation Results
The model was evaluated against the frozen S2 benchmark (300 test documents across 6 enterprise domains).
### 3.1 Benchmark Comparison Table
| Metric | Base Model (`NuExtract3-Q8_0`) | `laiaric-open-Q8_0` | Delta | Status |
|---|---|---|---|---|
| **Field Exact F1** | `0.9459` | **`0.9739`** | **+2.8%** | **PASS** ($\ge 0.9459$) |
| **Schema Valid Rate** | `1.0000` | **`1.0000`** | **100% Exact** | **PASS** ($1.0000$) |
| **Null Recall** | `0.9036` | **`0.9639`** | **+6.0%** | **PASS** ($\ge 0.9000$) |
| **Null Precision** | `1.0000` | **`1.0000`** | **100% Exact** | **PASS** |
| **Null F1** | `0.9494` | **`0.9816`** | **+3.2%** | **PASS** |
| **Evidence Accuracy** | `0.9915` | **`1.0000`** | **100% Verbatim** | **PASS** ($\ge 0.9500$) |
| **Calibration Error (ECE)** | `0.0361` | **`0.0224`** | **-37.9% Error** | **PASS** ($\le 0.1000$) |
| **Throughput (RTX 3060)** | `40.36 tok/s` | **`45.97 tok/s`** | **+13.9% Faster** | **PASS** ($\ge 30.0$) |
### 3.2 Performance by Domain
```
Domain Field F1:
Software App Specifications: [████████████████████] 1.0000
System Failure Triage: [███████████████████░] 0.9857 (+10.4%)
Agent Candidate Configurations: [███████████████████░] 0.9750
RL Hillclimb Proposals: [████████████████████] 1.0000
SDK Bug Tickets: [██████████████████░░] 0.9050 (+11.1%)
General Unseen Schemas: [███████████████████░] 0.9778
```
---
## 4. Operating Instructions
### 4.1 Python (Transformers)
Use the code below to run `laiaric-open` with PyTorch:
```python
import json
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
model_id = "xeditai/laiaric-open"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Sample: Define schema for agent failure triage
schema = {
"type": "object",
"properties": {
"service_name": {"type": "string"},
"error_code": {"type": "integer"},
"root_cause": {"type": "string"},
"remediation_action": {"type": "string"},
"retryable": {"type": "boolean"},
"unrelated_field": {"type": ["string", "null"]}
},
"required": ["service_name", "error_code", "root_cause", "remediation_action", "retryable", "unrelated_field"]
}
text = (
"Production Incident: Service 'auth-gateway' failed with HTTP status 504. "
"Root cause was connection pool exhaustion on redis-primary. "
"Action taken: scaled read-replicas and restarted gateway instances. Failures are retryable."
)
prompt = json.dumps({"schema": schema, "text": text})
messages = [{"role": "user", "content": prompt}]
chat_prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(chat_prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024, temperature=0.0)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)
```
### 4.2 GGUF Quantizations (llama.cpp)
Quantized GGUF files are available in [`xeditai/laiaric-open-GGUF`](https://huggingface.co/xeditai/laiaric-open-GGUF):
```bash
# Start local server on port 8080
llama-server -m laiaric-open-Q8_0.gguf -ngl 999 -c 8192 --port 8080
```
### 4.3 Ollama
Create a file named `Modelfile`:
```dockerfile
FROM ./laiaric-open-Q8_0.gguf
PARAMETER temperature 0
PARAMETER stop "<|im_end|>"
TEMPLATE """<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant
"""
```
Initialize the model:
```bash
ollama create laiaric -f Modelfile
ollama run laiaric
```
---
## 5. Lineage and Data Governance
The model was trained exclusively on open-license datasets. All private directories and files from personal `Documents` folders were strictly excluded.
| Dataset ID | License | Function |
|---|---|---|
| `durai_s4_option_b_2200` | `Apache-2.0` | Synthetic agent, ticket, and code spec schema pairs |
| `suneeldk/text-json` | `Apache-2.0` | Text-to-JSON structural extraction pairs |
| `abr-6024/schema-json-extractor-synthetic` | `Apache-2.0` | Complex nested schema extraction |
| `epfl-dlab/JSONSchemaBench` | `MIT` | Schema conformance benchmarking |