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)# pip install -U transformers accelerate # 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 Desktop
- Docker Model Runner
How to use arshirazi/tiny-log-parser with Docker Model Runner:
docker model run hf.co/arshirazi/tiny-log-parser
Download README.md from arshirazi/tiny-log-parser: direct link, hf CLI and curl.
- Browser
- Download file 3.59 kB
-
https://huggingface.co/arshirazi/tiny-log-parser/resolve/e478a2c8813b1d3c467706dc373ca3ab01b006b0/README.md
- Command line
-
hf download hf://arshirazi/tiny-log-parser@e478a2c8813b1d3c467706dc373ca3ab01b006b0/README.md
-
curl -L -o README.md https://huggingface.co/arshirazi/tiny-log-parser/resolve/e478a2c8813b1d3c467706dc373ca3ab01b006b0/README.md
base_model: unsloth/qwen3-4b-unsloth-bnb-4bit
library_name: peft
pipeline_tag: text-generation
license: apache-2.0
tags:
- base_model:adapter:unsloth/qwen3-4b-unsloth-bnb-4bit
- lora
- transformers
- unsloth
- log-parsing
- structured-output
tiny-log-parser
LoRA adapter for Qwen3-4B that normalizes log lines from six wire formats into a
canonical 7-field JSON record. Paired with a deterministic epoch pre-pass it
reaches 100% exact match vs 83.5% for gemini-3.1-pro-preview on a
200-example held-out test set.
- Code, eval harness, writeup: https://github.com/arshirazi97/tiny-log-parser
- Runnable demo:
- Base model:
unsloth/qwen3-4b-unsloth-bnb-4bit
What it does
Takes a log line in syslog RFC3164, nginx combined, logfmt, Java/log4j, container JSON, or a bracketed application format, and emits:
timestamp (ISO8601 UTC, second precision) · level (one of CRITICAL, ERROR,
WARNING, INFO, DEBUG) · service · trace_id · status_code · latency_ms
(integer) · message
Results
200-example held-out test set, same spec given to both systems, same exact-match verifier, all seven fields must match.
| Exact match | 95% CI | Latency p50 | |
|---|---|---|---|
| gemini-3.1-pro-preview (3-shot) | 83.5% | 78.5 – 88.5% | 11,713 ms |
| this adapter alone (zero-shot) | 73.0% | 66.5 – 79.0% | 4,197 ms |
| this adapter + epoch pre-pass | 100% | 100 – 100% | 4,197 ms |
The adapter alone loses. Every one of its 54 misses is a bare-epoch timestamp —
integer division into calendar arithmetic the model cannot do reliably. Scaling
training data 5k → 20k moved that 0.5 points, so the conversion is routed to
datetime.fromtimestamp() instead of learned. It fires on 41 of 200 inputs.
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
BASE = "unsloth/qwen3-4b-unsloth-bnb-4bit"
tok = AutoTokenizer.from_pretrained(BASE)
model = PeftModel.from_pretrained(
AutoModelForCausalLM.from_pretrained(BASE, device_map="auto"),
"arshirazi/tiny-log-parser").eval()
Requires a CUDA GPU — the base is 4-bit bitsandbytes, which does not run on
Apple Silicon or CPU. The adapter expects the exact prompt spec in eval.py
(build_prompt(line, [])) zero-shot; a different prompt format degrades output.
The epoch pre-pass lives in score_hybrid.py.
Training
4-bit QLoRA, r=16, 2 epochs, response-masked so loss lands on the JSON only. 20,000 synthetic examples generated canonical-record-first — the label exists before the input, so every example is correct by construction. Train and test draw from disjoint time windows (Jan–May vs Jun–Jul). Single RTX 2000 Ada (16 GB), ~2.5 hours.
Limitations
The test set is synthetic, drawn from the same six renderers as training. Disjoint time windows prevent timestamp memorization but not format memorization. Read the 100% as "solved within its stated distribution," not as a claim about production logs.
Real logs are harder: multiline stack traces, truncated lines, vendor quirks, and formats outside these six are absent. Hand-written lines outside the generator's parameter range surfaced two gaps the test set did not catch — syslog severity 5/6 mapping, and a placeholder service name invented on a truncated line.
Compared against one baseline, scored once, at temperature 0.
Framework versions
- PEFT 0.20.0