Dynamic In-Context Learning from Nearest Neighbors for Bundle Generation

Zhu Sun, Kaidong Feng, Jie Yang, Xinghua Qu, Hui Fang, Yew-Soon Ong, Wenyuan Liu · DOI

In the world of e-commerce, product bundling—recommending a camera along with a lens, tripod, and memory card—is a powerful tool for increasing sales and improving user experience. However, most automated systems struggle to create bundles that feel "human." They often ignore the underlying user intent (the why behind the purchase) and fail to adapt to the specific context of a user's shopping session.

A new paper, "Adaptive In-Context Learning with Large Language Models for Bundle Generation," proposes a novel framework called AICL (Adaptive In-Context Learning) to solve these issues. By leveraging the reasoning capabilities of Large Language Models (LLMs) and a "learning from mistakes" feedback loop, the authors demonstrate how to generate personalized, intelligible bundles alongside their inferred intents.

Example of high-quality bundles for cameras and books, illustrating clear user intent and thematic coherence.

The Limitations of Traditional Bundling

Traditional bundle generation approaches have several "blind spots" that prevent them from matching human-curated recommendations:

  1. Fixed Constraints: Many models can only generate bundles of a pre-defined size (e.g., always 3 items), which doesn't reflect real-world shopping behavior.
  2. Ignoring Intent: Most systems focus on item co-occurrence (items often bought together) rather than why they belong together. This leads to bundles that lack a clear, intelligible theme.
  3. Static Learning: Standard In-Context Learning (ICL) uses random examples as prompts. If these examples aren't relevant to the current user's session, the LLM's performance suffers.

The authors argue that bundle generation and intent inference are two sides of the same coin: a well-defined bundle reflects a clear intent, and a clear intent helps identify the right products to bundle.

The AICL Framework

The AICL framework consists of three main modules designed to make the LLM "smarter" about the specific task at hand by using a retrieval-augmented generation (RAG) approach.

The overall AICL framework, showing the flow from neighbor retrieval to rule summarization and final inference.

1. Neighbor Session Retrieval (NSR)

Instead of random examples, the system finds the "nearest neighbor" sessions in the training data that are most similar to the target test session using SentenceTransformers. This ensures the model's context is highly relevant to the current user's needs.

2. Adaptive Demonstration Generation (ADG)

This is the core innovation. Before tackling the target session, the LLM "practices" on the neighbor sessions using:

  • Mutual Self-Correction: The LLM refines its generated bundles based on its inferred intents, and vice versa, in a loop.
  • Adaptive Auto-Feedback: The system compares the LLM's practice output against ground-truth data. It provides specific feedback on mistakes (e.g., "you missed a related product").
  • Rules Summarization: Finally, the LLM summarizes "lessons learned" from this practice into a set of general rules.

3. Demonstration Guided Inference (DGI)

The LLM performs the final task on the target session, guided by the tailored demonstrations and the summarized rules it just created.

Key Results and Insights

The researchers evaluated their method on three real-world datasets derived from Amazon: Electronic, Clothing, and Food. These datasets include human-annotated bundles and human-written intents, providing a high-quality benchmark.

  • Superior Performance: AICL consistently outperformed all baselines, including traditional frequent itemset mining and deep learning models like POG and BYOB. On the Electronic dataset, AICL achieved a Precision of 0.679, significantly higher than the best non-LLM baseline (0.423).
  • The "Aha!" of Mutual Reinforcement: Performing bundle generation and intent inference simultaneously improves both. The intent acts as a semantic anchor that prevents the model from bundling unrelated items.
  • Tailored Lessons: By forcing the model to reconcile its errors on similar data before predicting the target, the model effectively "fine-tunes" its strategy on the fly without needing weight updates.
  • Model Scaling: While GPT-3.5 performed well, moving to GPT-4 almost entirely eliminated "bad cases" (like single-item bundles), showcasing the benefit of stronger reasoning capabilities.

Limitations and Future Work

Despite the success, the authors noted areas for improvement. LLMs tend to generate slightly smaller bundles than humans do, suggesting a need for prompts that better control output diversity. Additionally, the iterative feedback loop adds computational overhead; future work will focus on optimizing speed for real-time applications and incorporating multi-modal data like product images to better understand categories like clothing.

Summary updated

BibTeX
@inproceedings{sun2024dynamic,
  author = {Zhu Sun and Kaidong Feng and Jie Yang and Xinghua Qu and Hui Fang and Yew-Soon Ong and Wenyuan Liu},
  title = {{Dynamic In-Context Learning from Nearest Neighbors for Bundle Generation}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2024},
  doi = {10.1145/3626772.3657808},
}
Figure