This model is a fully fine-tuned version of
google-t5/t5-3b. It was trained to translate
natural language statements into First-Order Logic (FOL) representations.
This model is designed to translate natural language (NL) sentences into corresponding first-order logic (FOL) expressions. Use cases include:
Users should verify and validate symbolic formulas generated by the model for correctness depending on the application.
This model can be further fine-tuned or adapted for domain-specific formalization tasks (e.g., legal, biomedical). Suitable for interactive systems requiring formal reasoning.
1import torch
2from transformers import T5Tokenizer, T5ForConditionalGeneration
3
4# Load tokenizer and model
5model_path = "fvossel/t5-3b-nl-to-fol"
6tokenizer = T5Tokenizer.from_pretrained(model_path)
7model = T5ForConditionalGeneration.from_pretrained(model_path).to("cuda")
8
9# Example NL input
10nl_input = "All dogs are animals."
11
12# Preprocess prompt
13input_text = "translate English natural language statements into first-order logic (FOL): " + nl_input
14inputs = tokenizer(input_text, return_tensors="pt", padding=True).to("cuda")
15
16# Generate prediction
17with torch.no_grad():
18 outputs = model.generate(
19 inputs["input_ids"],
20 max_length=256,
21 min_length=1,
22 num_beams=5,
23 length_penalty=2.0,
24 early_stopping=True,
25 )
26
27# Decode and print result
28print(tokenizer.decode(outputs[0], skip_special_tokens=True))
The model was fine-tuned on the
groves dataset.