General questions
What is PAS2?
What is PAS2?
PAS2 (Paraphrase-based AI System for Semantic Similarity) is a sophisticated system for detecting hallucinations in AI responses. It uses a paraphrase-based approach with model-as-judge verification to identify factual inconsistencies in LLM outputs.
How does PAS2 detect hallucinations?
How does PAS2 detect hallucinations?
PAS2 works in three main steps:
- Query processing: Your question is paraphrased multiple ways, each version is sent to Mistral Large, and responses are collected and compared
- Hallucination detection: OpenAI’s o3-mini analyzes responses, identifies factual inconsistencies, and provides confidence scores and reasoning
- Feedback collection: User feedback is stored in a SQLite database with persistent storage to ensure data survival
What models does PAS2 use?
What models does PAS2 use?
PAS2 uses a multi-model architecture:
- Mistral Large: For generating responses to queries
- OpenAI’s o3-mini: As a judge for hallucination detection
- Default model: gpt-4-2024-08-06
- Default embedding model: text-embedding-3-small
Setup and installation
What are the prerequisites for using PAS2?
What are the prerequisites for using PAS2?
You need:
- Python 3.x installed
- API keys for Mistral AI (
HF_MISTRAL_API_KEY) - API keys for OpenAI (
HF_OPENAI_API_KEY) - Dependencies installed via
pip install -r requirements.txt
How do I set up my API keys?
How do I set up my API keys?
You can set up API keys in two ways:
-
Environment variables:
- Set
HF_MISTRAL_API_KEYfor your Mistral AI API key - Set
HF_OPENAI_API_KEYfor your OpenAI API key
- Set
-
.envfile:
Can I deploy PAS2 on Hugging Face Spaces?
Can I deploy PAS2 on Hugging Face Spaces?
Yes! To deploy on Hugging Face Spaces:
- Create a new Space on Hugging Face
- Select “Gradio” as the SDK
- Add your repository
- Set the secrets
HF_MISTRAL_API_KEYandHF_OPENAI_API_KEYin your Space’s settings
/data directory) to maintain feedback data between restarts.Usage
How do I run the web interface?
How do I run the web interface?
Run the Gradio interface with:Then:
- Enter a factual question or select from example queries
- Click “Detect Hallucinations” to start the analysis
- Review the detailed results including hallucination status, confidence score, and reasoning
- Provide feedback to help improve the system
How do I use PAS2 as a library?
How do I use PAS2 as a library?
You can use PAS2 programmatically:
Can I run benchmarks with PAS2?
Can I run benchmarks with PAS2?
Yes! Run the benchmark tool:This allows bulk evaluation of queries for testing and analysis purposes.
What output files does PAS2 generate?
What output files does PAS2 generate?
PAS2 can generate:
- Similarity matrix plots (PNG)
- Match matrix plots (PNG)
- Benchmark results (CSV, TXT)
- User feedback logs (XLSX)
Configuration
Can I adjust the detection thresholds?
Can I adjust the detection thresholds?
Yes! PAS2 has adjustable parameters:
- Similarity threshold: Controls semantic similarity matching
- Match percentage threshold: Controls the percentage of responses that must match
- Number of paraphrases: Controls how many variations are generated (default: 5)
Where is data stored?
Where is data stored?
PAS2 uses SQLite for data storage:
- In Hugging Face Spaces: Uses the persistent
/datadirectory - Local deployment: Database file stored in the application directory
- Feedback data survives restarts and preserves statistics long-term
License and attribution
What license does PAS2 use?
What license does PAS2 use?
PAS2 is licensed under the MIT License with an attribution requirement. You are free to use, modify, and distribute the software, but must provide appropriate attribution to the original author.
How do I cite PAS2 in my research?
How do I cite PAS2 in my research?
If you use PAS2 in your research or project, please cite it as:You must also:
- Include the copyright notice and license in any copy or substantial portion of the software
- Cite the project in any publications, presentations, or documentation
- Maintain a link to the original repository in any forks or derivative works
Support
How do I get help or report issues?
How do I get help or report issues?
For questions, issues, or collaboration:
- GitHub: https://github.com/serhanylmz/pas2
- Email: [email protected]
- Institution: Sabanci University
Can I contribute to PAS2?
Can I contribute to PAS2?
Yes! Contributions are welcome. Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request