Guideline following Large Language Model for Information Extraction
Model Card for GoLLIE 13B
We present GoLLIE, a Large Language Model trained to follow annotation guidelines. GoLLIE outperforms previous approaches on zero-shot Information Extraction and allows the user to perform inferences with annotation schemas defined on the fly. Different from previous approaches, GoLLIE is able to follow detailed definitions and does not only rely on the knowledge already encoded in the LLM.
License: LLaMA2 License for the base and merged model. Apache 2.0 for pre-trained LoRA Adapters
Finetuned from model: CODE-LLaMA2
Schema definition and inference example
The labels are represented as Python classes, and the guidelines or instructions are introduced as docstrings. The model start generating after the result = [ line.
Python
1# Entity definitions
2@dataclass
3class Launcher(Template):
4 """Refers to a vehicle designed primarily to transport payloads from the Earth's
5 surface to space. Launchers can carry various payloads, including satellites,
6 crewed spacecraft, and cargo, into various orbits or even beyond Earth's orbit.
7 They are usually multi-stage vehicles that use rocket engines for propulsion."""
89 mention: str
10 """
11 The name of the launcher vehicle.
12 Such as: "Sturn V", "Atlas V", "Soyuz", "Ariane 5"
13 """
14 space_company: str # The company that operates the launcher. Such as: "Blue origin", "ESA", "Boeing", "ISRO", "Northrop Grumman", "Arianespace"
15 crew: List[str] # Names of the crew members boarding the Launcher. Such as: "Neil Armstrong", "Michael Collins", "Buzz Aldrin"
161718@dataclass
19class Mission(Template):
20 """Any planned or accomplished journey beyond Earth's atmosphere with specific objectives,
21 either crewed or uncrewed. It includes missions to satellites, the International
22 Space Station (ISS), other celestial bodies, and deep space."""
2324 mention: str
25 """
26 The name of the mission.
27 Such as: "Apollo 11", "Artemis", "Mercury"
28 """
29 date: str # The start date of the mission
30 departure: str # The place from which the vehicle will be launched. Such as: "Florida", "Houston", "French Guiana"
31 destination: str # The place or planet to which the launcher will be sent. Such as "Moon", "low-orbit", "Saturn"
3233# This is the text to analyze
34text = (
35 "The Ares 3 mission to Mars is scheduled for 2032. The Starship rocket build by SpaceX will take off from Boca Chica,"
36 "carrying the astronauts Max Rutherford, Elena Soto, and Jake Martinez."
37)
3839# The annotation instances that take place in the text above are listed here
40result = [
41 Mission(mention='Ares 3', date='2032', departure='Boca Chica', destination='Mars'),
42 Launcher(mention='Starship', space_company='SpaceX', crew=['Max Rutherford', 'Elena Soto', 'Jake Martinez'])
43]
The best way to load the model is using our custom load_model fuction. However, you can also load them using the AutoModelForCausalLM class.
Important: Our flash attention implementation has small numerical differences compared to the attention implementation in Huggingface.
You must use the flag trust_remote_code=True or you will get inferior results. Flash attention requires an available CUDA GPU. Running GOLLIE
pre-trained models on a CPU is not supported. We plan to address this in future releases. First, install flash attention 2:
Read our 🚀 Example Jupyter Notebooks to learn how to easily define guidelines, generate model inputs and parse the output!
Training Data
This is the list of task used for training and evaluating GoLLIE. However, as demonstrated in the 🚀 Create Custom Task notebook GoLLIE can perform a wide range of unseen tasks.
For more info, read our 📖Paper.
@misc{sainz2023gollie,
title={GoLLIE: Annotation Guidelines improve Zero-Shot Information-Extraction},
author={Oscar Sainz and Iker García-Ferrero and Rodrigo Agerri and Oier Lopez de Lacalle and German Rigau and Eneko Agirre},
year={2023},
eprint={2310.03668},
archivePrefix={arXiv},
primaryClass={cs.CL}
}