Aligning Large Language Models for Controllable Recommendations

Wensheng Lu, Jianxun Lian, Wei Zhang, Guanghua Li, Mingyang Zhou, Hao Liao, Xing Xie

Abstract

While Large Language Models (LLMs) possess significant reasoning and linguistic capabilities, their application in recommendation systems is often hindered by "hygiene" issues—such as repeating items or suggesting previously consumed content—and a lack of precise controllability. This paper presents a two-stage alignment framework involving Supervised Learning (SL) and Reinforcement Learning (RL) to transform LLMs into effective recommendation agents. By distilling knowledge from traditional sequential models and applying rule-based rewards, the proposed framework significantly reduces hallucinations and enables fine-grained control over recommendation constraints, such as specific category proportions, without sacrificing recommendation accuracy.

Introduction

Large Language Models (LLMs) have recently been explored as potential engines for recommendation systems due to their ability to process complex user preferences and provide natural language explanations. However, standard LLMs often fail to meet the rigorous requirements of real-world recommendation environments. Specifically, they struggle with "hygiene" issues—logical errors like suggesting the same item multiple times in a single list or recommending items the user has already purchased. Furthermore, they often fail to follow explicit user constraints, such as a request for a specific mix of genres (e.g., "make 30% of the suggestions musicals").

This research addresses these gaps by proposing an alignment procedure that moves beyond simple fine-tuning. By treating the LLM as an agent that must be aligned with both recommendation logic and user instructions, the authors demonstrate a path toward more reliable and controllable interactive recommendation systems.

Methodology

The proposed framework utilizes a two-stage alignment process applied to a Llama-2-7b-chat base model.

Stage 1: Supervised Learning (SL) with Label Augmentation

The model is first fine-tuned on five distinct instruction tasks: sequential recommendation, positive/negative category control, category proportion control, item search, and general conversation. To ensure the model learns effective collaborative filtering patterns, the authors employ SASRec (a traditional sequential recommender) as a "teacher" model.

Because raw user history is often sparse, the training labels are augmented by filtering SASRec’s top predictions. This ensures that the training data reflects both high-quality recommendations and strict adherence to the natural language instructions provided in the prompts.

Stage 2: Reinforcement Learning (RL) via PPO

To further refine the model and handle suboptimal responses, the authors apply Proximal Policy Optimization (PPO). Unlike standard Reinforcement Learning from Human Feedback (RLHF), which relies on a learned reward model, this framework utilizes rule-based rewards:

  • Item-level Rewards: These penalize "illegal" outputs, such as duplicate items or items already present in the user's history. Conversely, they reward items that align with the user's intent or rank highly in the teacher model's estimation.
  • List-level Rewards: A terminal reward is calculated at the end of the generated sequence to evaluate how well the entire list satisfies global constraints, such as the exact percentage of a requested category.

Experimental Setup

The framework was evaluated on two large-scale datasets: Amazon Movie & TV and Steam. Both datasets were enriched with item category metadata to support the controllability tasks. To prevent catastrophic forgetting—a common issue where models lose general reasoning abilities during specialized fine-tuning—the authors mixed in general conversation data from the ShareGPT dataset during the SL stage.

Key Insights

The Power of Distillation

Traditional recommenders like SASRec are highly efficient at capturing collaborative filtering patterns. Using these models as teachers allows the LLM to inherit recommendation logic that is difficult to extract from text alone, bridging the gap between linguistic fluency and recommendation precision.

Hygiene through Reinforcement

The research highlights that explicitly penalizing "illegal" items (duplicates and history items) during the RL stage is significantly more effective than simply providing more positive examples during supervised learning. This suggests that RL is particularly well-suited for teaching models what not to do in structured output tasks.

Balancing Controllability and Accuracy

A primary challenge in controllable recommendation is the trade-off between following a user's specific constraint (e.g., "show more horror") and maintaining the overall quality of the suggestions. The RL approach allows for "soft" alignment, where the model respects constraints while still prioritizing relevant, high-quality items.

Results

  • Formatting and Logic: The final model, Ours_full, reduced "RepeatItem" errors to nearly zero (dropping from ~10% in baselines like InstructRec to ~1%). It also significantly lowered the rate of "InHistory" suggestions.
  • Instruction Following: In category proportion tasks, the model achieved a Category Proportion Accuracy (CPA) of 70-88%. This vastly outperformed GPT-3.5 and other fine-tuned baselines, which typically hovered between 10-30%.
  • Recommendation Precision: Despite the added complexity of following constraints, the model maintained or improved upon the recommendation accuracy (HR@10 and NDCG@10) of the SASRec teacher model and outperformed other LLM-based baselines like PALR.

Conclusion and Future Work

This work demonstrates that a two-stage alignment framework can successfully transform LLMs into controllable recommendation agents. While the model showed some decline in general benchmarks (like MMLU), the inclusion of general conversation data helped mitigate catastrophic forgetting.

Future research will focus on increasing instruction complexity—such as handling multi-layered constraints (e.g., "30% action movies released after 1990")—and reducing the computational overhead of the RL stage to make these sophisticated recommendation agents more accessible for real-time deployment.

Summary updated

BibTeX
@inproceedings{lu2024aligning,
  author = {Wensheng Lu and Jianxun Lian and Wei Zhang and Guanghua Li and Mingyang Zhou and Hao Liao and Xing Xie},
  title = {{Aligning Large Language Models for Controllable Recommendations}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.443},
}
Figure