This model is a fine-tuned version of
tiiuae/falcon-7b
on a simple dataset of
linear equations
.
For this task it is better to finetune
tiiuae/falcon-7b-instruct
as it is already finetuned on a mixture of chat/instruct datasets.
But we start by finetuning the raw model as it is more challenging.
The objective of this model is to test Falcon7B's ability to solve mathematical linear equations after fine-tuning. The linear equations are in the form:
Ay + ay + b + B = Dy + dy + c + C
This model was trained using TRL, LoRA quantization, and Flash Attention.
Due to limited GPU resources, I only considered 20,000 samples for training.
import torch
from peft import AutoPeftModelForCausalLM
from transformers import AutoTokenizer, pipeline
# Specify the model ID
peft_model_id = "Menouar/falcon7b-linear-equations"# Load Model with PEFT adapter
model = AutoPeftModelForCausalLM.from_pretrained(
peft_model_id,
device_map="auto",
torch_dtype=torch.float16
)
tokenizer = AutoTokenizer.from_pretrained(peft_model_id)
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
equation = "Solve for y: 10 + 4y -9y +5 = 4 +8y - 2y + 8 ."
outputs = pipe(equation,
max_new_tokens=172,
do_sample=True,
temperature=0.1,
top_k=50, top_p=0.1,
eos_token_id=pipe.tokenizer.eos_token_id,
pad_token_id=pipe.tokenizer.pad_token_id)
for seq in outputs:
print(f"{seq['generated_text']}")
"""Solve for y: 10 + 4y -9y +5 = 4 +8y - 2y + 8 .The equation is in the form of ay + b = dy + c where:a = 4 - 9 = -5b = 10 + 5 = 15d = 8 - 2 = 6c = 4 + 8 = 12The solution is y = (c - b)/(a - d) if a ≠ d12 - 15 = -3-5 - 6 = -11y = -3 / -11The fraction -3 / -11 = 3 / 11.The solution is y = 3 / 11."""
Intended uses & limitations
The model can solve any equation of the form
Ay + ay + b + B = Dy + dy + c + C
with integer coefficients ranging from -10 to 10. It cannot solve linear equations which have more constants than: A, a, b, B, c, C. It also cannot solve linear equations which have constants larger than 10 or smaller than -10. These limitations are due to the nature of the samples within the dataset and the ability of Large Language Models (LLMs) to perform simple computations between numbers. The goal of this work is to demonstrate that fine-tuning an LLM on a specific dataset can yield excellent results for handling a specific task, as is the case with our new model compared to the original one.
Evaluation
I will compile the evaluation section at a later time. For the moment, I’d like to present an example of a linear equation. In this example, this model, Bard, and BingChat are able to find the correct solution. However, other models, including ChatGPT3.5, Llama 70B, Mixtral, and Falcon-7b-instruct, do not arrive at the correct solution.
Solve for y: 10 + 4y -9y +5 = 4 +8y - 2y + 8 .
Falcon-7b-instruct
Solve for y: 10 + 4y -9y +5 = 4 +8y - 2y + 8 .
First, we can solve for y.
y = -2 + 8x
We add 8 to x and subtract -2, giving:
x = -2
so 2 = +2
y = 4
we add 2 to y, so y = +6
We can now plug these values into the original equation:
10 + 4x -9x + 5 = -2 + 4x
10 + 4(-2) = -6
we end up with -1 = -1 + 4
4 = 1
y = 1
Therefore, the solution is
y = 1
. The equation has been solved.
Mixtral 8x7b
Let's first simplify the equation by combining like terms:
10 - 5y + 5 = 4 + 6y
Now, let's get all the y terms on one side and constants on the other side. Subtract 6y from both sides:
10 - 5y - 6y + 5 = 4 + 6y - 6y
This simplifies to:
15 - 11y = 4
Next, subtract 15 from both sides to isolate the y term:
15 - 15 - 11y = 4 - 15
This simplifies to:
-11y = -11
Finally, divide both sides by -11 to solve for y:
y = -11 / -11
So,
y = 1
.
Llma 70b
To solve for y, we need to isolate the y term on one side of the equation.
First, we can combine the like terms:
10 + 4y - 9y + 5 = 4 + 8y - 2y + 8
This simplifies to:
10 - 5y + 5 = 4 + 6y
Next, we can subtract 4 from both sides:
6 - 5y + 5 = 6y
Now, we can isolate the y term by subtracting 5 from both sides:
-5y + 5 = 6y - 5
This simplifies to:
-5y = 11
Finally, we can divide both sides by -5 to solve for y:
y = -11/5
Therefore, the value of y is
-11/5
.
ChatGPT3.5
To solve for y in the given equation 10 + 4y - 9y + 5 = 4 + 8y - 2y + 8, follow these steps:
Combine like terms on each side: (4y - 9y + 5) + 10 = (6y + 12 + 8y - 2y)
Combine the y terms and constants separately: -5y + 15 = 12y + 12
Move all terms involving y to one side and the constants to the other side: -5y - 12y = 12 - 15
Combine like terms: -17y = -3
Divide by -17: y = 3/17
Therefore, the solution to the equation 10 + 4y - 9y + 5 = 4 + 8y - 2y + 8 is
y = 3/17
.
Bard
Sure, I'd be happy to help you solve for y. Here is the solution:
10 + 4y - 9y +5 = 4 +8y - 2y + 8
First, combine like terms on each side of the equation.
-5y + 15 = 12 + 6y
Next, subtract 6y from both sides of the equation.
-11y + 15 = 12
Finally, subtract 15 from both sides of the equation to isolate y.
-11y = -3
Divide both sides of the equation by -11 to find y.
y = 0.2727
.
BingChat
Combine like terms on both sides:
10 + 4y - 9y + 5 = 15 - 5y
4 + 8y - 2y + 8 = 12 + 6y
This gives us:
15 - 5y = 12 + 6y
Solving for y in one step:
y = 3 / 11
.
Falcon7B-linear-equation
The equation is in the form of ay + b = dy + c where:
a = 4 - 9 = -5
b = 10 + 5 = 15
d = 8 - 2 = 6
c = 4 + 8 = 12
The solution is y = (c - b)/(a - d) if a ≠ d
12 - 15 = -3
-5 - 6 = -11
y = -3 / -11
The fraction -3 / -11 = 3 / 11.
The solution is
y = 3 / 11
.
falcon7b-linear-equations huggingface.co is an AI model on huggingface.co that provides falcon7b-linear-equations's model effect (), which can be used instantly with this Menouar falcon7b-linear-equations model. huggingface.co supports a free trial of the falcon7b-linear-equations model, and also provides paid use of the falcon7b-linear-equations. Support call falcon7b-linear-equations model through api, including Node.js, Python, http.
falcon7b-linear-equations huggingface.co is an online trial and call api platform, which integrates falcon7b-linear-equations's modeling effects, including api services, and provides a free online trial of falcon7b-linear-equations, you can try falcon7b-linear-equations online for free by clicking the link below.
Menouar falcon7b-linear-equations online free url in huggingface.co:
falcon7b-linear-equations is an open source model from GitHub that offers a free installation service, and any user can find falcon7b-linear-equations on GitHub to install. At the same time, huggingface.co provides the effect of falcon7b-linear-equations install, users can directly use falcon7b-linear-equations installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
falcon7b-linear-equations install url in huggingface.co: