CoolFace
Apppublic

Forecast-ing/modernbert-content-regression

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
README.md83 linesDownload Raw Back to root
1---2title: ModernBERT Engagement Content Regression3sdk: gradio4sdk_version: "5.11.0"5app_file: app.py6pinned: true7base_model: answerdotai/ModernBERT-base8---9 10# ModernBERT Engagement Content Regression11### What is this?12 13This is an exploration of using modernBERT for the text regression task of predicting engagement metrics for text content. In this case, we are predicting the clickthrough rate (CTR) of email text content.14 15We will be exploring hyperparameter tuning of modernBert; and how to use it for regression, as well as comparing the results to a benchmark model.16 17This type of task if difficult, we can remember the quote18> “Half my advertising is wasted; the trouble is, I don't know which half”19> -John Wanamaker20 21We are also excluding other relevant factors such as the time of day the email is sent, the day of the week, the recipient, etc in this experiment.22 23This work is indebted to the work of many community members and blog posts.24- [ModernBERT Announcement](https://huggingface.co/blog/modernbert)25- [Fine-tune classifier with ModernBERT in 2025](https://www.philschmid.de/fine-tune-modern-bert-in-2025)26- [How to set up Trainer for a regression](https://discuss.huggingface.co/t/how-to-set-up-trainer-for-a-regression/12994)27 28 29Our model - [ModernBERT-Engagement-Content-Regression](https://huggingface.co/Forecast-ing/modernBERT-content-regression)30Our training notebook - [Training Notebook](https://github.com/Forecast-ing/modernbert-content-regression/blob/main/model_training.ipynb)31 32### Our dataset33We will be using a dataset of 548 emails where we have the text of the email `text` and the CTR we are trying to predict `labels`.34 35We look forward in the improvements of ModernBERT to fine-tune models specifically for each potential users email dataset. The variability of email data, as well as the small size of the dataset pose an interesting regression challenge.36 37### Benchmarking38We will start by using the Catboost library as a simple benchmark for text regression. For both the benchmark and the ModernBert run, we are using 'rmse' as the metric.39We recieve the following results:40| Metric | Value            |41|--------|------------------|42| MSE    | 2.552100633998035 |43| RMSE   | 1.5975295408843102 |44| MAE    | 1.1439370629666958 |45| R²     | 0.30127932054387174 |46| SMAPE  | 37.63064694052479 |47 48## Fitting the Modern Bert Model49 50### Install dependencies and activate venv51```bash52uv sync53source .venv/bin/activate54```55the following values need to be defined in the .env file56- `HUGGINGFACE_TOKEN`57 58### Run notebook for model fitting59 60```bash61uv run --with jupyter jupyter lab62```63 64### ModernBert Model Performance65After running hyperparameter tuning for ModernBERT, we get the following results:66 67| Metric | Value            |68|--------|------------------|69| MSE    | 2.4624056816101074 |70| RMSE   | 1.5692054300218654 |71| MAE    | 1.182181715965271 |72| R²     | 0.325836181640625 |73| SMAPE  | 56.61447048187256 |74 75We see improvements in all metrics except for SMAPE. We believe that ModernBERT would scale even better with a larger dataset; as 500 example is very low for fine-tuning and are thus happy with the performance of this evaluation.76 77### Who are we?78At [Forecast.ing](https://forecast.ing) we are building a platform to help users create more enriching content by automatically researching trends and generating campaign ideas with AgenticAI. 79We generate the content, and then create fine-tuned scores of how likely we think that content will succeed.80 81## Conclusion82We see that ModernBERT is a powerful model for text regression. We believe that with a larger dataset, we would see even better results. We are excited to see the future of ModernBERT and how it will be used for text regression.83If interested, I can be contacted at robin@forecast.ing