--- library_name: transformers license: mit tags: - verifcation - policy_compliance - factchecking - instruction_following - safeguards - guardrail - guard - hallucination base_model: - akjindal53244/Llama-3.1-Storm-8B --- # NAVI verifiers (Verification Intelligence) NAVI (Verification Intelligence) is a hallucination detection safety model primarily for policy alignment verifications. It is designed to review various types of text against documents and policies, and identify violating content. It is specifically optimized for enterprise applications requiring compliance verification for automated text generation. To push policy verification in the open-source community, we release NAVI-small-preview, an open-weights version of the model we have deployed on the platform. NAVI-small-preview is centered around verifying specifically assitant outputs against some policy documents. The full solution is available through [NAVI platform and API](https://naviml.com/). - **Developed by:** Nace.AI - **Model type:** Safety model, Policy Alignment Verifier - **Language(s) (NLP):** English - **License:** MIT - **Finetuned from model:** akjindal53244/Llama-3.1-Storm-8B ## Uses ### Direct Use NAVI-small-preview is used for verifying chatbot/assistant/agents outputs with company policy documents. It processes policies and identifies any contradictions, inconsistencies and violations. ### Downstream Use Policy checks for accuracy critical LLM Apps. Good suite for Enterprise Environment. ### Out-of-Scope Use NAVI is not designed for general-purpose factuality verification or tasks unrelated to policy compliance. ## Bias, Risks, and Limitations While NAVI excels in policy compliance verification, it may face challenges with unrealistic policy scenarios or contexts outside its training data scope. ### Recommendations We recommend to use the model only as a generative classifier outputting the class label, any other outputs are not accounted for during training. ## How to Get Started with the Model The verifier takes the assistant response and document context as inputs to generate a classification label. There are three possible classes: Compliant, Noncompliant, and Irrelevant. For long enterprise documents, we recommend setting up chunk-based vector search for selecting most relevant chunks from the document. For inferencing the model we recommend using vLLM==0.6.3.post1, inferencing with Transformers gives suboptimal performance. Below are the prompts and sample code to launch: ```python from transformers import AutoTokenizer from vllm import LLM, SamplingParams from vllm.lora.request import LoRARequest tokenizer = AutoTokenizer.from_pretrained( 'akjindal53244/Llama-3.1-Storm-8B', padding_side="left") llm = LLM(model='akjindal53244/Llama-3.1-Storm-8B', enable_lora=True, max_model_len=4096, max_lora_rank=16, seed=42) lora_request = LoRARequest( 'navi-small-preview', 1, lora_path='nace-ai/navi-small-preview') sampling_params = SamplingParams( temperature=0.0, max_tokens=3, stop=["<|eot_id|>"] ) template = """Determine if the given passage adheres strictly to the provided policy. Respond with one word: Compliant or Noncompliant. Don't output anything else or use any other words. Deduct where the passage violates the policy with one word: Noncompliant or Compliant. {context} - Passage: {response} - Label:""" context = "The return policy is 90 days, except for electronics, which is 30 days." response = "The return policy is 90 days for all items." messages = [{'role': 'user', 'content': template.format(context=context, response=response)}] formatted_input = target_tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) output = llm.generate([formatted_input], sampling_params, lora_request=lora_request)[0] print(output.outputs[0].text) ``` ```text Noncompliant ``` For simplified handling of long documents we suggest implementing vector search among document chunks and including top 5 enumerated policy chunks. ## Training Details ### Training Data NAVI was trained on a mix of real-world policy documents and synthetic interactions between a user and an assistant, it includes diverse, realistic, and complex policy examples across multiple industries. ### Training Procedure #### Preprocessing NAVI utilizes latest advances in Knowledge Augmentation and Memory in order to internatlize document knowledge. However, NAVI-small-preview was trained to be able to work with simple vector retrieval. #### Training Hyperparameters - **Training regime:** We have trained the Lora adapter using all linear modules for all Transformer layers with rank 16, alpha 32, learning rate 5e-5, effective batch size 32. Trained on 8 A100s for 6 epochs under 3 hours using Pytorch Distributed Data Parallel. ## Evaluation ### Testing Data, Factors & Metrics #### Testing Data We have manually collected Policy Alignment Verification (PAV) dataset consisting of across different use cases for evaluation. We open source the public subset of the dataset. Here we diclose the performance on the public subset, containing 125 examples across six industry-specific scenarios: AT&T, Airbnb, Cadence Bank, Delta Airlines, Verisk, and Walgreens. #### Factors Evaluation focuses on policy compliance within multi-policy, multi-document contexts. #### Metrics F1 score was used to measure performance, prioritizing detection of noncompliance cases. ### Results NAVI-small-preview achieved an F1 score of 86.8% on public subset of PAV dataset, outperforming all tested alternatives except full-scale NAVI. We evaluate against general-purpose solutions like Claude and Open AI models, as well as some guardrails focusing on groundedness to demonstrate a clear distinction of policy verification from the more common groundedness verification. | Model | F1 Score | Avg Latency (ms) | |--------------------------|----------|------------------| | NAVI-small-preview | 86.8 | - | | NAVI | 90.4 | 387.62 | | AWS Bedrock Guardrail | 76.5 | 342.79 | | Azure Groundedness | 71.2 | 232.71 | | NeMo (GPT-4o) | 71.2 | 2669.68 | | GPT-4o (few-shot) | 75.0 | 904.46 | | Sonnet 3.5 (few-shot) | 75.5 | 2926.69 | ## Model Card Contact [NAVI Contact Page](https://naviml.com/contact)