Controlling Output Rankings in Generative Engines for LLM-based Search Haibo Jin, Ruoxi Chen, Peiyan Zhang, Yifeng Luo, Huimin Zeng, Man Luo, Haohan Wang Abstract The way customers search for and choose products is changing with the rise of large language models (LLMs). LLM-based search, or generative engines, provides direct product recommendations to users, rather than traditional online search results that require users to explore options themselves. However, these recommendations are strongly influenced by the initial retrieval order of LLMs, which disadvantages small businesses and independent creators by limiting their visibility. In this work, we propose CORE, an optimization method that C ontrols O utput R ankings in g E nerative Engines for LLM-based search. Since the LLM’s interactions with the search engine are black-box, CORE targets the content returned by search engines as the primary means of influencing output rankings. Specifically, CORE optimizes retrieved content by appending strategically designed optimization content to steer the ranking of outputs. We introduce three types of optimization content: string-based, reasoning-based, and review-based, demonstrating their effectiveness in shaping output rankings. To evaluate CORE in realistic settings, we introduce ProductBench, a large-scale benchmark with 15 product categories and 200 products per category, where each product is associated with its top-10 recommendations collected from Amazon’s search interface. Extensive experiments on four LLMs with search capabilities (GPT-4o, Gemini-2.5, Claude-4, and Grok-3) demonstrate that CORE achieves an average Promotion Success Rate of 91.4% @Top-5 , 86.6% @Top-3 , and 80.3% @Top-1 , across 15 product categories, outperforming existing ranking manipulation methods while preserving the fluency of optimized content. 1 Introduction Consider an example where Alice wants to buy a good camera. In the past, she would type keywords into search engines like Google, Bing, or Amazon, scroll through long lists of links, and spend time comparing products across multiple webpages. Nowadays, with the help of LLM-based search, also termed as generative engines ( 1 ) , she can simply ask the LLM for a recommendation. Fig. 1 ( blue box ) illustrates what happens when Alice asks an LLM for a recommendation. She submits her camera query to the model, which analyzes the request and forwards it as search queries to external engines such as Google, Bing, or Amazon, as shown in the left half of the blue box. The choice of which engines to query is determined during system design rather than by end-users at runtime. Once the engines return results in a structured format, the LLM synthesizes and summarizes the retrieved information to produce a ranked list of recommendations, enabling Alice to efficiently compare options and make a purchase decision, as shown in the remainder of the blue box. Figure 1 : Overview of how the LLM processes Alice’s query ( blue box ) and how output ranking is controlled by CORE ( orange box ), where the Hello Kitty camera, originally the lowest-ranked result, becomes the top-1 item when applied to CORE-optimized content. At first glance, Alice saves time by avoiding extensive link browsing, seemingly shifting the entire burden of product comparison from the user to the LLM. However, our analysis shows that the final recommendations Alice sees are still largely determined by the initial order of results returned by the search engines, even after LLM summarizes and re-ranks. This dependency is subtle and often overlooked, yet it plays a decisive role in shaping what Alice ultimately encounters. While this efficiency clearly benefits Alice, it risks disadvantaging small businesses and independent creators, whose products may be buried in the retrieval results and thus remain invisible in the final recommendations. These concerns have motivated recent research into improving visibility within generative engines. Early work focused either on website design and visibility metrics ( 1 ) or on recommendation rankings ( 18 ; 16 ; 15 ) , often through incoherent predefined prompt injection attacks ( 15 ; 25 ) . More recent studies ( 12 ; 21 ; 24 ) have investigated stealthy prompt-level strategies to boost product rankings, though these approaches rely on white-box assumptions. In practice, (1) the choice of search engines is determined by developers and lies outside end-user control, and (2) widely deployed LLMs with search capabilitiesoperate in black-box settings, where users can interact only through queries and outputs. To this end, we introduce CORE, an optimization method for C ontrolling O utput R ankings in g E nerative engines for LLM-based search in black-box settings. We formulate the output ranking task as an optimization problem and develop both shadow-model and query-based solutions. Building on these solutions, CORE incorporates three types of optimization content: string-based, reasoning-based, and review-based, which are applied to the retrieved content from search engines and can further control the final output ranking, as illustrated in Fig. 1 ( orange box ). Furthermore, to simulate a realistic search environment, we construct ProductBench, a benchmark for evaluating output ranking control in product search. ProductBench spans 15 product categories, each containing 200 products. For each product, we retrieve the top-10 recommended items from Amazon’s search interface, forming a large-scale candidate pool. Extensive experiments on four LLMs with search capabilities (GPT-4o, Gemini-2.5, Claude-4, and Grok-3) show that, under the best optimization strategy, CORE achieves average promotion success rates of 91.4% @Top-5 , 86.6% @Top-3 , and 80.3% @Top-1 across all categories, validating the effectiveness of controlling output rankings in LLM-based search. Our main contributions are as follows: • We propose CORE , an optimization method that C ontrols O utput R ankings in g E nerative Engines for LLM-based search by optimizing content appended to target items to influence their final ranking positions. • We introduce ProductBench , a benchmark spanning 15 product categories with 200 products each, constructed from Amazon’s top-10 search recommendations. • Experiments on four search-enabled LLMs that, under the best optimization strategy, CORE achieves average promotion success rates of 91.4% @Top-5 , 86.6% @Top-3 , and 80.3% @Top-1 across all categories. 2 Background The study of visibility in online search has evolved with advances in search technology. Early work on Search Engine Optimization (SEO) focused on improving webpage rankings through practices such as meaningful URLs and descriptive alt-text, while prohibiting manipulative “black-hat” methods like keyword stuffing or link farming ( 20 ; 13 ; 5 ; 6 ) . With the rise of LLM-based search, traditional SEO no longer fully explains how content reaches users, as they increasingly rely on LLMs to generate recommendations rather than searching by themselves. This motivated the notion of Generative Engine Optimization (GEO) , which extends website design principles to generative engines by studying how retrieved webpages are cited, quoted, and integrated into LLM outputs ( 1 ) . While GEO emphasizes the role of website design in shaping visibility, it remains tied to the retrieval stage, where the choice of search engine is fixed and lies beyond user control. Later, research shifted from website design to directly influencing LLM outputs. A growing body of work ( 18 ; 16 ) studies direct instruction injection, such as predefined prompts like “Ignore previous instruction” ( 15 ; 25 ) , to manipulate LLM-based search. These studies show that such injected instructions can steer model outputs toward attacker-preferred items. However, these predefined instructions are often easily detectable, as they lack coherence with the surrounding content. More recent studies explore control product rankings under stronger assumptions, such as white-box access to model internals ( 12 ) . These methods generate more subtle inputs, including modifying words in the original text to introduce latent bias ( 17 ) , or using gradient-based token search to produce adversarial inputs that can manipulate LLM behavior ( 26 ; 21 ; 24 ) . Although these approaches achieve higher semantic coherence with the original content, they depend on unrealistic attacker capabilities that do not hold in real-world LLM-based search settings, where interaction is limited to query–output access. Key differences. Unlike SEO and GEO, which focus on webpage design and depend on search engine decisions beyond user control, our work focuses on the synthesis stage, where retrieved results are integrated and reordered into the final ranked list. In contrast to direct instruction injection methods, our approach emphasizes semantic consistency across the entire item description. Moreover, unlike white-box methods that require access to model internals, we target real-world settings with only query–output access. Finally, our approach is fundamentally different from applications of jailbreak attack ( 10 ; 11 ) , which also control model outputs but aim to elicit developer-forbidden content, whereas we operate entirely within allowed content and only influence ranking outcomes in LLM-based search. 3 Methodology Figure 2 : Overview of CORE. (a) Shadow-model optimization uses a shadow model to approximate the synthesizing LLM and directly compute ranking gradients. (b) Query-based optimization interacts with the LLM through iterative feedback, adjusting item text with reasoning-, and review-based content to guide the target item toward the desired ranking. 3.1 Threat Model Scope. We consider LLM-based search, as illustrated in Fig. 1 , where we assume no control over the LLM or the retrieval process, both fixed by model developers. The only modifiable part is the text of items shown in the search results, such as product names, descriptions, or reviews. Goal. The goal is to promote a designated item by improving its position in the final ranked output ( e.g., , rank it into Top-1). We consider black-box settings, where we have no access to target models’ internals and can only interact with the system through inputs and the ranked outputs. 3.2 Problem Definition Consider autoregressive language models, given a context sequence x_{1:n} , the probability of generating the next token is p_{\theta}(x_{n+1}\mid x_{1:n}) , and the probability of generating a full output sequence y=(x_{n+1},\dots,x_{n+m}) is p_{\theta}(y\mid x_{1:n})=\prod_{i=1}^{m}p_{\theta}(x_{n+i}\mid x_{1:n+i-1}) . LLM Ranking. In the setting of LLM-based search, a user issues a query q , and the generative engine retrieves a candidate item set \mathcal{I}=\{i_{1},\dots,i_{n}\} from an external search engine. Each item i_{j} is associated with textual attributes such as title, description, or reviews. The LLM then produces an output sequence R(q,\mathcal{I}) that integrates and ranks these items, represented as: R(q,\mathcal{I})=[i_{(1)},i_{(2)},\dots,i_{(n)}] (1) where i_{(1)} denotes the top-1 rank item. Ranking Objective. Let i^{\star}\in\mathcal{I} be the designated target item with associated text T(i^{\star}) . Our goal is to modify T(i^{\star}) into an optimized version T^{\prime}(i^{\star}) such that i^{\star} is ranked as high as possible in R(q,\mathcal{I}) . Formally, let z(T(i^{\star})) denote a desirable ranked output in which the optimized text of i^{\star} places it within the top- k positions. The ranking objective is defined as \mathcal{L}(q,\mathcal{I};T(i^{\star}))=-\log p_{\theta}\big(z(T(i^{\star}))\mid q,\mathcal{I}\big) (2) where p_{\theta}(z(T(i^{\star}))\mid q,\mathcal{I}) is the probability that the LLM generates an output placing i^{\star} in the desired top- k positions given its textual content. Optimizing T(i^{\star}) to minimize \mathcal{L}(q,\mathcal{I};T(i^{\star})) increases the likelihood that the generative engine ranks the target item more favorably. 3.3 Optimization Strategy The objective function \mathcal{L}(q,\mathcal{I};T(i^{\star})) encourages the target item i^{\star} to appear in the top- k positions of the ranked list R(q,\mathcal{I}) . To solve this optimization, we operate in the continuous embedding space of the textual representation. Gradient-based Update. Let \tilde{T}^{(n)} denote the embedding representation of the target text after n updates. We iteratively update it by gradient descent: \tilde{T}^{(n+1)}\;\leftarrow\;\tilde{T}^{(n)}-\eta\nabla_{\tilde{T}}\mathcal{L}\big(q,\mathcal{I};\tilde{T}^{(n)}\big) (3) where \eta>0 is the step size. To improve exploration and avoid poor local optima, Gaussian noise \epsilon^{(n)}\sim\mathcal{N}(0,\sigma^{2}I) may be added at each iteration. The detailed discussion about the Gaussian noise can be found in Appendix H . Discrete Reconstruction. After N updates, we decode the optimized embedding \tilde{T}^{(N)} back into a discrete sequence T^{\prime}(i^{\star}) . The optimized text T^{\prime}(i^{\star}) is then inserted into the candidate set \mathcal{I} , yielding a modified input (q,\mathcal{I}^{\prime}) where \mathcal{I}^{\prime}=\mathcal{I}\setminus\{i^{\star}\}\cup\{i^{\star},T^{\prime}(i^{\star})\} . Then the optimization problem can be summarized as: T^{\prime}(i^{\star})=\arg\min_{T}\;\mathcal{L}(q,\mathcal{I};T) (4) This ensures that the optimized text T^{\prime}(i^{\star}) maximizes the probability of the target item being ranked in the desired top- k positions by the generative engine. 3.4 C ontrolling O utput R ankings in g E nerative engines To address the optimization problem, we propose CORE, an optimization method for C ontrolling O utput R ankings in g E nerative engines for LLM-based search. An overview of the CORE is illustrated in Fig. 2 . CORE includes two solutions based on the accessibility to sufficient computational resources: (1) a shadow-model solution, which leverages a shadow model to mimic the behavior of the synthesizing LLM and directly compute Eq. 4 , and (2) a query-based solution, which employs LLMs to approximate gradient propagation without explicit access to model internals. 3.4.1 Shadow-Model-Based Output Ranking Control The first solution of CORE employs a shadow model that mimics the behavior of the synthesizing LLM. As shown in Fig. 2 (a), we assume that the behavior of the synthesizing LLM, denoted by \theta , can be approximated by a shadow model \theta^{\prime} by a few-shot prompting. Then to construct this shadow model, we collect a small set of input–output samples from the target LLMs, where each sample consists of a query q , a candidate set \mathcal{I} , and the corresponding ranked output R(q,\mathcal{I}) . These few-shot examples are then used to align the shadow model’s outputs with the content and format of the original LLM, enabling \theta^{\prime} to mimic the ranking behavior of \theta . Few-shot examples can be found in Appendix B.1 . Once the shadow model is established, CORE optimizes the ranking objective by directly computing gradients with respect to the textual representation of the target item. The shadow model thus provides \nabla_{T(i^{\star})}\mathcal{L}(q,\mathcal{I};T(i^{\star})) , which guides iterative updates in the embedding space of the target text. Through repeated refinement, the optimized version T^{\prime}(i^{\star}) emerges, promoting the target item into higher positions of the output ranking. 3.4.2 Query-based Output Ranking Control The second solution targets settings without access to sufficient computational resources, in which the ranking objective in Eq. 4 cannot be directly optimized through a shadow model. To overcome this, CORE reformulates the optimization process as an iterative generator–optimizer loop, as shown in Fig. 2 (b). Generator Initialization. Given a query q , a candidate set \mathcal{I} , and a target ranking R^{\text{target}} , we first introduce a generator G to hypothesize how the retrieved search results can be reasonably re-ranked into the ranking list R^{\text{target}} from the user’s perspective. The generator produces an initial reasoning draft C^{(0)} that provides a structured rationale, serving as the optimization starting point. Append-and-Query. At each iteration t , CORE appends the current draft C^{(t)} to the text of the target item i^{\star} , yielding an updated version T^{(t)}(i^{\star}) . The modified candidate set \mathcal{I}^{(t)} is then input to the synthesizing LLM, which outputs a new ranked list R^{(t)} . This step treats the LLM as a black box: the only observable signal is the ranking itself. Optimizer Feedback. An optimizer \mathcal{O} evaluates the similarity between the generated ranking R^{(t)} and the target ranking R^{\text{target}} using a rank-based similarity score S . If the similarity S^{(t)} falls below a predefined threshold \tau , the optimizer proposes revisions to the draft, yielding C^{(t+1)} . This loop continues until the similarity exceeds \tau or a maximum iteration budget is reached. Strategies. To instantiate this process, we design two strategies inspired by recent findings that the chain-of-thought (COT) reasoning process strongly shapes LLM decision-making ( 14 ; 22 ) . (1) In the reasoning-based strategy , the generator constructs a rationale that mirrors a user’s logical reasoning over the retrieved results, aligning with the LLM’s own internal reasoning structure. (2) In the review-based strategy , we adapt the CoT-style rationale to the Amazon product search setting, rewriting the draft in a past-tense ( 2 ) , review-like narrative that resembles authentic purchase experiences (e.g., “After buying this item, I compared it to alternatives and found…”). The full prompt templates for both strategies, are provided in the Appendix B.2 . 3.5 ProductBench Construction To evaluate CORE in realistic settings, we construct ProductBench , a large-scale benchmark from Amazon search results. It spans 15 product categories (Appendix D ), each with 200 products. We then design a three-stage pipeline to collect and structure the data: • Querying the search interface. For every product, we issue a query to Amazon’s search interface and collect the top-10 returned product links as candidate items for ranking manipulation evaluation. • Extracting product pages. We implement a Selenium-based crawler with rotating user agents, cookie injection, and headless browsing to ensure robust scraping. For each candidate link, the crawler retrieves the corresponding product page and parses its HTML content. • Structured data extraction. A YAML-based template specifies key attributes to be extracted, including product name , price , short description , images , rating , number of reviews , long description , and review links . Products with valid names and descriptions are retained. All extracted information is stored in JSONL format and subsequently provided as input to the synthesizing LLM. 4 Experiments Table 1 : Promotion Success Rate on ProductBench across 15 categories. Model Method Home & Kitchen Tools & Home Improvement Electronics Sports & Outdoors Health & Household Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 GPT-4o Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 55.0% 45.5% 33.0% 54.5% 44.0% 32.5% 57.0% 46.0% 34.5% 56.0% 45.0% 34.0% 55.5% 45.5% 33.5% Reasoning 92.0% 87.0% 81.0% 93.0% 88.0% 82.5% 94.5% 89.5% 84.0% 92.5% 87.5% 82.0% 93.5% 88.0% 83.0% Review 89.5% 85.0% 79.0% 90.0% 85.5% 80.0% 91.0% 86.0% 80.5% 90.5% 85.5% 80.0% 91.5% 86.5% 81.0% Gemini-2.5 Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 53.5% 43.0% 31.0% 52.5% 42.5% 31.0% 54.0% 43.5% 32.0% 55.0% 44.0% 32.5% 53.0% 43.5% 31.5% Reasoning 88.5% 84.0% 77.5% 87.0% 83.0% 77.0% 89.0% 85.0% 78.5% 87.5% 83.5% 77.5% 88.0% 84.0% 78.0% Review 94.5% 89.5% 83.5% 95.0% 90.0% 84.0% 96.0% 91.0% 85.0% 95.5% 91.5% 85.5% 94.0% 90.0% 84.0% Claude-4 Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 58.0% 46.5% 34.0% 57.5% 46.0% 33.5% 59.0% 47.5% 34.5% 58.5% 47.0% 34.5% 57.5% 46.5% 34.0% Reasoning 95.0% 90.0% 83.5% 92.5% 88.0% 81.0% 96.0% 91.0% 85.0% 94.5% 90.0% 84.0% 95.5% 91.0% 84.5% Review 93.5% 89.0% 82.0% 95.5% 90.5% 83.5% 94.0% 89.5% 83.0% 96.5% 91.5% 85.0% 94.0% 89.5% 83.0% Grok-3 Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 51.5% 42.0% 30.5% 52.0% 42.5% 31.0% 50.5% 41.5% 30.0% 53.0% 43.0% 31.5% 51.0% 42.0% 30.5% Reasoning 88.0% 83.0% 77.0% 89.5% 84.0% 78.5% 87.0% 82.5% 76.5% 89.0% 84.5% 78.5% 88.5% 83.0% 77.5% Review 90.5% 85.0% 78.5% 88.0% 83.5% 77.0% 91.5% 86.0% 79.0% 89.0% 84.5% 78.5% 90.0% 85.0% 79.0% Model Method Beauty & Personal Care Automotive Toys & Games Clothing, Shoes & Jewelry Pet Supplies Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 GPT-4o Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 61.0% 49.0% 37.0% 60.0% 48.0% 36.0% 59.5% 47.0% 35.0% 60.5% 47.5% 35.5% 61.0% 48.5% 36.0% Reasoning 94.0% 89.0% 82.0% 92.5% 88.0% 81.0% 94.5% 89.5% 83.0% 93.0% 88.0% 82.0% 94.0% 89.0% 83.0% Review 96.0% 91.0% 85.0% 95.5% 90.0% 84.0% 93.0% 88.5% 82.0% 95.0% 90.0% 84.0% 94.5% 89.5% 83.5% Gemini-2.5 Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 58.0% 47.0% 34.5% 57.5% 46.0% 34.0% 58.5% 47.5% 35.0% 57.0% 46.5% 34.5% 58.0% 47.0% 35.0% Reasoning 90.0% 85.0% 78.0% 91.5% 86.0% 79.5% 89.0% 84.0% 78.0% 90.5% 85.0% 79.5% 89.5% 84.5% 78.5% Review 93.0% 88.0% 82.0% 95.0% 90.0% 84.0% 94.0% 89.0% 83.0% 95.5% 90.5% 84.5% 94.5% 89.0% 83.5% Claude-4 Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 60.0% 48.5% 36.5% 61.0% 49.0% 37.0% 60.5% 48.5% 36.5% 61.0% 49.0% 37.0% 60.0% 48.0% 36.0% Reasoning 96.0% 91.0% 84.0% 95.5% 90.5% 84.0% 94.5% 90.0% 83.0% 95.0% 90.0% 83.5% 96.5% 91.5% 84.5% Review 94.0% 89.5% 83.0% 95.5% 90.0% 84.0% 93.5% 89.0% 82.5% 94.5% 89.5% 83.0% 94.0% 89.0% 82.5% Grok-3 Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 55.0% 44.5% 33.0% 56.0% 45.0% 33.5% 55.5% 44.5% 33.0% 56.0% 45.0% 33.5% 55.5% 44.5% 33.0% Reasoning 89.0% 84.0% 78.0% 88.5% 83.5% 77.5% 89.5% 84.5% 78.5% 88.0% 83.0% 77.0% 89.0% 84.0% 78.0% Review 92.0% 87.0% 81.0% 93.0% 88.5% 81.5% 92.5% 87.5% 81.0% 93.5% 88.5% 82.0% 92.0% 87.0% 81.0% Model Method Grocery & Gourmet Food Office Products Computers & Accessories Luggage & Travel Gear Industrial & Scientific Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 GPT-4o Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 59.0% 46.0% 35.0% 60.5% 50.0% 36.5% 61.0% 50.5% 37.0% 59.5% 47.0% 35.5% 57.5% 46.5% 35.0% Reasoning 92.5% 87.5% 81.0% 93.5% 89.0% 83.0% 94.5% 89.5% 83.5% 94.0% 88.0% 82.5% 93.0% 87.5% 81.5% Review 95.0% 90.0% 84.0% 94.5% 89.5% 83.5% 95.5% 91.0% 85.0% 94.0% 89.5% 83.5% 95.0% 90.0% 84.0% Gemini-2.5 Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 57.0% 46.0% 34.5% 58.0% 49.0% 36.0% 59.0% 49.5% 36.5% 56.5% 45.5% 35.0% 56.0% 45.0% 34.5% Reasoning 91.0% 86.0% 80.0% 92.0% 87.0% 81.0% 93.0% 88.0% 82.0% 91.5% 86.5% 80.5% 90.5% 85.5% 80.0% Review 96.0% 91.0% 85.0% 97.5% 92.0% 85.5% 95.5% 90.0% 84.0% 96.0% 91.0% 85.0% 95.0% 90.0% 84.0% Claude-4 Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 60.0% 49.0% 37.0% 61.0% 50.5% 38.0% 62.0% 51.0% 38.5% 59.5% 48.5% 37.5% 58.5% 47.5% 37.0% Reasoning 95.0% 90.0% 83.5% 96.0% 91.0% 84.5% 97.0% 92.0% 85.5% 95.5% 90.5% 84.0% 94.5% 89.5% 83.5% Review 100.0% 95.0% 88.0% 100.0% 95.5% 88.5% 99.5% 94.5% 88.0% 99.0% 94.0% 88.0% 98.5% 93.5% 87.5% Grok-3 Baseline 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% String 56.0% 45.5% 34.0% 56.5% 46.0% 34.5% 57.5% 47.0% 35.0% 55.5% 45.0% 33.5% 55.0% 44.5% 33.0% Reasoning 90.5% 85.5% 80.0% 91.0% 86.0% 80.5% 92.0% 87.0% 81.0% 91.5% 86.5% 80.5% 91.0% 86.0% 80.0% Review 95.5% 90.5% 84.5% 96.5% 91.5% 85.5% 96.0% 91.0% 85.0% 95.0% 90.0% 84.0% 94.5% 89.5% 84.0% Table 2 : Promotion success rate with existing rankings methods on Home & Kitchen. Method GPT-4o Gemini-2.5 Claude-4 Grok-3 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 CORE-String 55.0% 45.5% 33.0% 53.5% 43.0% 31.0% 58.0% 46.5% 34.0% 51.5% 42.0% 30.5% CORE-Reasoning 92.0% 87.0% 81.0% 88.5% 84.0% 77.5% 95.0% 90.0% 83.5% 88.0% 83.0% 77.0% CORE-Review 89.5% 85.0% 79.0% 94.5% 89.5% 83.5% 93.5% 89.0% 82.0% 90.5% 85.0% 78.5% STS 54.0% 44.0% 32.5% 53.0% 42.5% 31.5% 57.0% 45.0% 33.5% 52.0% 42.0% 30.0% TAP 61.0% 47.5% 34.0% 49.5% 39.5% 29.5% 62.5% 48.5% 34.5% 50.0% 40.5% 29.5% SRP 72.5% 58.0% 42.0% 68.0% 54.5% 40.0% 75.0% 59.5% 43.5% 65.5% 52.0% 38.5% RAF 78.0% 61.0% 44.0% 70.0% 57.0% 46.0% 76.5% 64.0% 48.5% 71.5% 53.5% 41.0% 4.1 Experimental Setup Models. We evaluated four LLMs: GPT-4o ( 8 ) ( gpt-4o-2024-11-20 ), Gemini-2.5 Pro ( 4 ) ( gemini-2.5-pro ), Claude-4 ( 3 ) , and Grok-3 ( 23 ) . All models were accessed via their official APIs with default parameters. Metrics. We evaluate the performance of CORE using two metrics. Promotion Success Rate (PSR) measures the probability that a targeted product appears within the Top- k positions after optimization. Formally, \text{PSR@}k=\tfrac{1}{N}\sum_{i=1}^{N}\mathbf{1}[r_{i}\leq k] , where r_{i} is the observed rank of the targeted product in trial i and N is the total number of evaluation trials. We report results for Top- 5 , Top- 3 , and Top- 1 . In addition, we compute Perplexity Scores using GPT-2 ( 19 ) to assess the fluency and naturalness of optimized content. Lower perplexity values indicate more fluent outputs, ensuring that optimization strategies do not degrade linguistic quality and making the responses harder for perplexity-based detectors to flag as unnatural. Implementation Details. For the shadow-model setting, we adopt Llama-3.1-8B ( 7 ) as the shadow model and perform optimization for 2000 iterations. The initial string is set to a length of 20 and initialized with the character “!”, corresponding to the string-based method. For the query-based setting, the Generator and Optimizer use the same LLM as the one being evaluated (e.g., when evaluating GPT-4o, both the Generator and Optimizer are GPT-4o), unless specified otherwise in ablation studies. The similarity threshold \tau is set to 0.7, corresponding to the review- and reasoning-based methods. For each product, we select the last item in the retrieved list as the promotion target, and use the original ranking as the baseline. 4.2 Performance of CORE on ProductBench We evaluate CORE on ProductBench to examine how different optimization strategies affect output rankings across models and domains. Table 1 reports PSR for 15 categories on four LLMs. The baseline success rate is 0%, since LLM outputs largely follow the retrieval order, leaving items at the end of the list almost no chance of reaching the Top- k . This confirms that ranking in LLM-based search is strongly constrained by upstream retrieval. Applying CORE yields substantial improvements. Reasoning- and review-based strategies consistently achieve Top-3 PSR above 85% and Top-1 near or above 80%, though their relative strength varies by model. GPT-4o and Claude-4 respond more to reasoning, whereas Gemini-2.5 and Grok-3 favor review-style content, revealing model-specific biases in how retrieved signals are integrated. Performance is robust across all 15 categories, with review strategies particularly strong in “Beauty & Personal Care” and “Clothing, Shoes & Jewelry,” while reasoning excels in “Electronics” and “Tools & Home Improvement.” Claude-4 achieves the highest overall rates (often above 95% in Top-5), while Grok-3 is less responsive. Visualizations of CORE strategies and the API cost of content generation are provided in Appendix F and Appendix L , respectively. 4.3 Comparison with Existing Ranking Methods To further evaluate the effectiveness of CORE, we compare it with representative methods for influencing rankings in LLM-based search. Specifically, we compare CORE with STS ( 12 ) , a white-box optimization method; TAP ( 18 ) , a prompt-injection based method; SRP ( 21 ) , a stealthy prompt-level manipulation method; and RAF ( 24 ) , a optimization-based method. We follow the experimental configurations reported in their original studies and adopt Llama-3.1-8B as the generating model, transferring the optimized content to our test models (GPT-4o, Gemini-2.5, Claude-4, and Grok-3) on the Home & Kitchen category. As shown in Table 2 , we find that STS achieves performance comparable to CORE-String, with strong transferability across models but limited absolute gains. TAP performs inconsistently: in some cases approaching String-level improvements, but never reaching the effectiveness of CORE-Reasoning or CORE-Review. SRP and RAF generally outperform String-based, yet their cross-model transfer is less reliable, leading to larger performance gaps between models. By contrast, CORE’s Reasoning and Review strategies consistently deliver higher promotion success rates across all models, showing both stronger effectiveness and robustness to transfer. More results can be found in Appendix E . 4.4 Fluency of Optimization Content Perplexity-based Evaluation of Fluency . We assess fluency by measuring perplexity averaged across all categories (Table 3 ). The baseline serves as a natural language threshold around 30. String-based content yields extremely high values (1k–2k) from repetitive or non-linguistic strings, making it trivially detectable. Reasoning-based strategies give moderately higher scores, as longer insertions increase uncertainty and disrupt coherence. Review-based strategies stay close to the baseline, slightly higher due to lexical variation. Overall, while string content is easily flagged by abnormally high perplexity, reasoning and review remain fluent and hard to distinguish from natural outputs, underscoring CORE’s risks in real-world systems. Table 3 : Average perplexity scores across categories. Model Baseline String Reasoning Review GPT-4o 30.84 1,526.84 72.45 31.87 Gemini-2.5 31.11 1,488.32 68.22 32.65 Claude-4 29.95 1,572.15 75.11 31.23 Grok-3 30.47 1,505.67 70.88 32.14 Human Evaluation of Fluency . Since perplexity cannot fully capture human perception, we conducted a study with 20 annotators. Each was shown five samples from the four strategies (baseline, string, reasoning, review) and asked to rate fluency on a 5-point scale and judge whether the content was manipulated. Table 4 : Human evaluation results. Fluency is rated on a 1–5 scale. Strategy Fluency (1–5) Detection Rate (%) Baseline 4.7 12.0 String 1.2 98.5 Reasoning 3.7 62.1 Review 4.6 18.4 Table 4 summarizes the outcomes. String-based content was unanimously judged unnatural and trivially detectable (fluency 1.2; detection \sim 99%). Reasoning-based content showed moderate fluency (3.7) but higher detection (62%) than the baseline. Review-based content closely matched the baseline (4.6 vs. 4.7) with only a slight rise in detection (18% vs. 12%). Overall, string strategies are trivially detectable, whereas reasoning and review remain natural to readers. Table 5 : Ranking distributions under six insertion orders on Home & Kitchen. Position GPT-4o Gemini-2.5 Claude-4 Grok-3 1st Rank 2nd Rank 3rd Rank 1st Rank 2nd Rank 3rd Rank 1st Rank 2nd Rank 3rd Rank 1st Rank 2nd Rank 3rd Rank 1st String 4.0% 20.0% 76.0% 3.0% 21.0% 76.0% 5.0% 19.5% 75.5% 2.5% 22.0% 75.5% 2nd Reasoning 38.0% 44.5% 17.5% 35.0% 46.0% 19.0% 36.0% 45.0% 19.0% 34.0% 47.0% 19.0% 3rd Review 58.0% 35.5% 6.5% 62.0% 33.0% 5.0% 59.0% 34.5% 6.5% 61.0% 33.5% 5.5% 1st String 2.5% 24.0% 73.5% 3.0% 23.0% 74.0% 4.0% 22.5% 73.5% 3.5% 23.0% 73.5% 2nd Review 66.0% 25.5% 8.5% 64.5% 26.0% 9.5% 65.0% 26.5% 8.5% 63.5% 27.0% 9.5% 3rd Reasoning 31.5% 50.5% 18.0% 32.5% 49.0% 18.5% 31.0% 50.5% 18.5% 33.0% 48.5% 18.5% 1st Reasoning 68.0% 23.5% 8.5% 65.0% 24.5% 10.5% 67.5% 23.0% 9.5% 64.0% 25.0% 11.0% 2nd String 5.5% 26.5% 68.0% 6.5% 25.5% 68.0% 5.5% 27.0% 67.5% 6.0% 26.0% 68.0% 3rd Review 26.5% 50.0% 23.5% 28.5% 50.0% 21.5% 27.0% 50.0% 23.0% 30.0% 49.0% 21.0% 1st Reasoning 64.0% 27.0% 9.0% 63.0% 27.5% 9.5% 65.0% 27.0% 8.0% 62.0% 28.0% 10.0% 2nd Review 30.0% 54.5% 15.5% 31.5% 53.5% 15.0% 29.0% 54.0% 17.0% 32.0% 52.0% 16.0% 3rd String 6.0% 18.5% 75.5% 5.5% 19.5% 75.0% 6.0% 18.0% 76.0% 6.5% 19.0% 74.5% 1st Review 73.5% 18.0% 8.5% 72.0% 19.0% 9.0% 74.0% 18.5% 7.5% 71.0% 20.0% 9.0% 2nd String 7.5% 27.0% 65.5% 8.0% 26.5% 65.5% 7.0% 27.5% 65.5% 8.5% 25.5% 66.0% 3rd Reasoning 19.0% 55.0% 26.0% 20.0% 54.5% 25.5% 19.0% 54.0% 27.0% 20.5% 54.5% 25.0% 1st Review 75.0% 17.0% 8.0% 73.5% 17.5% 9.0% 74.5% 17.0% 8.5% 72.5% 18.5% 9.0% 2nd Reasoning 19.5% 54.0% 26.5% 20.5% 53.0% 26.5% 19.5% 54.5% 26.0% 21.0% 52.5% 26.5% 3rd String 5.5% 29.0% 65.5% 6.0% 28.5% 65.5% 6.0% 28.0% 66.0% 6.5% 28.0% 65.5% Table 6 : Promotion success rate with different Generator–Optimizer configurations. Config Method GPT-4o Gemini-2.5 Claude-4 Grok-3 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Generator = GPT-4o Reasoning 92.0% 87.0% 81.0% 86.0% 80.0% 74.5% 91.0% 85.5% 80.0% 85.5% 79.5% 73.0% Review 89.5% 85.0% 79.0% 92.0% 87.5% 81.5% 92.0% 87.0% 81.0% 88.0% 83.0% 77.0% Generator = Gemini-2.5 Reasoning 89.5% 84.0% 77.5% 88.5% 84.0% 77.5% 91.0% 86.0% 80.0% 84.5% 78.0% 72.5% Review 87.0% 80.5% 76.0% 94.5% 89.5% 83.5% 84.0% 79.0% 73.5% 89.5% 84.0% 78.0% Generator = Claude-4 Reasoning 90.0% 85.5% 79.5% 87.5% 82.0% 76.0% 95.0% 90.0% 83.5% 86.5% 79.5% 74.0% Review 88.0% 81.0% 74.5% 93.0% 88.0% 82.0% 93.5% 89.0% 82.0% 90.0% 83.0% 75.0% Generator = Grok-3 Reasoning 88.0% 83.0% 76.0% 85.0% 80.0% 74.0% 90.0% 85.0% 79.0% 88.0% 83.0% 77.0% Review 85.0% 80.5% 73.0% 90.0% 83.5% 80.0% 92.0% 86.5% 79.5% 90.5% 85.0% 78.5% Optimizer = GPT-4o Reasoning 92.0% 87.0% 81.0% 84.0% 78.0% 71.0% 89.0% 83.0% 76.0% 82.0% 76.0% 69.5% Review 89.5% 85.0% 79.0% 90.0% 85.0% 78.0% 90.5% 85.0% 78.0% 86.0% 81.0% 74.0% Optimizer = Gemini-2.5 Reasoning 87.0% 82.0% 75.0% 88.5% 84.0% 77.5% 89.0% 84.0% 77.0% 83.0% 77.0% 70.0% Review 92.0% 87.0% 81.0% 94.5% 89.5% 83.5% 92.5% 88.0% 82.0% 88.0% 83.0% 77.0% Optimizer = Claude-4 Reasoning 89.0% 84.0% 77.0% 86.0% 81.0% 74.0% 95.0% 90.0% 83.5% 84.0% 78.0% 71.0% Review 90.5% 86.0% 79.5% 91.5% 85.0% 80.0% 93.5% 89.0% 82.0% 89.0% 83.5% 78.0% Optimizer = Grok-3 Reasoning 86.0% 81.0% 74.0% 83.0% 77.0% 70.0% 88.0% 83.0% 76.0% 88.0% 83.0% 77.0% Review 84.0% 77.5% 73.0% 91.0% 86.0% 79.0% 91.0% 85.5% 79.0% 90.5% 85.0% 78.5% Table 7 : Promotion success rate using different shadow models. Model GPT-4o Gemini-2.5 Claude-4 Grok-3 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Top-5 Top-3 Top-1 Llama-3.1-8B 55.0% 45.5% 33.0% 53.5% 43.0% 31.0% 58.0% 46.5% 34.0% 51.5% 42.0% 30.5% Vicuna-13B 50.5% 41.0% 28.0% 48.5% 39.0% 27.0% 54.0% 42.5% 29.5% 46.5% 38.0% 26.0% Mistral-7B 46.0% 37.5% 24.0% 44.5% 35.5% 23.0% 49.0% 39.0% 26.0% 42.0% 34.5% 21.5% 4.5 Sensitivity to Insertion Order To further analyze how optimization content interacts with LLM-based search, we study the sensitivity of the position where content is inserted. For each product, we take the top-3 candidates from ProductBench and append one strategy (String, Reasoning, or Review) to each. We then permute their order, forcing the strategies to compete directly within the top-3, measuring the promotion success rate. As shown in Table 5 , the insertion order affects rankings across all four LLMs. Review-based content is consistently strong, frequently pushing the target product to the top rank when placed first (over 70% across models) but declining when shifted later. Reasoning-based content is highly positional: when placed first, it can dominate the top rank (above 65% across models), but its influence diminishes in later positions. String-based content remains the weakest across permutations, clustering at the 3rd rank in over 70% of cases. These results show that optimization type and position both matter: review is robust to order, reasoning works best when first, and string insertions have limited impact. 4.6 Parameter Sensitives Generator and Optimizer . We analyze the effect of Generator and Optimizer choices on the Home & Kitchen category (Table 6 ). Alignment between these components and the tested model achieves the best promotion success rates, matching the results in Table 1 . For instance, with GPT-4o, the reasoning-based strategy reaches 92.0% (Top-5), 87.0% (Top-3), and 81.0% (Top-1). Mismatched Optimizers lead to larger drops than mismatched Generators, especially at Top-1. Review strategies transfer more robustly across models, while reasoning gains most from alignment but degrades when mismatched. Overall, CORE is resilient under different settings but performs best when both Generator and Optimizer are aligned with the synthesizing LLM. Shadow Models . While Llama-3.1-8B is used as the default shadow model in our main experiments, we additionally evaluate two open-source LLMs: Vicuna-13B ( 27 ) and Mistral-7B ( 9 ) . Table 7 reports promotion success rates on the Home & Kitchen across the three shadow models. Overall, the results are highly consistent: all shadow models improve rankings compared to the baseline. Llama-3.1-8B achieves the strongest performance, while Vicuna-13B and Mistral-7B follow closely with only small differences. Analysis of shadow models behavior v.s. real LLM and threshold \tau is given in Appendix G and I . 4.7 Cross-Domain and Cross-Model Transferability We evaluate the generalization ability of CORE by assessing its transferability across domains and models. Specifically, we examine whether CORE can generalize beyond the product search setting to other domains, with results reported in Appendix K . In addition, we evaluate cross-model transferability to assess the robustness of CORE under different backbone models, as shown in Appendix K.2 . Discussion Theoretical Analysis. We provide a theoretical characterization of CORE by formalizing how LLM-based ranking depends jointly on item content and retrieval position. Given a query q and a retrieved list \mathcal{I}=\{i_{1},\ldots,i_{n}\} , we model the probability that an item i_{j} is ranked at position r as P_{\theta}[\mathrm{rank}(i_{j})=r\mid\mathcal{I},q] . We show that this probability exhibits a systematic position bias, which can be expressed as: \log P_{\theta}[\mathrm{rank}(i_{k})=1]=f_{\theta}(T(i_{k}),q)-\lambda k+c (5) where f_{\theta}(\cdot) captures content relevance and \lambda>0 quantifies the position-dependent penalty. This bias explains why items retrieved at late positions have exponentially small promotion success under the baseline. Under this formulation, CORE operates by modifying the textual representation of a target item i^{*} to increase its effective content score. In the shadow-model setting, we analyze gradient-based optimization over the item embedding and show that, under mild smoothness and content-sensitivity assumptions, the promotion success rate \mathrm{PSR@1}=P_{\theta}[\mathrm{rank}(i^{*})=1] can be driven above a desired threshold p_{\mathrm{target}} within a bounded number of iterations. We further extend the analysis to the practical case where the shadow model only approximately matches the target LLM, and prove that the achievable promotion success degrades gracefully with the model mismatch parameter. Together, these results provide a theoretical explanation for the empirical effectiveness of CORE and clarify the conditions under which output-ranking control is possible in LLM-based search. More detailed proofs are in Appendix C . Mitigation Strategies. Moreover, we introduce three mitigation strategies to defend against our proposed method: Perplexity-based Filtering, Pattern-based Filtering, and Length Constraints. While all three methods reduce the promotion success rate to some extent, they remain insufficient, underscoring the need for more robust mitigation strategies. The results are summarized in Table 14 , with additional analyses provided in Appendix J . 5 Conclusion In this work, we introduced CORE, an optimization method that C ontrols O utput R ankings in g E nerative engines for LLM-based search. By formulating ranking as an optimization problem, we developed both shadow-model and query-based solutions to influence how LLMs synthesize retrieved content. To enable realistic evaluation, we constructed ProductBench, a benchmark spanning 15 product categories with structured results from Amazon. Experiments on four search-enabled LLMs show that, under the best optimization strategy, CORE achieves average promotion success rates of 91.4% @Top-5 , 86.6% @Top-3 , and 80.3% @Top-1 , demonstrating robust and practical ranking control. Impact Statements LLM-based search systems increasingly mediate product discovery, where final recommendations are strongly influenced by the initial retrieval order, often limiting the visibility of items ranked late in the candidate list and disadvantaging small businesses and independent creators. Our method, CORE, studies how output rankings in LLM-based search systems can be influenced by optimizing retrieved content under black-box settings, providing a potential mechanism to improve item visibility. At the same time, this capability exposes risks of ranking manipulation; although we explore mitigation strategies to reduce the effectiveness of CORE, they remain insufficient, underscoring the need for responsible deployment in LLM-based search systems. Appendix A LLM Usage Large Language Models (LLMs) were used to aid in the writing and polishing of the manuscript. Specifically, we used an LLM to assist in refining the language, improving readability, and ensuring clarity in various sections of the paper. The model helped with tasks such as sentence rephrasing, grammar checking, and enhancing the overall flow of the text. It is important to note that the LLM was not involved in the ideation, research methodology, or experimental design. All research concepts, ideas, and analyses were developed and conducted by the authors. The contributions of the LLM were solely focused on improving the linguistic quality of the paper, with no involvement in the scientific content or data analysis. The authors take full responsibility for the content of the manuscript, including any text generated or polished by the LLM. We have ensured that the LLM-generated text adheres to ethical guidelines and does not contribute to plagiarism or scientific misconduct. Appendix B Prompt Templates B.1 Few-shot Examples Few-shot Example 1 When choosing a heat gun for DIY projects like paint removal and electronics work, it’s essential to consider several factors: temperature range, variable settings, included accessories (like nozzles), safety features (especially overheat protection), and ergonomic design for ease of use during prolonged tasks. Here are three recommended models based on your criteria: ### 1. SEEKONE Heat Gun 1800W Description: This heavy-duty heat gun provides quick heating with a variable temperature range from 122°F to 1202°F, making it versatile for various applications from stripping paint to electronics repair. Pros: - Powerful 1800W motor heats up quickly. - Variable temperature control for precise applications. - Comes with four nozzles for different tasks. - Built-in overheat protection for safety. Cons: - Larger size might not be ideal for tight spaces. ### 2. Prostormer 2000W Heat Gun Description: With a wide temperature range of 140°F–1022°F, the Prostormer heat gun offers variable temperature control and comes with four nozzles, ensuring adaptability for both professional and DIY applications. Pros: - High power for quick results. - Three speed settings to tailor the airflow to your project. - Durable ceramic heating element. - Overheat protection for extended safety and tool lifespan. Cons: - Might be overpowered for delicate electronic tasks. ### 3. Wagner Spraytech 0503008 HT1000 Heat Gun Description: This dual-temperature heat gun (750°F and 1000°F) is great for home improvement tasks, including paint removal and electronics work, with a robust design for durability. Pros: - Simple dual temperature settings for ease of use. - Corrosion-resistant nozzle for long-lasting use. - Integrated stand for hands-free operation. - Lightweight design for ease of use. Cons: - Limited temperature range compared to other models. Few-shot Example 2 When selecting an impact wrench for DIY car repairs and home garage use, it’s essential to consider torque output, battery life, motor type, and additional features such as LED lighting and speed modes. Here are three top recommendations based on your needs: ### 1. Cordless Impact Wrench, 900Ft-lbs (1200N.m) 1/2” Brushless Impact Gun Description: This impact wrench offers a powerful 900Ft-lbs of torque and features a brushless motor for enhanced efficiency and longer lifespan. It comes with two 4.0Ah batteries, a fast charger, and several impact sockets. Pros: - High torque output suitable for tough jobs. - Brushless motor is quiet and spark-free, increasing safety. - Includes dual batteries and a charger. Cons: - Some users might find the 1/2” size not suitable for smaller bolts. ### 2. DEWALT 20V MAX Cordless Impact Wrench Kit Description: The DEWALT impact wrench features a 20V MAX battery system and delivers 1030 ft-lbs of max fastening torque. It offers four-mode speed settings, a variable speed trigger, and an LED work light. Pros: - High max fastening torque for versatile applications. - Precision wrench control to prevent overtightening. - Robust build quality and ergonomic design. Cons: - Higher price point, but reflects its premium performance and durability. ### 3. Milwaukee 2967-20 M18 Fuel 18V 1/2” High Torque Impact Wrench Description: This Milwaukee impact wrench is known for its compact design, delivering 1000 ft-lbs of fixing and nut-breaking torque. It uses an M18 REDLITHIUM battery and features a brushless motor with REDLINK PLUS intelligence. Pros: - Compact and ergonomic, ideal for tight spaces. - High durability with a brushless motor. - Advanced electronics offer protection against overload. Cons: - Friction ring model may require extra attention when changing sockets. B.2 Prompts for LLMs B.2.1 Prompt for Generator Generator Prompt (Reasoning-based) You are a helpful assistant. The user query is: *user query* The candidate products are: *product list in JSON format* The target product is: *target item information* Generate an initial draft that highlights why the target product should be ranked highly for the given query. Use step-by-step logical reasoning, comparing the target product with alternatives and explaining why it is the best match. Generator Prompt (Review-based) You are a helpful assistant. The user query is: *user query* The candidate products are: *product list in JSON format* The target product is: *target item information* Generate an initial draft in the style of a short customer review. Write in past tense and natural language, as if you had purchased and compared the product with alternatives. Highlight the advantages of the target product in a realistic review-like way. B.2.2 Prompt for Optimizer Optimizer Prompt You are a helpful assistant. The target ranking is: *desired ranking R target * The current ranking is: *observed ranking R (t) * The current draft is: *C (t) * Compare the current ranking with the target ranking. If they are already very similar, keep the draft unchanged. If they differ significantly, revise the draft into a new version *C (t+1) * that makes the target product more likely to reach the desired ranking. Make concise and meaningful improvements rather than rewriting from scratch. B.2.3 Prompt for Synthesizing LLM Synthesizing LLM Prompt You are a helpful assistant. The user query is: *user query* The candidate products are: *product list in JSON format* Recommend the products by producing a ranked list from most to least relevant to the user query. Only use the provided information in the JSON input. Appendix C Theoretical Analysis C.1 Problem Setup Consider a user query q and a set of retrieved items \mathcal{I}=\{i_{1},i_{2},\ldots,i_{n}\} ordered by an external search engine, where i_{k} denotes the item at position k . An LLM with parameters \theta processes these items and produces a ranking. We model the probability that item i_{j} is ranked in position r as P_{\theta}[\text{rank}(i_{j})=r\mid\mathcal{I},q] . Our goal is to promote a target item i^{*} from its initial retrieval position k_{0} (where k_{0}\gg 1 ) to the top rank (position 1). Control: We can modify the textual representation of i^{*} from T(i^{*}) to T^{\prime}(i^{*}) by gradient-based optimization on the item’s embedding \tilde{T}\in\mathbb{R}^{d} . Objective: Maximize the probability that i^{*} is ranked first: \text{PSR@1}=P_{\theta}[\text{rank}(i^{*})=1\mid T(i^{*})] (6) We analyze: Under what conditions can we achieve \text{PSR@1}\geq p_{\text{target}} for a desired threshold? C.2 Why Baseline Fails: Position Bias We first characterize why unmodified items at later positions fail to reach the top rank. Assumption C.1 (Position Bias) . The LLM’s ranking probabilities exhibit systematic position bias. Specifically, the log-probability of an item at position k reaching rank 1 can be decomposed as: \log P_{\theta}[\text{rank}(i_{k})=1]=f_{\theta}(T(i_{k}),q)-\lambda k+c (7) where f_{\theta}(T(i_{k}),q) captures content relevance, \lambda>0 is the position bias rate, and c is a normalization constant. Testability: This assumption can be verified by measuring how ranking probabilities change when identical content appears at different retrieval positions. Consequence: For an unmodified target item at position k_{0}\gg 1 with content quality f_{\theta}(T(i^{*}),q)\approx\bar{f} (average quality): \text{PSR@1}(\text{baseline})=P_{\theta}[\text{rank}(i_{k_{0}})=1]\approx\exp(-\lambda k_{0}+O(1)) (8) For example, if we assume k_{0}=10 and \lambda=0.3 , this gives \text{PSR@1}(\text{baseline})\lesssim 0.05 (approximately 0%), directly explaining the observed baseline failure in Table 1. C.3 Shadow Model Optimization We now analyze gradient-based optimization to overcome position bias. Setup: Assume access to model parameters \theta (shadow model setting). We optimize the text embedding \tilde{T}\in\mathbb{R}^{d} to maximize ranking probability. Objective Function: L(\tilde{T})=-\log P_{\theta}[\text{rank}(i^{*})=1\mid T(i^{*})=\tilde{T}] (9) Optimization: Gradient descent with updates \tilde{T}^{(\tau+1)}=\tilde{T}^{(\tau)}-\eta\nabla_{\tilde{T}}L(\tilde{T}^{(\tau)}) (10) After \tau_{\max} iterations, decode \tilde{T}^{(\tau_{\max})} to discrete text T^{\prime} . Assumption C.2 (Shadow Model Equivalence) . The shadow model parameters \theta are identical to the target LLM parameters. Assumption C.3 (Content Sensitivity) . The ranking log-probability has gradients bounded away from zero during optimization. Specifically, there exists \beta>0 such that along the optimization trajectory from initial embedding \tilde{T}^{(0)} (corresponding to original content) toward the optimum: \left\|\nabla_{\tilde{T}}\log P_{\theta}[\text{rank}(i_{k})=1]\right\|\geq\beta (11) whenever the current ranking probability satisfies P_{\theta}[\text{rank}(i_{k})=1]0 : Models approximately agree on content quality assessment • Larger \delta : Greater model mismatch Theorem C.7 (Convergence with Model Mismatch) . Under Assumptions C.1 , C.6 , C.3 , and C.4 , consider a target item i^{*} at initial position k_{0} with baseline success probability P_{0}