A sales manager sees a customer added an iPhone 15 Pro to the cart and immediately offers a Pro Max. But without ML, they don't know the best moment to suggest, what price increment won't scare the customer, or how to phrase it without annoying them. AI upselling solves these three tasks: an ML model predicts acceptance probability, and LLM-generated pitches create personalized offers.
We build such turnkey systems to increase average order value in retail and B2B scenarios. Stack: PyTorch for features, Gradient Boosting for scoring, Claude 3.5 for generating the upsell pitch. With 5+ years on the market and over 50 projects, we guarantee at least a twofold increase in sales acceptance rate—proven in A/B tests. For an average online store, additional revenue from upsell can exceed 12% of turnover, and savings on manual offer selection reach $24,000 per year. Our ML upsell model is 3x better than rule-based systems in acceptance rate.
Why ML delivers 2–3x improvement over rules?
In a typical CRM, upsell is hardcoded: "if item price > $1000, suggest insurance." An ML model implementing a contextual bandit in sales considers 20+ features: customer average order value, category, session depth, product rating, etc. A key insight from our projects is that the optimal price increment for upsell is 20–40% above current. If the step exceeds 50%, conversion drops by half. This is not obvious without ML.
| Approach | Acceptance rate | Maintenance complexity | Personalization |
|---|---|---|---|
| Rules (hardcoded upsell) | 3–5% | Low | None |
| ML + LLM (contextual bandit) | 8–15% | Medium (retrain monthly) | Full |
Source: A/B test results on 10,000 sessions in retail. Internal project data
For comparison, even simple ML scoring (without LLM) achieves 6–10%, while with LLM it reaches up to 15%. In one electronics retailer project, revenue from upsell exceeded 12% of turnover. Average ROI per project is 3–5x in the first year, and FTE manager time savings reach 40%.
How LLM generates personalized pitches?
The LLM receives candidate and features from the scoring model: product name, price, feature difference, customer history. Based on this, it forms one or two sentences with a specific benefit, avoiding generic phrases. We use Claude 3.5 Sonnet with temperature 0.3—creative enough, but without hallucinations.
Example: instead of "Get the premium," it generates "This laptop compiles 30% faster—ideal for your Python projects." This approach boosts acceptance by 3–5 percentage points compared to template phrases.
AI Upsell Results
| Stage | Duration | Outcome |
|---|---|---|
| Analytics & data collection | 3-5 days | Session dataset + product profiles |
| Feature engineering | 2-3 days | Features for the model |
| Model training | 1-2 days | Gradient Boosting + calibration |
| LLM integration | 2-3 days | Pitch generation API |
| A/B test | 5-7 days | Uplift evaluation |
| Deployment & documentation | 3-5 days | Production solution |
- Analytics—collect session logs, export from CRM and Google Analytics. Clean, stratify acceptance. Typically 50k+ sessions needed for stable model.
- Feature engineering—compute price delta, ratio, user metrics (average order, premium purchase share). Encode categories.
- Model training—GradientBoostingClassifier + probability calibration (isotonic). Cutoff threshold 0.2—don't show if probability below.
- LLM integration—Claude 3.5 generates one or two sentences with specific benefit.
- A/B test—run on 10% of traffic, measure acceptance rate and revenue. After confirmation, roll out to all.
- Deployment—containerization in Docker, model via Triton Inference Server, CI/CD via GitHub Actions. We automate MLOps in sales at all stages.
To assess the potential for your business, contact us for an initial audit.
Example implementation of contextual bandit
import numpy as np
import pandas as pd
from anthropic import Anthropic
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.calibration import CalibratedClassifierCV
class UpsellRecommender:
def __init__(self):
self.llm = Anthropic()
self.model = None
self.product_catalog = {}
def train(self, sessions_df: pd.DataFrame):
"""
sessions_df: user_id, viewed_item_id, upsell_shown_item_id,
accepted, user_features..., item_features...
"""
features = self._extract_features(sessions_df)
X = features.drop(columns=['accepted'])
y = features['accepted']
base_model = GradientBoostingClassifier(
n_estimators=200, learning_rate=0.05,
max_depth=5, random_state=42
)
self.model = CalibratedClassifierCV(base_model, cv=3, method='isotonic')
self.model.fit(X, y)
def _extract_features(self, df: pd.DataFrame) -> pd.DataFrame:
"""Feature engineering for upsell model"""
features = pd.DataFrame()
features['price_delta'] = df['upsell_price'] - df['current_price']
features['price_ratio'] = df['upsell_price'] / df['current_price'].clip(0.01)
features['user_avg_order'] = df['user_avg_order_value']
features['user_premium_ratio'] = df['user_premium_purchases'] / df['user_total_purchases'].clip(1)
features['session_depth'] = df['pages_viewed']
features['cart_value'] = df['current_cart_value']
features['upsell_rating_delta'] = df['upsell_rating'] - df['current_rating']
features['current_category_encoded'] = df['category'].astype('category').cat.codes
features['accepted'] = df['accepted']
return features
def recommend_upsell(self, user: dict, current_item: str) -> dict:
candidates = self._get_upsell_candidates(current_item)
if not candidates:
return None
best_candidate = None
best_prob = 0
for candidate in candidates:
features = self._build_prediction_features(user, current_item, candidate)
if self.model:
prob = self.model.predict_proba([features])[0][1]
else:
prob = 0.3 if candidate['price'] < user.get('avg_order', 0) * 1.5 else 0.15
if prob > best_prob and prob > 0.2:
best_prob = prob
best_candidate = (candidate, prob)
if not best_candidate:
return None
candidate, prob = best_candidate
pitch = self._generate_upsell_pitch(user, current_item, candidate)
return {
'recommended_item': candidate['item_id'],
'accept_probability': prob,
'pitch': pitch,
'price_delta': candidate['price'] - self.product_catalog.get(current_item, {}).get('price', 0)
}
def _get_upsell_candidates(self, item_id: str) -> list[dict]:
current = self.product_catalog.get(item_id, {})
current_price = current.get('price', 0)
current_category = current.get('category', '')
return [
item for item in self.product_catalog.values()
if item.get('category') == current_category
and current_price * 1.1 <= item.get('price', 0) <= current_price * 2.5
and item.get('rating', 0) >= current.get('rating', 0) - 0.2
]
def _generate_upsell_pitch(self, user: dict, current_item: str, upsell_item: dict) -> str:
current = self.product_catalog.get(current_item, {})
response = self.llm.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=100,
messages=[{
"role": "user",
"content": f"Write a short, compelling upsell message (1-2 sentences, conversational tone).\n\nCustomer is viewing: {current.get('name', current_item)} (${current.get('price', 0)})\nUpsell option: {upsell_item.get('name', '')} (${upsell_item.get('price', 0)})\nKey difference: {upsell_item.get('upgrade_feature', 'better quality')}\nCustomer history: avg order ${user.get('avg_order', 0):.0f}\n\nBe direct, mention the specific benefit, not generic praise."
}]
)
return response.content[0].text
Key point: the model uses Gradient Boosting with probability calibration and LLM for personalization. The 0.2 threshold filters out unpromising offers, reducing risk of negative experience.
What's included in our work
- Documentation of architecture and data pipelines.
- Source code of the model and API for integration with your CRM.
- Metrics dashboard (acceptance rate, p99 latency, revenue uplift) in Grafana.
- Instructions for quarterly model retraining.
- Admin panel for pitch moderation (to prevent LLM weirdness).
- 2 months of technical support after launch.
Average acceptance rate increase from 8% to 15% (vs 3–5% without ML). Manager FTE time savings up to 40% on manual offer selection. This is a ready-made B2B-level recommendation system. Order a prototype in 10 working days—contact us for an audit of your scenario. Get a demo prototype—contact us for a consultation.







