As enterprises increasingly adopt generative AI applications powered by large language models (LLMs), the need for robust safety and compliance measures has never been greater. NVIDIA has introduced two key tools to address these challenges: NVIDIA NIM and NVIDIA NeMo Guardrails, according to NVIDIA Technical Blog.
Ensuring Trustworthy AI
NVIDIA NeMo Guardrails provide programmable guardrails designed to ensure the trustworthiness, safety, and security of AI applications. These guardrails help mitigate common vulnerabilities associated with LLMs, ensuring that the AI operates within defined safety parameters.
In addition to building safer applications, NVIDIA emphasizes the importance of a secure, efficient, and scalable deployment process to unlock the full potential of generative AI. This is where NVIDIA NIM comes into play.
Introduction to NVIDIA NIM
NVIDIA NIM offers developers a suite of microservices designed for the secure and reliable deployment of high-performance AI model inferencing across various environments, including data centers, workstations, and the cloud. NIM is part of the NVIDIA AI Enterprise suite, providing industry-standard APIs for quick integration with applications and popular development tools.
Integrating NeMo Guardrails with NIM microservices allows developers to build and deploy controlled LLM applications with enhanced accuracy and performance. NIM supports frameworks like LangChain and LlamaIndex, and it integrates seamlessly with the NeMo Guardrails ecosystem, including third-party and community safety models and guardrails.
Integrating NIM with NeMo Guardrails
To illustrate the integration, the NVIDIA blog provides a detailed guide on deploying two NIM microservices: an NVIDIA NeMo Retriever embedding NIM and an LLM NIM. Both are integrated with NeMo Guardrails to prevent malicious activities, such as user account hacking attempts through queries related to personal data.
The example uses the Meta Llama 3.1 70B Instruct model for the LLM NIM and the NVIDIA Embed QA E5 v5 model for the embedding NIM. The NeMo Retriever embedding NIM converts each input query into an embedding vector, enabling efficient comparison with guardrails policies to ensure that no unauthorized outputs are provided.
Defining the Use Case
The integration demonstrates how to intercept incoming user questions related to personal data using topical rails. These rails ensure that the LLM response adheres to topics that do not share sensitive information. They also perform fact-checking before answering users’ questions, maintaining the integrity and accuracy of the responses.
Setting Up a Guardrailing System with NIM
To set up the guardrails, developers need to ensure that their NeMo Guardrails library is up to date. The configuration involves defining the NIM in a config.yml file and adding dialog rails in a flows.co file. The example script provided by NVIDIA includes dialog rails that greet the user and refuse to respond to queries about sensitive data, thereby protecting user privacy.
Testing the Integration
Testing the integration involves sending queries to the LLM NIM through the guardrails. For instance, a greeting query is intercepted by the guardrails, which respond with a predefined dialog. Queries about hacking into personal accounts are blocked, demonstrating the effectiveness of the guardrails in preventing unauthorized actions.
Conclusion
By integrating NIM microservices with NeMo Guardrails, NVIDIA provides a robust solution for deploying AI models safely and efficiently. This integration ensures that AI applications adhere to safety and compliance standards, protecting against misuse and enhancing trustworthiness.
Developers can explore the full tutorial and additional resources on the NVIDIA GitHub page. For a more comprehensive guardrailing system, NVIDIA recommends checking out the NeMo Guardrails Library and experimenting with various types of rails to customize different use cases.
Image source: Shutterstock