Collect representative telemetry
Ingest structured logs, prompts, response metadata and resource metrics, and align timestamps and request identifiers for analysis.
LLM security testing harness. Inspect anomaly signals.
An LLM security testing harness organises telemetry and labelled checks to find risky model behaviour, prompt-based attacks and anomalous infrastructure events. Key challenges include scarce labelled attack examples, adversarial inputs that mimic normal behaviour, class imbalance, and the need to tune for high recall while keeping analyst false positives manageable.
Learning concept · Not a validated service
An LLM security testing harness organises telemetry and labelled checks to find risky model behaviour, prompt-based attacks and anomalous infrastructure events. Key challenges include scarce labelled attack examples, adversarial inputs that mimic normal behaviour, class imbalance, and the need to tune for high recall while keeping analyst false positives manageable.
A proposed extension: flag unusual LLM-serving telemetry and prompt-response patterns to surface potential jailbreaks, data exfiltration or unauthorised use. Human analysts should review alerts before taking action; this starter does not deliver a production-ready monitoring pipeline.
Ingest structured logs, prompts, response metadata and resource metrics, and align timestamps and request identifiers for analysis.
Create labelled examples from red-team prompts and synthetic traces so models learn realistic attack patterns and not only synthetic outliers.
Start with lightweight unsupervised detectors such as IsolationForest on numeric telemetry, then compare with supervised classifiers when labels are available.
Measure recall, precision and false positive rate on hold-out or red-team data and tune thresholds to suit analyst capacity.
The supplied starter synthesises numeric 'normal' and 'suspicious' telemetry, concatenates them, fits an IsolationForest (contamination=0.05) and marks rows predicted as anomalies. It does not use any LLM prompts, model outputs or labelled security incident data, and it only prints the number of alerts and their first rows.
logs = pd.concat([normal, suspicious], ignore_index=True)
detector = IsolationForest(contamination=0.05, random_state=42)
logs["anomaly_score"] = detector.fit_predict(logs)
alerts = logs[logs["anomaly_score"] == -1]
The starter uses synthetic numeric features and an IsolationForest on those features only; it contains no LLM prompt or response data, no labelled security incidents, no evaluation on a hold-out set, and no alerting or audit trail. The tiny synthetic 'suspicious' set does not represent real attack variability and cannot validate operational performance.
A proposed extension: collect LLM prompts, responses, user/session metadata and resource metrics; derive features (token patterns, response length, abnormal rate limits), train supervised detectors with red-team labels, and expose triage tools for analysts to review and label alerts.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its Cybersecurity Course, with placement support and hands-on labs.