monarch-initiative/ontogpt

LLM-based ontological extraction tools, including SPIRES

What it solves

OntoGPT addresses the problem of LLM hallucinations and inefficiency when extracting structured data from text. Specifically, it prevents models from inventing fake ontology identifiers or failing to adhere to complex data schemas that are too large to fit in a standard prompt context window.

How it works

OntoGPT uses a combination of instruction prompts and ontology-based grounding. Instead of asking the LLM for identifiers, it asks for names and then uses OAK (Ontology Access Kit) annotators to ground those names against actual ontologies, validating every identifier against its source. To handle large schemas, it employs the SPIRES method, which recursively walks a LinkML schema, prompting the model for one class at a time to ensure the output conforms to the full schema without overloading the context window.

Who it’s for

It is designed for researchers and developers who need to extract high-fidelity, structured biological or technical knowledge from large volumes of text (such as scientific papers) and ensure that the extracted data is grounded in existing, authoritative ontologies.

Highlights

  • Hallucination-free grounding: Validates all identifiers against source ontologies, marking ungroundable terms with an AUTO: prefix.
  • Recursive schema walking: Uses the SPIRES method to handle complex data models without loading the entire schema into the prompt.
  • Batch processing: Supports repeatable extraction over thousands of documents with output formats including YAML, JSON, RDF, and OWL.
  • Broad model support: Interfaces with various LLM providers (OpenAI, Anthropic, Mistral, etc.) via LiteLLM and supports local models via Ollama.
  • Agent integration: Includes "Agent Skills" that allow AI coding agents to perform extractions and manage templates.

Related

  • Project
  • Project
  • Project
  • Project