DSL-based Safety Guardrails for LLM Applications


LLM-based applications need safety checks, for example on prompts, generated outputs, or tool calls. Today, these checks - if done so - are implemented in ad hoc if a problem is detected. This makes them hard to reuse, maintain, and reason about.

Tasks:

  • Requirements Analysis: Analyze requirements for runtime safety guardrails in LLM applications.
  • DSL Design: Design a domain-specific language (DSL) for specifying guardrails.
  • Implementation: Implement a Python library for request interception and guardrail enforcement.
  • Enforcement Actions: Define and support a set of enforcement actions such as block, rewrite, retry, and log.
  • Evaluation: Evaluate the approach using representative example use cases.

Thesis Goal The goal of this thesis is to design and implement a Python library, inspired by LMQL, that provides a small DSL for specifying safety guardrails. LLM requests should be routed through the library, which evaluates and enforces the guardrails at runtime.

Supvervision

This thesis will be co-supervised by Philipp Zech and Michael Vierhauser.