Contrastive Prompting for Explanation Generation
- The paper demonstrates that CPEG replaces vague user reviews with synthetic, discriminative explanations by contrasting true interacted items against negatives.
- It employs contrastive prompting by integrating positive and hard negative item profiles, compelling the model to isolate key differentiators.
- Empirical findings show significant improvements in explanation quality metrics, validating CPEG’s role within the PGHIS-CPEG-SFT pipeline.
Contrastive Prompting for Explanation Generation (CPEG) is introduced in explainable recommendation as Contrastive Prompting for ground-truth Explanation Generation, a module that generates higher-quality explanation targets by contrasting a true interacted item with negative candidate items and refining outputs through error-aware retry prompting (Liu et al., 8 Jul 2025). In a broader technical sense, CPEG belongs to a contrastive explanation tradition in which explanations are organized around a fact and a foil, or around the question “Why rather than ?”, so that the explanation isolates the difference that makes the difference rather than listing generic supporting information (Miller, 2018, Paranjape et al., 2021). This contrastive orientation also appears in task allocation, commonsense question answering, prompt attribution, and prompt-counterfactual analysis, where explanations are most informative when they discriminate among plausible alternatives rather than justify an output in isolation (Zahedi et al., 2020, Chen et al., 2023, Chang et al., 2024).
1. Conceptual basis and problem setting
In the explainable recommendation formulation, CPEG is introduced to solve a specific supervision problem: many datasets use the user’s review as the “ground-truth explanation,” yet those reviews are often vague, minimal, or non-explanatory, such as “it’s good” or even an emoji (Liu et al., 8 Jul 2025). The consequence is that a downstream explanation model trained on such targets learns to imitate low-information outputs. CPEG is therefore designed to replace or refine weak user-written reviews with stronger synthetic explanations that are more aligned with the user-item interaction and more useful as supervision (Liu et al., 8 Jul 2025).
The method differs from ordinary prompting in three ways. First, explanation quality is tied to a discrimination task: an explanation is accepted only if the reasoning model identifies the correct positive item among negatives. Second, contrast is built directly into the prompt through a positive item and multiple negative items, including hard negatives. Third, incorrect predictions and explanations are reused as explicit error examples in a retry prompt, so the method is not a one-shot generation procedure (Liu et al., 8 Jul 2025).
This design is consistent with the older structural account of contrastive explanation, where an explanation is not merely a cause of , but a causal difference between and a contrast case (Miller, 2018). Related prompting work in commonsense reasoning adopts the same logic by defining a contrastive explanation as an answer to “Why rather than ?”, where is the fact and is the foil, and by preferring discriminative attributes over exhaustive causal lists (Paranjape et al., 2021). This suggests that CPEG is best understood not simply as “prompting for explanations,” but as prompting for explanations that are validated by their ability to separate the selected outcome from competing alternatives.
2. Architecture within the PGHIS-CPEG-SFT pipeline
The full method in which CPEG appears has three stages: PGHIS, CPEG, and SFT (Liu et al., 8 Jul 2025). PGHIS, or Profile Generation via Hierarchical Interaction Summarization, replaces embedding-only user and item representations with textual profiles constructed and iteratively updated by a pretrained LLM. CPEG then uses those profiles to synthesize high-quality explanation targets. Finally, a smaller model is fine-tuned so that inference-time explanation generation is efficient.
The pipeline is organized as follows:
| Stage | Input | Output |
|---|---|---|
| PGHIS | Raw user/item attributes and interaction neighborhoods | Textual user and item profiles |
| CPEG | User profile, positive item profile, negative item profiles, review | Accepted synthetic explanation target |
| SFT | User profile + item profile | Fine-tuned explanation generator |
PGHIS initializes user and item profiles from raw attributes:
0
and then updates them hierarchically using neighboring interaction profiles: 1
2
where the aggregation prompt instructs the model to summarize common features of interacted items or users and update the original profile (Liu et al., 8 Jul 2025).
CPEG then operates on these textual profiles rather than on raw embeddings. Its inputs are the user profile 3, the positive interacted item profile 4, and a set of negative item profiles 5, with the prompt text also stating that the review of the interacted item written by the user may be included (Liu et al., 8 Jul 2025). The use of textual profiles is central to the paper’s overall position that embeddings “lack inherent semantics,” whereas textual profiles provide explicit representations of user and item characteristics (Liu et al., 8 Jul 2025).
At deployment time, CPEG itself is not the main generator. Instead, the accepted synthetic explanations produced by CPEG become supervised fine-tuning targets for Qwen2.5-7B-Instruct, so the final inference-time model maps profile pairs directly to explanations (Liu et al., 8 Jul 2025). This means CPEG functions primarily as a contrastive data-generation module.
3. Prompting mechanism, contrast structure, and formal procedure
CPEG has two substeps: discrimination and refinement (Liu et al., 8 Jul 2025). In the discrimination step, the reasoning model receives a prompt containing the user profile, the positive item profile, and negative item profiles. The system prompt is described as asking the model to find the item the user interacted with and explain why the user would interact with it (Liu et al., 8 Jul 2025). The first-pass generation is formalized as: 6 where 7 is the reasoning process, 8 is the predicted interacted item, and 9 is the generated explanation (Liu et al., 8 Jul 2025).
Negative sampling is explicitly contrastive. The paper uses two types of negatives: hard negatives, defined as semantically similar to the user profile, and random negatives, sampled from the rest of the non-interacted items (Liu et al., 8 Jul 2025). Hard negatives are selected by cosine similarity over profile embeddings: 0 with all-MiniLM-L6-v2 used to embed profiles for this purpose (Liu et al., 8 Jul 2025). This yields a candidate set in which some distractors are close to the user’s interests and others are merely negative.
The refinement step is triggered when the first pass fails. If 1 is correct, the explanation 2 is accepted as a high-quality target. If 3 is wrong, the mistaken prediction 4 and erroneous explanation 5 are retained and inserted into a retry prompt: 6 and the process continues “until the model generates the correct item that the user has interacted with” (Liu et al., 8 Jul 2025). The accepted explanation is then used as the new ground truth.
A notable property is that the method is contrastive procedurally, not via an explicit differentiable contrastive objective. The paper states that CPEG does not define an explicit contrastive loss, ranking loss, pairwise preference loss, or auxiliary loss. Its contrastiveness is implemented through prompt construction, hard negative sampling, correctness filtering, and retry prompting with error examples (Liu et al., 8 Jul 2025). This places it closer to prompt-level discrimination and rejection-based refinement than to metric learning.
The contrastive structure itself has three layers. It contrasts positive vs. negative candidate items, correct vs. incorrect explanations, and hard negatives vs. random negatives (Liu et al., 8 Jul 2025). A plausible implication is that CPEG does not merely seek an explanation that sounds plausible; it seeks an explanation that survives explicit competition with distractors and prior failed explanations.
4. Empirical findings and ablation evidence
The method is evaluated on Amazon-Book, Yelp, and Steam, with 3:1:1 splits and subsets used for profile generation, supervised fine-tuning, and testing (Liu et al., 8 Jul 2025). The full PGHIS-CPEG-SFT system outperforms Att2Seq, NRT, PETER, PEPLER, and XRec on explainability and text-quality metrics, and the abstract reports about 5% improvement on GPTScore as well as 20.6% and 19.6% improvements on BLEU/ROUGE variants (Liu et al., 8 Jul 2025).
The most direct evidence for CPEG itself comes from the Ground Truth Explanation Quality experiment. In that study, GPT-3.5 acts as judge and compares user-written reviews, XRec-generated ground truths, and several CPEG variants. The paper reports that CPEG explanations significantly outperform both user reviews and XRec-generated ground truths, with best-reported win rates of 86.7% and 93.0% on Amazon-Books and Steam (Liu et al., 8 Jul 2025).
Hard negatives matter materially. Compared to using only 7 random negatives, adding 2 hard negatives + 5 random negatives improves win rate by 7.1% and 7.6% on the two datasets considered in that comparison (Liu et al., 8 Jul 2025). The authors also report a tradeoff: more hard or random negatives can further improve explanation quality, but they make correct selection harder for the reasoning model, which increases retries and computational cost, and gains eventually diminish. The selected setting is: 7 for hard and random negatives, respectively (Liu et al., 8 Jul 2025).
The paper does not provide an ablation that removes CPEG alone from the full system. Instead, ablations focus mainly on PGHIS variants such as w/o Fine-tuning, w/o PGHIS-user, w/o PGHIS-item, and w/o PGHIS (Liu et al., 8 Jul 2025). Consequently, the strongest direct evidence for CPEG is the ground-truth quality comparison and the hard-negative study, rather than a clean component-removal experiment.
A qualitative case study further reports that even when the original review is extremely weak, such as only an emoji, CPEG can still generate a plausible explanation of why the user interacted with the item, and the fine-tuned model later produces outputs close to the CPEG ground truth (Liu et al., 8 Jul 2025). This reinforces the specific role of CPEG as supervision repair.
5. Relation to adjacent contrastive explanation methods
CPEG sits within a larger family of contrastive explanation methods, but its exact instantiation is domain-specific. In commonsense reasoning, prompt-based contrastive explanations have been used to compare answer alternatives through discriminative attributes, such as “Peanuts are salty while raisins tend to be sweet,” and to condition downstream answer prediction on generated explanations (Paranjape et al., 2021). That work uses manually derived contrastive templates, neutralized context 8, multiple candidate explanations, and marginalization over explanations, and it reports that human annotators spontaneously gave contrastive explanations in 76% of Winogrande and 64% of PIQA pilot examples (Paranjape et al., 2021). In multiple-choice QA, CPACE similarly converts symbolic knowledge into contrastive natural-language explanations using templates such as “Given concept sets 9, the difference among them is ...”, and then feeds those explanations back into inference (Chen et al., 2023).
In other application areas, contrastive explanation is realized through different substrates. In negotiation-aware task allocation, negotiation-tree based explanations are used to answer counterfactual challenges about alternative allocations, and human studies report that such explanations are more convincing than vacuous baselines (Zahedi et al., 2020). In prompt attribution and prompt-focused interpretability, XPrompt formulates generation explanation as combinatorial search over prompt subsets whose masking most reduces support for the original full output sequence (Chang et al., 2024), while CELL explains an LLM response through nearby prompt edits that induce a less preferable or contradictory reply under a user-defined scoring function (Luss et al., 2024). Prompt-Counterfactual Explanations extend counterfactual explanation to stochastic generative systems by searching for minimal prompt elements whose removal moves a downstream classifier-defined behavior across a threshold (Goethals et al., 6 Jan 2026).
Prompting methods that contrast positive and negative reasoning traces are also closely related. Contrastive Chain-of-Thought Prompting augments each demonstration with both valid and invalid reasoning chains, formalized as
0
and shows consistent gains across arithmetic and factual QA (Chia et al., 2023). Contrastive Prompting in zero-shot reasoning asks the model to “give a correct and a wrong answer,” then extracts the correct answer in a second stage, substantially improving performance in several reasoning benchmarks (Yao, 2024). More recent prompt optimization work, such as ContraPrompt, treats the difference between failed and successful reasoning traces on the same input as optimization signal and organizes extracted rules into an input-aware decision tree (Rishav et al., 20 Apr 2026). These systems are not CPEG in name, but they show that contrastive prompting can operate over answers, rationales, exemplars, prompt subsets, or retry traces.
This broader literature suggests that the distinctive contribution of CPEG is not the abstract idea of contrast alone, but the combination of profile-based recommendation context, candidate-item discrimination, hard-negative sampling, and error-aware explanation retry (Liu et al., 8 Jul 2025).
6. Limitations, controversies, and open directions
The most explicit limitations of CPEG are methodological rather than conceptual. The method has high computational cost because it uses a strong reasoning model, candidate sampling, and potentially multiple retries (Liu et al., 8 Jul 2025). Explanation quality is validated by whether the reasoning model selects the correct item among sampled candidates, which assumes that the candidate set is representative and that successful discrimination correlates with explanation quality (Liu et al., 8 Jul 2025). The method also has no explicit training objective for CPEG, since it is prompt-engineered rather than trained with a formal contrastive loss (Liu et al., 8 Jul 2025). Reproduction is constrained by limited prompt specification, and ground-truth quality is judged by GPT-3.5, which introduces LLM-as-judge subjectivity (Liu et al., 8 Jul 2025). Finally, the prompt may include the user’s review of the interacted item, which improves supervision construction but means the synthetic explanation can depend on evidence unavailable at deployment time (Liu et al., 8 Jul 2025).
The wider contrastive explanation literature exposes additional open issues. In commonsense prompting, generated explanations are more relevant and helpful than non-contrastive alternatives, but fine-tuned task models can rely less on explanations than zero-shot ones, and extending contrastive prompting to more open-ended tasks remains future work (Paranjape et al., 2021). In contrastive QA explanation, the gap between generated and ground-truth explanations indicates substantial remaining headroom in explanation quality and possibly faithfulness (Chen et al., 2023). Prompt-attribution methods such as XPrompt explain counterfactual prompt-output relationships but explicitly state that the underlying generation mechanism remains a black box (Chang et al., 2024). CELL provides contrastive evidence through prompt edits, but not polished natural-language rationales (Luss et al., 2024). Prompt-counterfactual explanations depend on downstream classifier quality and can be computationally expensive because they require repeated stochastic generation and subset search (Goethals et al., 6 Jan 2026).
A plausible implication is that future CPEG systems will need to combine several strands: explicit contrastive prompting, better control over hard-negative construction, stronger faithfulness tests, and more transparent conversion from contrastive evidence into human-facing explanation text. The available work already suggests a stable technical principle, however: explanations improve when they are forced to discriminate among realistic alternatives rather than merely to justify a chosen output (Miller, 2018, Liu et al., 8 Jul 2025).