CWV-Predict: Core Web Vitals Prediction from Page Features
Type: Academic | Domain: SEO, Web Performance
Hugging Face: syeedalireza/cwv-predict
Predict LCP, INP/FID, and CLS from page and server features before deployment (pre-deployment CWV estimation).
Author
Alireza Aminzadeh
- Hugging Face: syeedalireza
- LinkedIn: alirezaaminzadeh
- Email: alireza.aminzadeh@hotmail.com
Problem
Core Web Vitals (CWV) affect rankings and UX. Estimating CWV before deployment helps prioritize fixes and avoid regressions.
Approach
- Features: Resource counts, DOM size, script size, server response time, image dimensions, etc.
- Targets: LCP (ms), INP/FID (ms), CLS (score).
- Models: Gradient boosting (XGBoost/LightGBM) for tabular features; optional lightweight embeddings for URL/path.
Tech Stack
| Category | Tools |
|---|---|
| ML | scikit-learn, XGBoost, LightGBM |
| Data | pandas, NumPy |
| Evaluation | sklearn metrics, optional MLflow |
Setup
python -m venv .venv
.venv\Scripts\activate # Windows
pip install -r requirements.txt
Usage
# Train (expects data in data/ or env DATA_PATH)
python train.py
# Predict on new samples
python inference.py --input data/sample.csv --output predictions.csv
Project structure
01_cwv-predict/
βββ config.py # Paths and column names
βββ train.py # Train XGBoost regressors per CWV metric
βββ inference.py # Batch prediction from CSV
βββ requirements.txt
βββ .env.example
βββ data/
β βββ cwv_features.csv # Sample training data (features + targets)
β βββ sample.csv # Sample input for inference (features only)
βββ models/ # Saved models and metrics (after train)
Data
- Sample data (included):
data/cwv_features.csv(features +lcp_ms,inp_ms,cls_score),data/sample.csv(features only for inference). - Columns:
dom_size,resource_count,script_bytes,image_count,server_ttfb_ms; targets:lcp_ms,inp_ms,cls_score. - Override paths via
DATA_PATHin.env. See.env.example.
License
MIT.
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support