Abot / knowledge-base /Projects /LLMPricePrediction.md
anuragbb's picture
Update knowledge-base/Projects/LLMPricePrediction.md
79eb3c9 verified

LLM Price Prediction Engine

The Price Is Right is an end-to-end machine learning system that predicts the retail price of a product from its text description alone — title, category, brand, and feature details. It covers the full ML lifecycle from data engineering through classical ML, deep learning, and LLM fine-tuning, with rigorous evaluation across all approaches.

What It Does

Given a product description, the system predicts its USD retail price. The problem is harder than it sounds — prices span three orders of magnitude ($0.50 to $999) and are influenced by subtle signals like material quality, brand prestige, and feature density.

The Approach

The project benchmarks 12 models across five approaches in order of increasing sophistication: a constant baseline, traditional ML (Linear Regression, Random Forest, XGBoost), a custom deep neural network, frontier LLMs zero-shot (Gemini 2.5 Flash), and finally fine-tuned open-source LLMs.

The DNN uses a HashingVectorizer with 5,000 features, 8 residual blocks, and log-normalized price targets — necessary because raw prices span a 2000x range.

The best result comes from fine-tuning Llama 3.2-3B using QLoRA — 4-bit NF4 quantization plus LoRA adapters — which reduces trainable parameters 163x from 3 billion to 18.4 million. This makes it trainable on a free Colab T4 GPU. The fine-tuned model treats price prediction as text completion, generating "Price is $X.00" and extracting the number via regex.

Results

Fine-tuned Llama 3.2 achieved $39.85 MAE, outperforming Gemini 2.5 Flash zero-shot ($62.84) and the human benchmark ($87.62) — a 54% improvement over human performance. XGBoost scored $68.23 MAE as the best traditional ML result.

Data Pipeline

400,000+ Amazon product listings are loaded in parallel using ProcessPoolExecutor, cleaned, then summarised by a fast LLM into a standardised 5-field format before fine-tuning. ThreadPoolExecutor handles concurrent LLM API calls during preprocessing. Experiment tracking uses Weights and Biases.

Tech Stack

Python, PyTorch, scikit-learn, XGBoost, Llama 3.2, QLoRA, PEFT, TRL, BitsAndBytes, Gemini 2.5 Flash, HuggingFace, Weights and Biases, Google Colab.