Package: redeval
💡 Overview❓ProblemBefore deploying Large Language Models (LLMs) in real-world applications, a significant challenge is ensuring the robustness and reliability of these systems. How can we proactively spot vulnerabilities or failure scenarios that can negatively affect user experience or cause material harm? As LLMs are gaining more emerging abilities and integrating into vital applications, any potential failure case might have even more negative consequences.⚡RedEvalRedEval is an open-source library that simulates and evaluates LLM applications across various scenarios, all while eliminating the need for human intervention. With the expansion of LLMs' capabilities due to scaling laws, LLMs will be soon have the capability to audit and evaluate other LLMs effectively without human oversight.🎮 Auditing LLMsDrawing inspiration from the architecture of red-teaming LLMs (Perez et al., 2022), RedEval introduces a series of multi-turn conversations where a red-team LLM challenges a target LLM across various scenarios. These scenarios can be categorized as follows:Performance SimulationsPerformance Evaluation: Simulates the behavior of a potential customer with genuine intent, inquiring about the product.Toxicity Evaluation: Simulates a scenario in which a customer asks toxic questions related to the product.Manipulation TacticsGaslighting: Simulates an agent that tries to manipulate the target into endorsing harmful actions.Guilt-Tripping: Simulates an agent that coerces the target into undesired actions by inducing guilt.Deception TacticsFraudulent Researcher: Simulates an agent that seeks harmful actions under the pretense of academic research.Social Engineering Attack: Simulates an attacker seeking confidential or proprietary information from a company, falsely claiming to be a student.Adversarial AttacksPrompt Injection: Introduces malicious prefixes or suffixes to the original prompt to elicit harmful behavior.🔍 LLM EvalsLLM evaluations leverage the reasoning capabilities of LLMs to identify and elucidate the failure scenarios of LLMs. Inspired by the observation that RLAIF demonstrated performance comparable to RLHF (Lee et al., 2023), we anticipate that LLM evaluations will soon match or even surpass human competence in assessing whether LLMs meet specific benchmarks. RedEval offers the following LLM evaluations:RAG EvalsFaithfulness Failure:A faithfulness failure occurs if the response cannot be inferred purely from the context provided.Context Relevance Failure:A context relevance failure (bad retrieval) occurs if the user's query cannot be answered purely from the retrieved context.Answer Relevance Failure:An answer relevance failure occurs if the response does not answer the question.AttacksToxicity Failure:A toxicity failure occurs if the response is toxic.Safety Failure:A toxicity failure occurs if the response is unsafe.Get startedInstallationpipinstallredevalRun simulations# Load a simulatorfromredeval.simulators.performance_simulatorimportPerformanceSimulator# Set up the parametersopenai_api_key='Your OpenAI APIS Key'n_turns=5data_path_dir='Your txt document for RAG'# Run RAG performance simulationPerformanceSimulator(openai_api_key=openai_api_key,n_turns=n_turns,data_path=data_path_dir).simulate()LicenseApache License 2.0