Back to Projects

Problem

Online hotel booking platforms face a growing trust crisis: over 30% of reviews may be fake or manipulated. Deceptive reviews can artificially inflate ratings or damage competitors, misleading travelers and undermining platform credibility. Traditional detection methods fail to capture subtle linguistic cues, while standard recommendation engines treat all reviews as equally reliable, resulting in biased suggestions.

The project aims to address two critical issues:

  1. Detecting deceptive hotel reviews using modern NLP techniques.
  2. Providing personalized, trustworthy hotel recommendations based only on verified content.

Solution Overview

The solution consists of two integrated modules:

  • Fake Review Detection: Fine-tuned BERT model identifies whether a review is truthful or deceptive. SHAP explains token-level influences, and Gemini generates natural language explanations to enhance interpretability.
  • RAG-Based Recommendation: Uses verified reviews and structured hotel data (from TripAdvisor) stored in ChromaDB. The system retrieves relevant information and employs Gemini to generate personalized hotel recommendations based on user queries.

Together, these modules ensure that recommendations are grounded in trustworthy, explainable AI outputs.


Architecture & Design

The system’s architecture is divided into two main pipelines:

1. Fake Review Detection Module

  • Input: Raw hotel reviews from the Kaggle Deceptive Opinion Spam Corpus.
  • Model: Fine-tuned bert-base-cased using the Hugging Face Transformers library.
  • Interpretability: SHAP highlights word-level contributions; Gemini translates them into user-understandable justifications.
  • Output: Classified review (truthful/deceptive) + explanation.

2. RAG-Based Recommendation Module

  • Data Source: 1,533 hotels scraped from TripAdvisor, focusing on 169 Tunisian hotels.
  • Storage: Truthful reviews stored in ChromaDB after BERT filtering (≈17% deceptive reviews removed).
  • Retriever: Google text-embedding-001 model embeds hotel data for semantic search.
  • Generator: Gemini (2.0-Flash) produces coherent recommendations through a multi-stage prompting pipeline:
    1. Extract hotel context (metadata, amenities, etc.).
    2. Extract relevant verified reviews.
    3. Generate a final response tailored to the user’s query.

Technical Highlights

  • BERT Fine-Tuning:
    • Dataset: 1,600 labeled hotel reviews (800 truthful, 800 deceptive).
    • Training: 3 epochs, batch size 16, learning rate 2e-5 (AdamW optimizer).
    • Accuracy: 85.42%, F1-score: 0.85.
  • Explainability: SHAP identifies linguistic cues (e.g., exaggerations → deceptive, sensory details → truthful).
  • Gemini Integration: Converts SHAP insights into natural language explanations, improving transparency for non-technical users.
  • RAG Pipeline: Combines semantic retrieval (ChromaDB) and LLM-based generation (Gemini) to produce context-aware recommendations.
  • Prompt Engineering: Multi-stage structure ensures grounded, concise, and relevant outputs.
  • Implementation Stack:
    • transformers, langchain, chromadb, google-generativeai, shap, beautifulsoup4.

My Contributions

  • Designed and implemented the Fake Review Detection module, including:
    • BERT fine-tuning, SHAP integration, and Gemini-based explanation layer.
  • Built the data pipeline for collecting, cleaning, and formatting TripAdvisor data.
  • Developed the RAG-based recommendation system, integrating ChromaDB and Gemini with structured prompts.
  • Conducted evaluation and testing using Tunisian hotel datasets to validate scalability and accuracy.
  • Documented the architecture and workflows, ensuring reproducibility and interpretability.

Results & Impact

  • Achieved 85.42% accuracy in fake review classification.
  • Filtered out ~17% deceptive reviews from the TripAdvisor dataset.
  • Generated personalized and context-grounded hotel recommendations aligned with user intent.
  • Enhanced model interpretability using SHAP + Gemini explanations.
  • Demonstrated a scalable approach applicable to any region or domain relying on user-generated content.

The system contributes to trustworthy AI in recommendation systems, combining explainability and personalization within a production-ready framework.


What I Learned

  • Practical fine-tuning and evaluation of transformer models (BERT).
  • Designing explainable NLP pipelines using SHAP and LLM-based explanations.
  • Building RAG architectures integrating vector databases (ChromaDB) with large language models.
  • Data engineering for large-scale text scraping and preprocessing.
  • Prompt design for structured and factual LLM outputs.
  • Developing transparent, trustworthy AI systems from research to prototype.