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
File size: 3,588 Bytes
4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 e478a2c 4edf474 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | ---
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:** [](https://colab.research.google.com/github/arshirazi97/tiny-log-parser/blob/main/demo.ipynb)
- **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
```python
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 |