This is a classifier for judging the educational value of web pages. It was developed to filter and curate educational content from web datasets and was trained on 450k
annotations
generated by
LLama3-70B-instruct
for web samples from
FineWeb
dataset.
We used this classifier to build
FineWeb-Edu
dataset.
How to use in transformers
To load the FineWeb-Edu classifier, use the following code:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/fineweb-edu-classifier")
model = AutoModelForSequenceClassification.from_pretrained("HuggingFaceTB/fineweb-edu-classifier")
text = "This is a test sentence."
inputs = tokenizer(text, return_tensors="pt", padding="longest", truncation=True)
outputs = model(**inputs)
logits = outputs.logits.squeeze(-1).float().detach().numpy()
score = logits.item()
result = {
"text": text,
"score": score,
"int_score": int(round(max(0, min(score, 5)))),
}
print(result)
# {'text': 'This is a test sentence.', 'score': 0.07964489609003067, 'int_score': 0}
Training
The classifier was trained on 450,000 pairs of web samples and their scores from 0 to 5, generated by Llama3. The samples were annotated based on their educational quality with 0 being not educational and 5 being highly educational.
Below is the prompt used for LLama3 annotations:
We added a classification head with a single regression output to
Snowflake-arctic-embed
and trained the model for 20 epochs with a learning rate of 3e-4. During training, the embedding and encoder layers were frozen to focus on the classification head. The model achieved an F1 score of 82% when converted to a binary classifier using a score threshold of 3.
Training Details:
Model: Snowflake-arctic-embed with a classification head
Dataset: 450,000 samples from Llama3 annotations
Epochs: 20
Learning Rate: 3e-4
Evaluation Metric: F1 score
Classification report
We treat the regression model's predictions as discrete classes to calculate the metrics on a hold-out set of 46867 Llama3-annotated samples.
While the FineWeb-Edu classifier performs well in distinguishing high-quality educational content for FineWeb dataset, there are some limitations:
Scope: The model's performance might change for other datasets, in particular for out of distribution samples. It is also focused on educational content relevant to primary and grade school levels and may not perform as well on content intended for higher education or specialized domains.
Bias: The model's performance is dependent on the quality and representativeness of the training data and the LLM used for the annotation. Biases in both can affect the classifier's judgments. It might overfit to academic looking content for the higher scores and we recommend using int_score >= 3 as a threshold for data curation.
Context: The classifier evaluates individual web pages or extracts without considering broader context, which might impact its effectiveness in certain scenarios.
fineweb-edu-classifier-onnx huggingface.co is an AI model on huggingface.co that provides fineweb-edu-classifier-onnx's model effect (), which can be used instantly with this davanstrien fineweb-edu-classifier-onnx model. huggingface.co supports a free trial of the fineweb-edu-classifier-onnx model, and also provides paid use of the fineweb-edu-classifier-onnx. Support call fineweb-edu-classifier-onnx model through api, including Node.js, Python, http.
fineweb-edu-classifier-onnx huggingface.co is an online trial and call api platform, which integrates fineweb-edu-classifier-onnx's modeling effects, including api services, and provides a free online trial of fineweb-edu-classifier-onnx, you can try fineweb-edu-classifier-onnx online for free by clicking the link below.
davanstrien fineweb-edu-classifier-onnx online free url in huggingface.co:
fineweb-edu-classifier-onnx is an open source model from GitHub that offers a free installation service, and any user can find fineweb-edu-classifier-onnx on GitHub to install. At the same time, huggingface.co provides the effect of fineweb-edu-classifier-onnx install, users can directly use fineweb-edu-classifier-onnx installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
fineweb-edu-classifier-onnx install url in huggingface.co: