Habr AI→ original

MTS Opens AVI Code: Smart Firewall for LLM That Learns New Rules in Seconds

MTS AI published on GitHub the AVI service (Aligned/Agreement Validation Interface) — an external modular firewall for language models. The input filter blocks prompt attacks, while the output filter checks responses for toxicity and legal violations. Key feature: new rules are added with a single natural language phrase — without retraining the model. Code written in Python/FastAPI with a RAG module and monitoring via Prometheus and Grafana.

AI-processed from Habr AI; edited by Hamidun News
MTS Opens AVI Code: Smart Firewall for LLM That Learns New Rules in Seconds
Source: Habr AI. Collage: Hamidun News.
◐ Listen to article

MTS released an open service AVI — a solution for safe AI implementation in companies. It's a filter for language models (LLM) that controls requests and responses without changing model weights.

What is AVI and how it works

AVI is a two-level "smart firewall" between the user and the language model. The input filter intercepts prompt attacks and unwanted requests before they reach the model. The output filter checks the already-generated answer: evaluates toxicity, compliance with legislation and ethical standards.

Key components of the published solution:

  • Python and FastAPI service — the foundation of the architecture
  • RAG module for contextual rule verification
  • Docker build with complete monitoring stack: Prometheus, Grafana, Jaeger
  • Tools for reproducing experiments on FinanceBench
  • Scientific description published in the peer-reviewed MDPI.Electronics journal

The system's distinctive feature is in how new rules are added. Instead of editing configs or retraining the model, a new filter is set with a single phrase in natural language. The RAG module picks it up and applies it on the next check.

Why it's better to filter outside than retrain

The standard way to make a language model "law-abiding" is to fine-tune it via RLHF or fine-tuning. This is expensive, takes weeks, and requires a full cycle again with every requirement change: a new regulatory act is released or company policy changes — retrain.

AVI offers a fundamentally different approach: the filter lives outside the model and processes traffic as a proxy layer. Need to ban discussions of competitors? Just add a rule to the config. Need to account for 152-FZ or GDPR requirements? Same. The model itself remains untouched.

"AVI works like a smart firewall for LLM: deflects prompt attacks on

input, checks answers for toxicity, ethics and law violations on output," — the authors describe the concept.

The authors claim this approach yields tangible savings. For companies in regulated industries — banks, telecom, healthcare — this is a potential savings of months of ML team work: instead of retraining, simply update the filter rule set.

What tests on FinanceBench showed

The team tested the system on FinanceBench — a standard set of financial questions requiring precise and legally correct answers. Results are published in the peer-reviewed journal MDPI.Electronics.

Detailed accuracy metrics are available in the full text of the scientific paper in English. The fact of publication in a peer-reviewed journal and open code release means the system passed independent verification, rather than remaining an internal company tool.

What this means

MTS is opening a practical tool for everyone deploying LLM in production environments with strict content requirements. The "firewall instead of retraining" approach could become the standard for corporate AI deployments — especially where regulatory requirements change faster than model retraining cycles.

Frequently asked questions

Does AVI work with any language model?

Yes — the filter is independent of any specific model's architecture or weights. AVI connects as a proxy layer and can work with any LLM service.

What's included in the published repository?

The repository includes a Python/FastAPI backend, RAG module for working with rules in natural language, Docker build with monitoring via Prometheus, Grafana and Jaeger, as well as tools for reproducing experiments on FinanceBench.

What is AVI and how does it protect AI?

AVI is a two-level filter for language models. The input filter intercepts dangerous queries before they reach the model. The output filter checks generated answers for compliance with legislation and ethical standards.

ZK
Hamidun News
AI news without noise. Daily editorial selection from 50+ sources. A product by Zhemal Khamidun, Head of AI at Alpina Digital.

Want to stop reading about AI and start using it?

AI News is a curated feed of AI/tech news. Hamidun Academy teaches you to use AI systematically in your work.

What do you think?
Loading comments…