Text Generation
PEFT
Safetensors
Transformers
lora
unsloth
log-parsing
structured-output
conversational
Instructions to use arshirazi/tiny-log-parser with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use arshirazi/tiny-log-parser with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen3-4b-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "arshirazi/tiny-log-parser") - Transformers
How to use arshirazi/tiny-log-parser with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="arshirazi/tiny-log-parser") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("arshirazi/tiny-log-parser", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use arshirazi/tiny-log-parser with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "arshirazi/tiny-log-parser" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "arshirazi/tiny-log-parser", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/arshirazi/tiny-log-parser
- SGLang
How to use arshirazi/tiny-log-parser 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 "arshirazi/tiny-log-parser" \ --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": "arshirazi/tiny-log-parser", "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 "arshirazi/tiny-log-parser" \ --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": "arshirazi/tiny-log-parser", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use arshirazi/tiny-log-parser with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for arshirazi/tiny-log-parser to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for arshirazi/tiny-log-parser to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for arshirazi/tiny-log-parser to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="arshirazi/tiny-log-parser", max_seq_length=2048, ) - Docker Model Runner
How to use arshirazi/tiny-log-parser with Docker Model Runner:
docker model run hf.co/arshirazi/tiny-log-parser
Update Readme
Browse files
README.md
CHANGED
|
@@ -2,207 +2,93 @@
|
|
| 2 |
base_model: unsloth/qwen3-4b-unsloth-bnb-4bit
|
| 3 |
library_name: peft
|
| 4 |
pipeline_tag: text-generation
|
|
|
|
| 5 |
tags:
|
| 6 |
- base_model:adapter:unsloth/qwen3-4b-unsloth-bnb-4bit
|
| 7 |
- lora
|
| 8 |
- transformers
|
| 9 |
- unsloth
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
#
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
|
|
|
|
|
|
|
|
|
| 16 |
|
|
|
|
| 17 |
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
|
|
|
|
|
|
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 31 |
-
- **License:** [More Information Needed]
|
| 32 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 33 |
|
| 34 |
-
##
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
|
| 55 |
|
| 56 |
-
[More Information Needed]
|
| 57 |
-
|
| 58 |
-
### Out-of-Scope Use
|
| 59 |
-
|
| 60 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 61 |
-
|
| 62 |
-
[More Information Needed]
|
| 63 |
-
|
| 64 |
-
## Bias, Risks, and Limitations
|
| 65 |
-
|
| 66 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 67 |
-
|
| 68 |
-
[More Information Needed]
|
| 69 |
-
|
| 70 |
-
### Recommendations
|
| 71 |
-
|
| 72 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 73 |
-
|
| 74 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 75 |
-
|
| 76 |
-
## How to Get Started with the Model
|
| 77 |
-
|
| 78 |
-
Use the code below to get started with the model.
|
| 79 |
-
|
| 80 |
-
[More Information Needed]
|
| 81 |
-
|
| 82 |
-
## Training Details
|
| 83 |
-
|
| 84 |
-
### Training Data
|
| 85 |
-
|
| 86 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 87 |
-
|
| 88 |
-
[More Information Needed]
|
| 89 |
-
|
| 90 |
-
### Training Procedure
|
| 91 |
-
|
| 92 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 93 |
-
|
| 94 |
-
#### Preprocessing [optional]
|
| 95 |
-
|
| 96 |
-
[More Information Needed]
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
#### Training Hyperparameters
|
| 100 |
-
|
| 101 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 102 |
-
|
| 103 |
-
#### Speeds, Sizes, Times [optional]
|
| 104 |
-
|
| 105 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 106 |
-
|
| 107 |
-
[More Information Needed]
|
| 108 |
-
|
| 109 |
-
## Evaluation
|
| 110 |
-
|
| 111 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 112 |
-
|
| 113 |
-
### Testing Data, Factors & Metrics
|
| 114 |
-
|
| 115 |
-
#### Testing Data
|
| 116 |
-
|
| 117 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Factors
|
| 122 |
-
|
| 123 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
#### Metrics
|
| 128 |
-
|
| 129 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 130 |
-
|
| 131 |
-
[More Information Needed]
|
| 132 |
-
|
| 133 |
-
### Results
|
| 134 |
-
|
| 135 |
-
[More Information Needed]
|
| 136 |
-
|
| 137 |
-
#### Summary
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
## Model Examination [optional]
|
| 142 |
-
|
| 143 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 144 |
-
|
| 145 |
-
[More Information Needed]
|
| 146 |
-
|
| 147 |
-
## Environmental Impact
|
| 148 |
-
|
| 149 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 150 |
-
|
| 151 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 152 |
-
|
| 153 |
-
- **Hardware Type:** [More Information Needed]
|
| 154 |
-
- **Hours used:** [More Information Needed]
|
| 155 |
-
- **Cloud Provider:** [More Information Needed]
|
| 156 |
-
- **Compute Region:** [More Information Needed]
|
| 157 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 158 |
-
|
| 159 |
-
## Technical Specifications [optional]
|
| 160 |
-
|
| 161 |
-
### Model Architecture and Objective
|
| 162 |
-
|
| 163 |
-
[More Information Needed]
|
| 164 |
-
|
| 165 |
-
### Compute Infrastructure
|
| 166 |
-
|
| 167 |
-
[More Information Needed]
|
| 168 |
-
|
| 169 |
-
#### Hardware
|
| 170 |
-
|
| 171 |
-
[More Information Needed]
|
| 172 |
-
|
| 173 |
-
#### Software
|
| 174 |
-
|
| 175 |
-
[More Information Needed]
|
| 176 |
-
|
| 177 |
-
## Citation [optional]
|
| 178 |
-
|
| 179 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 180 |
-
|
| 181 |
-
**BibTeX:**
|
| 182 |
-
|
| 183 |
-
[More Information Needed]
|
| 184 |
-
|
| 185 |
-
**APA:**
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## Glossary [optional]
|
| 190 |
-
|
| 191 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 192 |
-
|
| 193 |
-
[More Information Needed]
|
| 194 |
-
|
| 195 |
-
## More Information [optional]
|
| 196 |
-
|
| 197 |
-
[More Information Needed]
|
| 198 |
-
|
| 199 |
-
## Model Card Authors [optional]
|
| 200 |
-
|
| 201 |
-
[More Information Needed]
|
| 202 |
-
|
| 203 |
-
## Model Card Contact
|
| 204 |
-
|
| 205 |
-
[More Information Needed]
|
| 206 |
### Framework versions
|
| 207 |
|
| 208 |
- PEFT 0.20.0
|
|
|
|
| 2 |
base_model: unsloth/qwen3-4b-unsloth-bnb-4bit
|
| 3 |
library_name: peft
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
+
license: apache-2.0
|
| 6 |
tags:
|
| 7 |
- base_model:adapter:unsloth/qwen3-4b-unsloth-bnb-4bit
|
| 8 |
- lora
|
| 9 |
- transformers
|
| 10 |
- unsloth
|
| 11 |
+
- log-parsing
|
| 12 |
+
- structured-output
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# tiny-log-parser
|
| 16 |
|
| 17 |
+
LoRA adapter for Qwen3-4B that normalizes log lines from six wire formats into a
|
| 18 |
+
canonical 7-field JSON record. Paired with a deterministic epoch pre-pass it
|
| 19 |
+
reaches **100% exact match vs 83.5%** for `gemini-3.1-pro-preview` on a
|
| 20 |
+
200-example held-out test set.
|
| 21 |
|
| 22 |
+
- **Code, eval harness, writeup:** https://github.com/arshirazi97/tiny-log-parser
|
| 23 |
+
- **Runnable demo:** [](https://colab.research.google.com/github/arshirazi97/tiny-log-parser/blob/main/demo.ipynb)
|
| 24 |
+
- **Base model:** `unsloth/qwen3-4b-unsloth-bnb-4bit`
|
| 25 |
|
| 26 |
+
## What it does
|
| 27 |
|
| 28 |
+
Takes a log line in syslog RFC3164, nginx combined, logfmt, Java/log4j,
|
| 29 |
+
container JSON, or a bracketed application format, and emits:
|
| 30 |
|
| 31 |
+
`timestamp` (ISO8601 UTC, second precision) · `level` (one of CRITICAL, ERROR,
|
| 32 |
+
WARNING, INFO, DEBUG) · `service` · `trace_id` · `status_code` · `latency_ms`
|
| 33 |
+
(integer) · `message`
|
| 34 |
|
| 35 |
+
## Results
|
| 36 |
|
| 37 |
+
200-example held-out test set, same spec given to both systems, same exact-match
|
| 38 |
+
verifier, all seven fields must match.
|
| 39 |
|
| 40 |
+
| | Exact match | 95% CI | Latency p50 |
|
| 41 |
+
|---|---|---|---|
|
| 42 |
+
| gemini-3.1-pro-preview (3-shot) | 83.5% | 78.5 – 88.5% | 11,713 ms |
|
| 43 |
+
| this adapter alone (zero-shot) | 73.0% | 66.5 – 79.0% | 4,197 ms |
|
| 44 |
+
| **this adapter + epoch pre-pass** | **100%** | 100 – 100% | 4,197 ms |
|
| 45 |
|
| 46 |
+
The adapter alone loses. Every one of its 54 misses is a bare-epoch timestamp —
|
| 47 |
+
integer division into calendar arithmetic the model cannot do reliably. Scaling
|
| 48 |
+
training data 5k → 20k moved that 0.5 points, so the conversion is routed to
|
| 49 |
+
`datetime.fromtimestamp()` instead of learned. It fires on 41 of 200 inputs.
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
+
## Usage
|
| 52 |
|
| 53 |
+
```python
|
| 54 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 55 |
+
from peft import PeftModel
|
| 56 |
|
| 57 |
+
BASE = "unsloth/qwen3-4b-unsloth-bnb-4bit"
|
| 58 |
+
tok = AutoTokenizer.from_pretrained(BASE)
|
| 59 |
+
model = PeftModel.from_pretrained(
|
| 60 |
+
AutoModelForCausalLM.from_pretrained(BASE, device_map="auto"),
|
| 61 |
+
"arshirazi/tiny-log-parser").eval()
|
| 62 |
+
```
|
| 63 |
|
| 64 |
+
Requires a CUDA GPU — the base is 4-bit bitsandbytes, which does not run on
|
| 65 |
+
Apple Silicon or CPU. The adapter expects the exact prompt spec in `eval.py`
|
| 66 |
+
(`build_prompt(line, [])`) zero-shot; a different prompt format degrades output.
|
| 67 |
+
The epoch pre-pass lives in `score_hybrid.py`.
|
| 68 |
|
| 69 |
+
## Training
|
| 70 |
|
| 71 |
+
4-bit QLoRA, r=16, 2 epochs, response-masked so loss lands on the JSON only.
|
| 72 |
+
20,000 synthetic examples generated canonical-record-first — the label exists
|
| 73 |
+
before the input, so every example is correct by construction. Train and test
|
| 74 |
+
draw from disjoint time windows (Jan–May vs Jun–Jul). Single RTX 2000 Ada
|
| 75 |
+
(16 GB), ~2.5 hours.
|
| 76 |
|
| 77 |
+
## Limitations
|
| 78 |
|
| 79 |
+
The test set is synthetic, drawn from the same six renderers as training.
|
| 80 |
+
Disjoint time windows prevent timestamp memorization but not format
|
| 81 |
+
memorization. Read the 100% as "solved within its stated distribution," not as a
|
| 82 |
+
claim about production logs.
|
| 83 |
|
| 84 |
+
Real logs are harder: multiline stack traces, truncated lines, vendor quirks,
|
| 85 |
+
and formats outside these six are absent. Hand-written lines outside the
|
| 86 |
+
generator's parameter range surfaced two gaps the test set did not catch —
|
| 87 |
+
syslog severity 5/6 mapping, and a placeholder service name invented on a
|
| 88 |
+
truncated line.
|
| 89 |
|
| 90 |
+
Compared against one baseline, scored once, at temperature 0.
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
### Framework versions
|
| 93 |
|
| 94 |
- PEFT 0.20.0
|