Native Log Translator (JSON β Syslog/Raw)
This model is a Log Translation Adapter trained to convert structured JSON logs back into their original, raw native formats (Syslog, Apache Common, Auth logs, etc.).
It was trained using Self-Distillation:
- A "Teacher" model (Mistral-7B-Instruct) generated valid native logs from JSON inputs.
- This "Student" model (Mistral-7B + QLoRA) was fine-tuned on that synthetic pair data to specialize in this translation task.
π Usage
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
# 1. Load Base Model
base_model_id = "mistralai/Mistral-7B-Instruct-v0.2"
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_quant_type="nf4"
)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
quantization_config=bnb_config,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
# 2. Load This Adapter
adapter_model_id = "Swapnanil09/native-log-translator-mistral-7b-qlora"
model = PeftModel.from_pretrained(base_model, adapter_model_id)
# 3. Run Inference
json_log = '{"timestamp": "2023-10-27T10:00:01Z", "level": "ERROR", "service": "sshd", "msg": "Invalid user admin from 192.168.1.5"}'
prompt = f"""### Instruction:
Convert the given JSON log into its ORIGINAL native system log format.
Output ONLY the log line.
### Input:
{json_log}
### Output:
"""
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True).split("### Output:")[-1].strip())
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support
Model tree for Final-year-grp24/native-log-translator-mistral-7b-qlora
Base model
mistralai/Mistral-7B-Instruct-v0.2