Jellyfish-8B is a large language model equipped with 8 billion parameters.
We fine-tuned the Meta-Llama-3-8B-Instruct model using a subset of the Jellyfish-Instruct dataset.
More details about the model can be found in the Jellyfish paper.
Developed by: Haochen Zhang, Yuyang Dong, Chuan Xiao, Masafumi Oyamada
If you find our work useful, please give us credit by citing:
@article{zhang2023jellyfish,
title={Jellyfish: A Large Language Model for Data Preprocessing},
author={Zhang, Haochen and Dong, Yuyang and Xiao, Chuan and Oyamada, Masafumi},
journal={arXiv preprint arXiv:2312.01678},
year={2023}
}
Performance on seen tasks
Task
Type
Dataset
Non-LLM SoTA1
GPT-3.52
GPT-42
GPT-4o
Table-GPT
Jellyfish-7B
Jellyfish-8B
Jellyfish-13B
Error Detection
Seen
Adult
99.10
99.10
92.01
83.58
--
77.40
73.74
99.33
Error Detection
Seen
Hospital
94.40
97.80
90.74
44.76
--
94.51
93.40
95.59
Error Detection
Unseen
Flights
81.00
--
83.48
66.01
--
69.15
66.21
82.52
Error Detection
Unseen
Rayyan
79.00
--
81.95
68.53
--
75.07
81.06
90.65
Data Imputation
Seen
Buy
96.50
98.50
100
100
--
98.46
98.46
100
Data Imputation
Seen
Restaurant
77.20
88.40
97.67
90.70
--
89.53
87.21
89.53
Data Imputation
Unseen
Flipkart
68.00
--
89.94
83.20
--
87.14
87.48
81.68
Data Imputation
Unseen
Phone
86.70
--
90.79
86.78
--
86.52
85.68
87.21
Schema Matching
Seen
MIMIC-III
20.00
--
40.00
29.41
--
53.33
45.45
40.00
Schema Matching
Seen
Synthea
38.50
45.20
66.67
6.56
--
55.56
47.06
56.00
Schema Matching
Unseen
CMS
50.00
--
19.35
22.22
--
42.86
38.10
59.29
Entity Matching
Seen
Amazon-Google
75.58
63.50
74.21
70.91
70.10
81.69
81.42
81.34
Entity Matching
Seen
Beer
94.37
100
100
90.32
96.30
100.00
100.00
96.77
Entity Matching
Seen
DBLP-ACM
98.99
96.60
97.44
95.87
93.80
98.65
98.77
98.98
Entity Matching
Seen
DBLP-GoogleScholar
95.70
83.80
91.87
90.45
92.40
94.88
95.03
98.51
Entity Matching
Seen
Fodors-Zagats
100
100
100
93.62
100
100
100
100
Entity Matching
Seen
iTunes-Amazon
97.06
98.20
100
98.18
94.30
96.30
96.30
98.11
Entity Matching
Unseen
Abt-Buy
89.33
--
92.77
78.73
--
86.06
88.84
89.58
Entity Matching
Unseen
Walmart-Amazon
86.89
87.00
90.27
79.19
82.40
84.91
85.24
89.42
Avg
80.44
-
84.17
72.58
-
82.74
81.55
86.02
For GPT-3.5 and GPT-4, we used the few-shot approach on all datasets. For Jellyfish models, the few-shot approach is disabled on seen datasets and enabled on unseen datasets. Accuracy as the metric for data imputation and the F1 score for other tasks.
We used LoRA to speed up the training process, targeting the q_proj, k_proj, v_proj, and o_proj modules.
Uses
To accelerate the inference, we strongly recommend running Jellyfish using vLLM.
Python Script
We provide two simple Python code examples for inference using the Jellyfish model.
Using Transformers and Torch Modules
python
1from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
2import torch
34if torch.cuda.is_available():5 device ="cuda"6else:7 device ="cpu"89# Model will be automatically downloaded from HuggingFace model hub if not cached.10# Model files will be cached in "~/.cache/huggingface/hub/models--NECOUDBFM--Jellyfish/" by default.11# You can also download the model manually and replace the model name with the path to the model files.12model = AutoModelForCausalLM.from_pretrained(13"NECOUDBFM/Jellyfish",14 torch_dtype=torch.float16,15 device_map="auto",16)17tokenizer = AutoTokenizer.from_pretrained("NECOUDBFM/Jellyfish")1819system_message ="You are an AI assistant that follows instruction extremely well. Help as much as you can."2021# You need to define the user_message variable based on the task and the data you want to test on.22user_message ="Hello, world."2324prompt =f"<|start_header_id|>system<|end_header_id|>{system message}<|eot_id|>\n<|start_header_id|>user<|end_header_id|>{user_message}<|eot_id|>\n<|start_header_id|>assistant<|end_header_id|>"25inputs = tokenizer(prompt, return_tensors="pt")26input_ids = inputs["input_ids"].to(device)2728# You can modify the sampling parameters according to your needs.29generation_config = GenerationConfig(30 do_samples=True,31 temperature=0.35,32 top_p=0.9,33)3435with torch.no_grad():36 generation_output = model.generate(37 input_ids=input_ids,38 generation_config=generation_config,39 return_dict_in_generate=True,40 output_scores=True,41 max_new_tokens=1024,42 pad_token_id=tokenizer.eos_token_id,43 repetition_penalty=1.15,44)4546output = generation_output[0]47response = tokenizer.decode(48 output[:, input_ids.shape[-1]:][0], skip_special_tokens=True49).strip()5051print(response)52
Using vLLM
python
1from vllm import LLM, SamplingParams
23# To use vllm for inference, you need to download the model files either using HuggingFace model hub or manually.4# You should modify the path to the model according to your local environment.5path_to_model =(6"/workspace/models/Jellyfish"7)89model = LLM(model=path_to_model)1011# You can modify the sampling parameters according to your needs.12# Caution: The stop parameter should not be changed.13sampling_params = SamplingParams(14 temperature=0.35,15 top_p=0.9,16 max_tokens=1024,17 stop=["<|eot_id|>"],18)1920system_message ="You are an AI assistant that follows instruction extremely well. Help as much as you can."2122# You need to define the user_message variable based on the task and the data you want to test on.23user_message ="Hello, world."2425prompt = ff"<|start_header_id|>system<|end_header_id|>{system message}<|eot_id|>\n<|start_header_id|>user<|end_header_id|>{user_message}<|eot_id|>\n<|start_header_id|>assistant<|end_header_id|>"26outputs = model.generate(prompt, sampling_params)27response = outputs[0].outputs[0].text.strip()28print(response)29
Prompts
We provide the prompts used for both fine-tuning and inference.
You can structure your data according to these prompts.
System Message
You are an AI assistant that follows instruction extremely well.
User will give you a question. Your task is to answer as faithfully as you can.
For Error Detection
There are two forms of the error detection task.
In the first form, a complete record row is provided, and the task is to determine if a specific value is erroneous.
In the second form, only the value of a specific attribute is given, and the decision about its correctness is based solely on the attribute's name and value.
The subsequent prompt examples pertain to these two forms, respectively.
Your task is to determine if there is an error in the value of a specific attribute within the whole record provided.
The attributes may include {attribute 1}, {attribute 2}, ...
Errors may include, but are not limited to, spelling errors, inconsistencies, or values that don't make sense given the context of the whole record.
Record [{attribute 1}: {attribute 1 value}, {attribute 2}: {attribute 2 value}, ...]
Attribute for Verification: [{attribute X}: {attribute X value}]
Question: Is there an error in the value of {attribute X}? Choose your answer from: [Yes, No].
Your task is to determine if there is an error in the value of a specific attribute.
The attributes may belong to a {keyword} record and could be one of the following: {attribute 1}, {attribute 2}, ...
Errors can include, but are not limited to, spelling errors, inconsistencies, or values that don't make sense for that attribute.
Note: Missing values (N/A or \"nan\") are not considered errors.
Attribute for Verification: [{attribute X}: {attribute X value}]
Question: Is there an error in the value of {attribute X}? Choose your answer from: [Yes, No].
For Data Imputation
You are presented with a {keyword} record that is missing a specific attribute: {attribute X}.
Your task is to deduce or infer the value of {attribute X} using the available information in the record.
You may be provided with fields like {attribute 1}, {attribute 2}, ... to help you in the inference.
Record: [{attribute 1}: {attribute 1 value}, {attribute 2}: {attribute 2 value}, ...]
Based on the provided record, what would you infer is the value for the missing attribute {attribute X}?
Answer only the value of {attribute X}.
For Schema Matching
Your task is to determine if the two attributes (columns) are semantically equivalent in the context of merging two tables.
Each attribute will be provided by its name and a brief description.
Your goal is to assess if they refer to the same information based on these names and descriptions provided.
Attribute A is [name: {value of name}, description: {value of description}].
Attribute B is [name: {value of name}, description: {value of description}].
Are Attribute A and Attribute B semantically equivalent? Choose your answer from: [Yes, No].
For Entity Matching
You are tasked with determining whether two records listed below are the same based on the information provided.
Carefully compare the {attribute 1}, {attribute 2}... for each record before making your decision.
Note that missing values (N/A or \"nan\") should not be used as a basis for your decision.
Record A: [{attribute 1}: {attribute 1 value}, {attribute 2}: {attribute 2 value}, ...]
Record B: [{attribute 1}: {attribute 1 value}, {attribute 2}: {attribute 2 value}, ...]
Are record A and record B the same entity? Choose your answer from: [Yes, No].