Factool

FacTool, developed by GAIR-NLP, is a tool designed to detect factuality in generative artificial intelligence. The tool is hosted on GitHub, allowing users to c...

Last verified:

Visit Factool

What is Factool?

Factool (FacTool) is a tool-augmented framework for detecting factual errors in texts generated by large language models like ChatGPT. It is task and domain agnostic, meaning it works across various scenarios without requiring retraining for specific domains. The framework leverages external APIs and tools to verify claims, provide evidence, and generate factuality scores at both claim-level and response-level.

Factool supports four key tasks: knowledge-based QA (detecting factual errors in QA responses), code generation (detecting execution errors), mathematical reasoning (detecting calculation errors), and scientific literature review (detecting hallucinated scientific citations). For each task, it extracts claims from the LLM response, generates search queries or test cases, retrieves evidence from external sources, and produces detailed factuality assessments with reasoning, error identification, and corrections.

The tool is designed for AI researchers, developers working with large language models, and anyone who needs to verify the factuality of AI-generated content. It provides a Factuality Leaderboard that evaluates different chatbots (GPT-4, ChatGPT, Claude, Bard, Vicuna) on their factual accuracy. Users can install it via pip for general use or clone the repository for development, and it includes a ChatGPT plugin integration for direct use within the ChatGPT interface.

Factool pricing

Pricing model: Free

Factool is free and open-source under the Apache-2.0 license, which allows for free use, modification, and distribution. However, users must obtain their own API keys from third-party services: OpenAI API key (required for all tasks), Serper API key (required only for knowledge-based QA), and Scraper API key (required only for scientific literature review). These API services may have their own pricing structures.

Factool pros

  • Detects factual errors in knowledge-based QA responses
  • Detects execution errors in code generation
  • Detects calculation errors in mathematical reasoning
  • Detects hallucinated scientific literature citations
  • Task and domain agnostic framework
  • Provides claim-level and response-level factuality scores
  • Generates detailed reasoning for factuality decisions
  • Identifies specific errors and provides corrections
  • Includes Factuality Leaderboard for chatbot comparison
  • Open-source under Apache-2.0 license
  • ChatGPT plugin integration available
  • Supports both gpt-3.5-turbo and gpt-4 foundation models
  • Provides example inputs and usage code
  • Includes datasets for testing
  • Automates the fact-checking process
  • Retrieves evidence with source links
  • Works with multiple API keys (OpenAI, Serper, Scraper)
  • Easy pip installation for general users
  • Detailed documentation for each task

Factool cons

  • Requires OpenAI API key for all tasks
  • Requires Serper API key for knowledge-based QA
  • Requires Scraper API key for scientific literature review
  • No official releases published yet
  • No packages published on GitHub
  • Only 5 contributors to the project
  • May require coding knowledge for developer installation
  • Potential security vulnerability found in code
  • Limited documentation beyond code examples

Frequently asked questions about Factool

What is Factool?

Factool (FacTool) is a tool-augmented framework for detecting factual errors in texts generated by large language models like ChatGPT. It is task and domain agnostic and supports four tasks: knowledge-based QA, code generation, mathematical reasoning, and scientific literature review.

What tasks does Factool support?

Factool supports four tasks: knowledge-based QA (detecting factual errors in knowledge-based QA), code generation (detecting execution errors), mathematical reasoning (detecting calculation errors), and scientific literature review (detecting hallucinated scientific literatures).

How do I install Factool?

For general users, install with 'pip install factool'. For developers, clone the repository with 'git clone [email protected]:GAIR-NLP/factool.git', then cd into the factool directory and run 'pip install -e .'.

What API keys do I need for Factool?

You need an OpenAI API key for all tasks. For knowledge-based QA only, you also need a Serper API key. For scientific literature review only, you need a Scraper API key.

What foundation models does Factool support?

Factool supports two foundation models: gpt-3.5-turbo and gpt-4. You can initialize the Factool instance with either model by passing it as a parameter.

What output format does Factool provide?

Factool returns average_claim_level_factuality, average_response_level_factuality, and detailed_information containing claims, queries, evidences, claim_level_factuality with reasoning/error/correction/factuality for each claim, and response_level_factuality.

Does Factool have a ChatGPT plugin?

Yes, Factool includes a ChatGPT plugin integration. Users can export API keys, install the package, git clone the repo, navigate to plugin_config, run the API locally with uvicorn, and then enter the plugin store to develop their own plugin using the localhost domain.

What is the Factuality Leaderboard?

The Factuality Leaderboard shows the factual accuracy of different chatbots evaluated by Factool. GPT-4 leads with 75.60% weighted claim-level accuracy and 43.33% response-level accuracy, followed by ChatGPT (68.63%/36.67%), Claude-v1 (63.95%/26.67%), Bard (61.15%/33.33%), and Vicuna-13B (50.35%/21.67%).

What license does Factool use?

Factool operates under the Apache-2.0 license, which allows for free use, modification, and distribution of the tool provided the conditions stipulated in the license are met.

How does Factool detect factual errors in scientific literature?

For scientific literature review, Factool extracts paper citations from the response (title, author, publication year), generates search queries for each paper, retrieves evidence from external sources, and compares the generated citation details against actual paper information to identify errors like wrong author, wrong title, or wrong publication year.

Categories

Use cases

Browse all AI tools on NeedAnAI