Lab build

QLoRA Llama 3.1 price predictor

QLoRA fine-tune of a 4-bit Llama 3.1 8B that predicts product prices from descriptions.

Role
Builder, end to end
Group
Fine-tuning
Services
AI & LLM systems

What it does

The curated product-price dataset is pulled from the Hugging Face Hub and Llama 3.1 8B is loaded in 4-bit NF4 with double quantisation. LoRA adapters are trained with TRL's SFTTrainer in Google Colab, with rank, alpha, target modules, learning rate and gradient accumulation set explicitly. Training is monitored in Weights & Biases, the adapter is saved to the Hub, and the model is scored against frontier models on the same price tester.

What was built

  1. 01

    Base model chosen by comparing Hugging Face leaderboard entries and Llama and Qwen tokenizers.

  2. 02

    Llama 3.1 8B is loaded in 4-bit NF4 with double quantisation.

  3. 03

    SFTTrainer runs QLoRA with configured r, alpha, target modules, epochs, batch size and learning rate.

  4. 04

    Weights & Biases tracks loss and learning rate; the trained adapter is saved to the Hugging Face Hub.

  5. 05

    Fine-tuned model is scored on the shared price tester against GPT-4o and earlier baselines.

The pipeline, layer by layer

Five layers, one pipeline.

  1. L1Data

    • HF Hub price dataset
  2. L2Base model

    • Llama 3.1 8B
    • 4-bit NF4 quantisation
  3. L3Training

    • QLoRA SFTTrainer run
    • W&B monitoring
  4. L4Output

    • LoRA adapter on HF Hub
  5. L5Evaluation

    • Price tester vs frontier

Stack

  • Llama 3.1 8B
  • Hugging Face Transformers
  • PEFT (LoRA)
  • TRL SFTTrainer
  • Weights & Biases
  • Hugging Face Hub
  • Google Colab

Next lab build · 46 / 46

Product price prediction with frontier LLM fine-tuning

Predicts product prices from descriptions, comparing classic ML baselines, frontier LLMs and fine-tuned GPT-4o mini.

Previous: Instruction fine-tuning a small LLM

Need a system like this in production? Tell us about it.