Triplex
SciPhiIntroduction
Triplex is a state-of-the-art language model designed for efficient knowledge graph construction. It significantly reduces the cost of building knowledge graphs by 98% compared to traditional methods, outperforming models like GPT-4 at 1/60th the cost. Triplex is a fine-tuned version of the Phi3-3.8B model, developed by SciPhi.AI, and is capable of extracting triplets—simple statements comprising a subject, predicate, and object—from unstructured data.
Architecture
Triplex operates by extracting knowledge graph triplets from text using Named Entity Recognition (NER) to identify entities and their relationships. It is optimized for local graph building and is integrated with SciPhi's R2R framework.
Training
Triplex is fine-tuned from the base Phi3-3.8B model. It has been trained to perform NER and extract knowledge graph triplets, focusing on reducing the computational cost while increasing efficiency and accuracy in knowledge graph construction.
Guide: Running Locally
To run Triplex locally, follow these steps:
- Install dependencies: Ensure you have Python and the Hugging Face
transformers
library installed. - Load the model and tokenizer:
from transformers import AutoModelForCausalLM, AutoTokenizer model = AutoModelForCausalLM.from_pretrained("sciphi/triplex", trust_remote_code=True).to('cuda').eval() tokenizer = AutoTokenizer.from_pretrained("sciphi/triplex", trust_remote_code=True)
- Prepare your input: Define entity types and predicates, and input your text.
- Extract triplets: Use the
triplextract
function to process your text and extract knowledge graph triplets. - Run on GPU: For optimal performance, it is recommended to utilize cloud GPUs such as those offered by AWS, Google Cloud, or Azure.
License
Triplex is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (cc-by-nc-sa-4.0) license. The model weights are freely available for research and personal use, with commercial restrictions applied. Organizations with under $5M USD in gross revenue may use the model commercially; otherwise, inquiries for commercial usage should be directed to founders@sciphi.ai
.