Instructions to use Only-A7med/fake-tweets-detection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use Only-A7med/fake-tweets-detection with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://Only-A7med/fake-tweets-detection") - Notebooks
- Google Colab
- Kaggle
Fake Tweets Detection β TF-IDF + Logistic Regression and Bi-LSTM + GloVe
Trained artifacts for the companion implementation of:
A. Tariq, S. I. Khan, M. Imran, A. Mustafa and Z. Elgamal, "Fake Tweets Detection using Bi-LSTM with GloVe Embedding," in 2025 International Conference on Computational Intelligence and Knowledge Economy (ICCIKE), Dubai, United Arab Emirates, 2025, pp. 737β742, doi: 10.1109/ICCIKE67021.2025.11318261.
Code, training scripts and documentation: https://github.com/Only-A7med/Fake-Tweets-Detection
Binary classification of English tweets as real (label 1) or fake (label 0). Both models
consume raw tweet text; the Bi-LSTM embeds its own TextVectorization layer, so no separate
tokenizer is needed.
Files
| Path | Model | Format |
|---|---|---|
paper/baseline.joblib |
TF-IDF + Logistic Regression | scikit-learn pipeline (joblib) |
paper/bilstm.keras |
Bi-LSTM + GloVe 100-d | Keras 3 |
paper/bilstm_history.json |
per-epoch loss and accuracy | JSON |
safe/baseline.joblib |
TF-IDF + Logistic Regression | scikit-learn pipeline (joblib) |
safe/bilstm.keras |
Bi-LSTM + GloVe 100-d | Keras 3 |
safe/bilstm_history.json |
per-epoch loss and accuracy | JSON |
arabic/ is reserved for the bilingual extension and is not present yet.
The two protocols
The repository evaluates under two protocols, and both sets of artifacts are published here.
paperβ augment the cleaned dataset to 200,000 rows first, then split 80/20, exactly as the paper describes. Word-swapped variants of one source tweet can land on both sides of the split, so some training information leaks into the test set. Reproduction fidelity, not a generalisation estimate.safe(leakage-safe) β split the original tweets 80/20 first, then augment only the training side to 160,000 rows. Every test row is an unmodified tweet that never appears in training, as itself or as a variant. These are the honest generalisation numbers, and the Flask app serves them by default.
Measured results
Measured on the held-out test set of each protocol by python -m src.training.evaluate, with the
artifacts published here. MLflow run identifiers refer to the local training store described under
Provenance.
| Protocol | Model | Accuracy | Precision | Recall | F1 | Test n | MLflow run |
|---|---|---|---|---|---|---|---|
| paper | TF-IDF + Logistic Regression | 0.9721 | 0.9714 | 0.9746 | 0.9730 | 40,000 | 204879f821a54d9085c7e8e0f0103cf1 |
| paper | Bi-LSTM + GloVe | 0.9684 | 0.9751 | 0.9632 | 0.9691 | 40,000 | 3ffff24580444d2ba6bcfb64269edb65 |
| safe | TF-IDF + Logistic Regression | 0.9774 | 0.9762 | 0.9799 | 0.9780 | 26,804 | 22ac0f6d2ab04f259b2c45e3b66d54db |
| safe | Bi-LSTM + GloVe | 0.9583 | 0.9287 | 0.9951 | 0.9608 | 26,804 | 5bc1da65ad18400d804c6f122a575af1 |
For reference, the original authors report 98.1% (Logistic Regression) and 98.2% (Bi-LSTM) on a 40,000-tweet test split. Those are their published figures, not measurements of these artifacts.
Usage
from huggingface_hub import hf_hub_download
import joblib, keras
# Logistic Regression baseline (leakage-safe protocol)
baseline = joblib.load(hf_hub_download("Only-A7med/fake-tweets-detection", "safe/baseline.joblib"))
p_real = baseline.predict_proba(["Breaking: the central bank cut rates today."])[:, 1]
# Bi-LSTM (leakage-safe protocol) β consumes raw strings
bilstm = keras.saving.load_model(
hf_hub_download("Only-A7med/fake-tweets-detection", "safe/bilstm.keras")
)
p_real = bilstm.predict([["Breaking: the central bank cut rates today."]])
The output is P(real); the decision threshold is 0.5. This repository is public, so downloads need no token.
Training setup
| Hardware | Intel Core i5-13500H (12 cores / 16 threads), 15.6 GB RAM, CPU only, no GPU |
| Operating system | Windows 11 Pro 10.0.26300 |
| Python | 3.11.9 |
| Libraries | TensorFlow 2.21.0, Keras 3.15.1, NumPy 2.4.6, scikit-learn 1.9.0, SciPy 1.17.1, joblib 1.6.0 |
| Seed | 42 everywhere (random, NumPy, TensorFlow, scikit-learn) |
| Training time | Logistic Regression 32.1 s (paper) / 34.6 s (safe); Bi-LSTM 19.5 min (paper) / 18.6 min (safe) |
Hyperparameters, including the ones the paper does not state (LSTM units 64, dense units 64,
vocabulary 50,000, sequence length 64, batch size 128), are recorded and flagged in
src/config.py of the code repository.
Vocabulary coverage by GloVe: 25,365 of 50,000 tokens (paper protocol), 25,209 of 50,000 (safe).
Data and embeddings
Dataset β TruthSeeker 2023 (Canadian Institute for Cybersecurity, University of New Brunswick).
Obtained from the Kaggle mirror sudishbasnet/truthseekertwitterdataset2023, which declares no
licence of its own; the authoritative terms are those of the Canadian Institute for Cybersecurity:
"You may redistribute, republish, and mirror our datasets in any form; however, any use or
redistribution of the data must include a citation to the dataset and the research paper listed."
There is no commercial-use restriction. Required citation:
S. Dadkhah, X. Zhang, A. G. Weismann, A. Firouzi and A. A. Ghorbani, "The Largest Social Media Ground-Truth Dataset for Real/Fake Content: TruthSeeker," IEEE Transactions on Computational Social Systems, vol. 11, no. 3, pp. 3376β3390, June 2024, doi: 10.1109/TCSS.2023.3322303.
(The dataset's own page still shows the early-access form of this reference, "99. 1-15, Oct. 2023"; the record above is the final published one, verified against the publisher's metadata.)
Cleaning kept 134,198 rows (68,930 real, 65,268 fake) of the raw file.
Embeddings β GloVe 6B, 100 dimensions (Stanford NLP). The pre-trained vectors are released under the Open Data Commons Public Domain Dedication and License (PDDL); the GloVe code is Apache-2.0, Β© 2014 The Board of Trustees of The Leland Stanford Junior University. Citation:
J. Pennington, R. Socher and C. D. Manning, "GloVe: Global Vectors for Word Representation," in Proceedings of EMNLP 2014, pp. 1532β1543.
Neither the dataset nor the embeddings are redistributed here; only trained weights are.
Provenance
These artifacts were trained on 21 November 2026 and are the first weights ever published for this
project β an earlier model repository referenced in the code repository's documentation never
existed, and no weights from it were ever uploaded. The metrics above were reproduced exactly,
to full floating-point precision in all 24 recorded fields, from the figures already committed in
the code repository's reports/metrics.json, which had been measured in an earlier training round
whose MLflow store was not preserved. The run identifiers in the table belong to this run's local
MLflow store (sqlite:///mlflow.db), which is not committed.
Limitations
- English only. The models have no Arabic or multilingual capability; an Arabic extension is planned separately.
- Domain. Training data is tweets about 700 real and 700 fake news claims collected for TruthSeeker; accuracy on other topics, other periods, or other platforms is unknown and likely lower.
- The
paperartifacts are not a generalisation estimate. Their test set shares augmented variants with training by construction. Use thesafeartifacts for any real decision. - Augmentation is synthetic. Both protocols train largely on word-swapped copies of real tweets (random words replaced with probability 0.2), which is what the paper describes but is not natural text.
- Class decisions are not calibrated. Probabilities come straight from the models; the leakage-safe Bi-LSTM in particular trades precision for recall (0.9287 / 0.9951), so it over-predicts "real".
- No fairness, robustness or adversarial evaluation has been carried out. These artifacts are a research reproduction, not a content-moderation system, and should not be used to make consequential judgements about people or publishers.
- Downloads last month
- 79