Skip to main content

Fine-tuned SRE sentence embedding model — semantic search & similarity for Site Reliability Engineering

Project description

sre-embedding-model

Fine-tuned sentence embedding model for Site Reliability Engineering (SRE)

PyPI version License Python 3.8+


What is this?

A sentence embedding model fine-tuned on 636 SRE domain pairs across 16 domains. It understands SRE vocabulary out-of-the-box — no setup, no internet, weights bundled inside the package.

Base model: all-MiniLM-L6-v2 (Microsoft, Apache 2.0) — 22M parameters, 384-dim embeddings.

Trained on: Kubernetes pod states & errors · Observability & metrics · Incident management & RCA · APM & distributed tracing · Splunk & log analysis · Java / Spring Boot · MySQL · Kafka · API Gateway · CI/CD · CMDB · Cloud platforms · Security


Install

pip install sre-embedding-model

Model weights (~88 MB) are bundled — no internet connection required after install.


Quick Start

from sre_embedding_model import SREModel

model = SREModel()

# ── Similarity between two SRE texts ─────────────────────────────────────────
score = model.similarity("pod keeps crashing", "CrashLoopBackOff")
print(score)  # → 0.961

score = model.similarity("mean time to recover", "MTTR")
print(score)  # → 0.965

# ── Semantic search — rank docs by query ──────────────────────────────────────
runbooks = [
    "CrashLoopBackOff — container restart loop runbook",
    "OOMKilled — container memory limit exceeded",
    "Evicted — node resource pressure",
    "MySQL lock wait timeout — transaction blocked",
]
results = model.search("container is being killed due to memory", runbooks, top_k=3)
for doc, score in results:
    print(f"{score:.3f}  {doc}")
# → 0.924  OOMKilled — container memory limit exceeded
# → 0.871  CrashLoopBackOff — container restart loop runbook
# → 0.843  Evicted — node resource pressure

# ── Zero-shot classification ──────────────────────────────────────────────────
labels = ["Kubernetes error", "Database issue", "Kafka lag", "Deployment failure"]
results = model.classify("replica is not keeping up with the primary", labels)
print(results[0])  # → ("Database issue", 0.847)

# ── Encode to vectors (for vector DB / RAG) ───────────────────────────────────
vectors = model.encode(["MTTR", "SLO", "CrashLoopBackOff", "Kafka consumer lag"])
print(vectors.shape)  # → (4, 384)

# ── SRE relevance gate ────────────────────────────────────────────────────────
print(model.is_sre_related("pod is OOMKilled"))       # → True
print(model.is_sre_related("what is the weather?"))   # → False

# ── Rerank BM25/keyword results ───────────────────────────────────────────────
keyword_results = ["OOMKilled doc", "MTTR guide", "canary deployment playbook"]
reranked = model.rerank("container killed by kernel", keyword_results)

# ── Model info ────────────────────────────────────────────────────────────────
print(model.info())
# {
#   "embedding_dim": 384,
#   "max_seq_length": 256,
#   "base_model": "sentence-transformers/all-MiniLM-L6-v2",
#   "training_pairs": 636,
#   "domains": 16,
#   "license": "Apache-2.0"
# }

Singleton — for long-running services

from sre_embedding_model import get_model

# Loads once, reuses on every call — safe for SRE agent / FastAPI service
model = get_model()
score = model.similarity(alert_title, runbook_title)

API Reference

Method Description
SREModel() Load model (bundled weights)
model.encode(texts) np.ndarray shape (N, 384)
model.similarity(a, b) float cosine similarity
model.similarity_batch(anchors, candidates) ndarray matrix
model.search(query, docs, top_k=5) [(doc, score)] ranked
model.classify(text, labels) [(label, score)] ranked
model.is_sre_related(text) bool
model.rerank(query, docs) → all docs re-ranked
model.info() → metadata dict
get_model() → singleton SREModel

SRE Domains Covered

Domain Examples
Kubernetes Pod States CrashLoopBackOff, OOMKilled, ImagePullBackOff, Evicted, Pending
Kubernetes Resources HPA, VPA, PVC, ConfigMap, Ingress, NetworkPolicy
Kubernetes Troubleshooting kubectl describe, node pressure, resource limits
Observability p99 latency, error rate, Prometheus, Grafana, alerting
Incident Management MTTR, MTTD, RCA, postmortem, on-call, escalation
APM & Tracing spans, traces, distributed tracing, Jaeger, OpenTelemetry
Splunk SPL queries, HEC, indexes, sourcetypes, dashboards
Java / Spring Boot NullPointerException, BeanCreationException, heap, GC
MySQL deadlock, lock wait timeout, replication lag, slow query
Kafka consumer lag, producer throughput, partition rebalancing
API Gateway rate limiting, circuit breaker, upstream timeout
CI/CD deployment strategies, canary, blue-green, rollback
Cloud Platform EC2, EKS, ECS, auto-scaling, multi-AZ, RTO/RPO
Data Pipelines Kafka streaming, ETL, dead letter queue
Security / SRE mTLS, RBAC, secrets, zero-trust
Error Budget SLO, SLA, burn rate, chaos engineering

Use Cases

  • Alert deduplication — find semantically duplicate alerts
  • Runbook retrieval — match incident description → correct runbook
  • NL→SRE term mapping — "container keeps dying" → CrashLoopBackOff
  • RAG / vector DB — encode SRE docs as dense vectors for retrieval-augmented generation
  • SRE agent — semantic routing in LLM-powered SRE assistants
  • Incident classification — classify incoming tickets by SRE domain

Performance

Metric Base model Fine-tuned
SRE similar pairs (in-distribution) 3/18 pass 18/18 pass
SRE similar pairs (out-of-distribution) 6/21 pass 21/21 pass
Mean cosine on SRE similar pairs 0.312 0.903
Val Spearman ρ -0.263 +0.542

Requirements

sentence-transformers >= 2.2.0
numpy >= 1.21.0

License

Apache License 2.0 — see LICENSE

Base model all-MiniLM-L6-v2 © Microsoft Corporation, Apache 2.0. Fine-tuning, training data, and package © 2026 Senthil Kumar Thanapal.


Author

Senthil Kumar Thanapal · senthilthepro@hotmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sre_embedding_model-1.0.0.tar.gz (83.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sre_embedding_model-1.0.0-py3-none-any.whl (83.6 MB view details)

Uploaded Python 3

File details

Details for the file sre_embedding_model-1.0.0.tar.gz.

File metadata

  • Download URL: sre_embedding_model-1.0.0.tar.gz
  • Upload date:
  • Size: 83.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for sre_embedding_model-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9b42bce497dd8f54a28a12d17c8f7d9de19931852d3d8a76101910f50d2597c0
MD5 80c2911a75f16e3c52d0e0a11f5e8e54
BLAKE2b-256 34738f1d5c33d2603890fcbf8138679f7fc69714e9665b73a45d95d173f8c316

See more details on using hashes here.

File details

Details for the file sre_embedding_model-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sre_embedding_model-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 331acba0710211462cda9adaac17e32916cb3e1a9e69528195a68a851b1f523e
MD5 03789acffd08f1437de59f218ee59a32
BLAKE2b-256 f97916b43b1d20c2fac5505e9953ae9f8151c3c8d4bb90f452aeabe18d550175

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page