Views
No views yet
| Model | Valid PromQL | Correct% | Avg Score |
|---|---|---|---|
| qwen3-1.7b-promql (this model) | 90% | 35% | 3.55 |
| qwen3:1.7b (base) | 6% | 4% | — |
| Category | Valid% | Correct% |
|---|---|---|
| General metrics | 90% | 45% |
| Hard / multi-step | 93% | 48% |
| Expert / subqueries | 87% | 12% |
min_over_time(rate(...)[6h:5m])) are the current weak spot.1# Download the GGUF file from this repo, then:
2cat > Modelfile << 'EOF'
3FROM ./qwen3-1.7b.Q4_K_M.gguf
4
5TEMPLATE """<|im_start|>system
6You are a PromQL expert. Given a monitoring request and context, return only the PromQL query with no explanation.<|im_end|>
7<|im_start|>user
8{{ .Prompt }}<|im_end|>
9<|im_start|>assistant
10"""
11
12PARAMETER temperature 0.1
13PARAMETER stop "<|im_end|>"
14PARAMETER stop "<|im_start|>"
15EOF
16
17ollama create promql -f Modelfile
18ollama run promql "Request: Show HTTP error rate over 5 minutes
19Context: Metric http_requests_total with labels code, method"1from transformers import AutoTokenizer, AutoModelForCausalLM
2from peft import PeftModel
3import torch
4
5base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-1.7B", torch_dtype=torch.float16)
6tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-1.7B")
7model = PeftModel.from_pretrained(base, "AsyncBuilds/qwen3-1.7b-promql")
8
9SYSTEM = "You are a PromQL expert. Given a monitoring request and context, return only the PromQL query with no explanation."
10
11messages = [
12 {"role": "system", "content": SYSTEM},
13 {"role": "user", "content": "Request: Show CPU usage per node\nContext: Metric node_cpu_seconds_total"},
14]
15
16prompt = tokenizer.apply_chat_template(
17 messages, tokenize=False, add_generation_prompt=True, enable_thinking=False
18)
19inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
20
21with torch.no_grad():
22 outputs = model.generate(**inputs, max_new_tokens=128, temperature=0.1, do_sample=True)
23
24response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
25print(response.strip())Request: <natural language description of what you want to measure>
Context: <relevant metric names and labels>Context field is optional but improves accuracy — include the metric name(s) you want to query when known.