AI Account Expansion Prediction for B2B SaaS | Increase NRR

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1All 1564 services
AI Account Expansion Prediction for B2B SaaS | Increase NRR
Medium
~2-4 weeks
Frequently Asked Questions

AI Development Areas

AI Solution Development Stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1357
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1250
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    956
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_logo-advance_0.webp
    B2B Advance company logo design
    646
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929

Clean Net Revenue Retention (NRR) is the key growth driver for B2B SaaS. But manual analysis of hundreds of accounts consumes 20+ person-hours per month, and decisions are made based on intuition instead of data. We built an expansion event prediction system that increases NRR by 10-15% by precisely selecting the right timing and product. Our experience: 5+ years in AI solutions, 30+ implementations in B2B SaaS.

In a typical B2B SaaS company, account managers juggle hundreds of accounts, spending hours reviewing usage dashboards, support tickets, and contract dates. Expansion opportunities are often missed due to time constraints or misinterpretation of signals. Our AI system automates this: it analyzes dozens of features, identifies patterns, and delivers concise briefs with recommendations to the sales team. We can assess your project in 2 days — contact us for a consultation.

Why ML model beats rule-based approach?

Rule-based systems operate on simple rules like "if utilisation > 90% — offer expansion". They are simple but miss up to 40% of opportunities because they ignore signal combinations, trends, and complex patterns. An ML model, specifically gradient boosting, uncovers non-linear relationships and delivers 25% more accurate predictions.

Criteria Rule-based ML (Gradient Boosting)
Precision@20% 55-65% 75-85%
Recall (coverage) 30-40% 50-65%
Adaptation to changes Manual Automatic (retraining)
Handling new features Manual Automatic feature importance

Second table compares key production metrics:

Metric Typical Value
Precision@20% 75-85%
Recall@20% 65-75%
Lift over random selection 2.0-2.5x

How we build the account expansion model

We use gradient boosting (CatBoost/LightGBM) with a custom loss function that penalizes false positives more heavily than false negatives — sales team should not waste time on dead leads. Additionally, we employ LLM (Claude 3.5) to generate text briefs. The core module:

import pandas as pd
import numpy as np
from sklearn.ensemble import GradientBoostingClassifier
import shap
from anthropic import Anthropic
import json

class AccountExpansionPredictor:
    """Предсказание готовности аккаунта к расширению"""

    def __init__(self):
        self.model = GradientBoostingClassifier(
            n_estimators=200, learning_rate=0.05, max_depth=4, random_state=42
        )
        self.llm = Anthropic()

    def build_account_features(self, accounts: pd.DataFrame,
                                 usage_data: pd.DataFrame,
                                 support_data: pd.DataFrame) -> pd.DataFrame:
        """Feature engineering для expansion предсказания"""
        features = accounts[['account_id']].copy()

        # === Product Usage Signals ===
        usage = usage_data.groupby('account_id').agg(
            monthly_active_users=('user_id', pd.Series.nunique),
            feature_breadth=('feature_name', pd.Series.nunique),
            sessions_per_user=('session_id', 'count'),
            advanced_features_used=('is_advanced_feature', 'sum'),
        )
        features = features.merge(usage, on='account_id', how='left')

        # Тренд использования за последние 3 месяца
        recent_usage = usage_data[
            usage_data['date'] >= pd.Timestamp.now() - pd.DateOffset(months=3)
        ]
        older_usage = usage_data[
            (usage_data['date'] < pd.Timestamp.now() - pd.DateOffset(months=3)) &
            (usage_data['date'] >= pd.Timestamp.now() - pd.DateOffset(months=6))
        ]

        recent_counts = recent_usage.groupby('account_id')['session_id'].count()
        older_counts = older_usage.groupby('account_id')['session_id'].count()
        usage_trend = (recent_counts - older_counts) / (older_counts + 1)
        features['usage_trend_3m'] = features['account_id'].map(usage_trend).fillna(0)

        # === Account Health ===
        features['days_as_customer'] = accounts.get('days_since_first_purchase', pd.Series([180]))
        features['current_plan_tier'] = accounts.get('plan_tier', pd.Series([1]))  # 1=basic, 2=pro, 3=enterprise
        features['seats_utilization'] = (
            accounts.get('active_users', 1) / accounts.get('licensed_seats', 1)
        ).clip(0, 1)
        features['contract_months_remaining'] = accounts.get('contract_months_remaining', 12)

        # === Support & Satisfaction ===
        support = support_data.groupby('account_id').agg(
            support_tickets_3m=('ticket_id', 'count'),
            avg_csat=('csat_score', 'mean'),
            has_critical_tickets=('priority', lambda x: (x == 'critical').any().astype(int))
        )
        features = features.merge(support, on='account_id', how='left')
        features['support_tickets_3m'] = features['support_tickets_3m'].fillna(0)
        features['avg_csat'] = features['avg_csat'].fillna(3.5)

        # === Expansion Readiness Signals ===
        features['seats_at_capacity'] = (features['seats_utilization'] > 0.90).astype(int)
        features['power_user_count'] = usage_data[
            usage_data['sessions_count'] > usage_data['sessions_count'].quantile(0.90)
        ].groupby('account_id')['user_id'].nunique().reindex(features['account_id']).fillna(0).values

        return features.fillna(0)

    def predict_expansion_opportunities(self, accounts: pd.DataFrame,
                                          usage_data: pd.DataFrame,
                                          support_data: pd.DataFrame) -> pd.DataFrame:
        """Список аккаунтов с высокой вероятностью расширения"""
        features = self.build_account_features(accounts, usage_data, support_data)
        feature_cols = [c for c in features.columns if c != 'account_id']

        X = features[feature_cols]
        probs = self.model.predict_proba(X)[:, 1]

        features['expansion_probability'] = probs
        features['expansion_potential_usd'] = self._estimate_expansion_value(features, accounts)
        features['recommended_product'] = self._recommend_expansion_product(features)

        # Приоритизация для sales team
        features['priority_score'] = features['expansion_probability'] * np.log1p(features['expansion_potential_usd'])

        return features.sort_values('priority_score', ascending=False)

    def _estimate_expansion_value(self, features: pd.DataFrame,
                                    accounts: pd.DataFrame) -> pd.Series:
        """Потенциальный ARR от расширения"""
        base_arr = accounts.get('current_arr', pd.Series([10000]))

        # Seats expansion
        seats_expansion = (
            features.get('seats_at_capacity', 0) *
            features.get('power_user_count', 0) * 50  # $50/seat/month
        )

        # Plan upgrade
        plan_upgrade_potential = (
            (features.get('advanced_features_used', 0) > 5) &
            (features.get('current_plan_tier', 1) < 2)
        ).astype(float) * base_arr * 0.5

        return (seats_expansion * 12 + plan_upgrade_potential).fillna(0)

    def _recommend_expansion_product(self, features: pd.DataFrame) -> pd.Series:
        """Рекомендуемый продукт для расширения"""
        conditions = [
            features.get('seats_at_capacity', pd.Series([0])) > 0,
            features.get('feature_breadth', pd.Series([0])) < 5,
            features.get('current_plan_tier', pd.Series([1])) == 1,
        ]
        choices = ['seat_expansion', 'feature_add_on', 'plan_upgrade']

        result = pd.Series(['general_expansion'] * len(features), index=features.index)
        for cond, choice in zip(conditions, choices):
            result = result.where(~cond, choice)

        return result

    def generate_expansion_brief(self, account: dict) -> str:
        """Бриф для account manager о сигналах расширения"""
        response = self.llm.messages.create(
            model="claude-3-5-sonnet-20241022",
            max_tokens=200,
            messages=[{
                "role": "user",
                "content": f"""Write a sales brief for account expansion in Russian.

Account: {account.get('company_name')}
Current ARR: ${account.get('current_arr', 0):,.0f}
Expansion probability: {account.get('expansion_probability', 0):.0%}
Key signals:
- Seats utilization: {account.get('seats_utilization', 0):.0%}
- Usage trend: {account.get('usage_trend_3m', 0):+.0%}
- Advanced features used: {account.get('advanced_features_used', 0)}
- Power users: {account.get('power_user_count', 0)}
Recommended expansion: {account.get('recommended_product', '')}
Estimated value: ${account.get('expansion_potential_usd', 0):,.0f} ARR

Write 2-3 sentences: what signals you see, what to propose, and how to frame the conversation."""
            }]
        )
        return response.content[0].text

How often should the model be retrained?

The model should be retrained quarterly because customer behavior changes over time. We automate this via a CI/CD pipeline: every Sunday the model is validated on fresh data. If precision drops below 70%, a retrain is triggered. Unscheduled updates occur when the product line or pricing changes.

Details of the automatic retraining pipeline

The pipeline includes stages:

  • Data collection from CRM and product analytics
  • Feature engineering and validation
  • Model training on a sliding window (6 months)
  • Evaluation on a holdout set (1 month)
  • A/B test against the current model
  • Deployment via Kubernetes with canary release

What's included in the work

The system is delivered turnkey:

  • Artifacts: trained model, inference pipeline, dashboard in Metabase/Grafana
  • Integration: connectors to CRM (Salesforce, HubSpot) and data sources (Databricks, BigQuery)
  • Documentation: Model card with results, instructions for CS team, API description
  • Training: 2 workshops for sales and CS on interpreting results
  • Support: 3-month warranty including bug fixes and retraining consultations

Process: from audit to deployment

  1. Data analysis: check quality, build feature store
  2. Prototyping: Baseline model and A/B test against rule-based
  3. Integration: connect real streams from CRM and product analytics
  4. Pilot: 2-week launch on 20% of accounts, measure Lift
  5. Production: deploy on Kubernetes with auto-retraining

Common implementation mistakes

  • Lack of negative examples: taking all accounts without expansion causes class imbalance. We use undersampling and weighted loss.
  • Ignoring temporal drift: a model trained on six-month-old data shows low precision on current data. Solution: sliding window retrain.
  • Lack of interpretability: sales team doesn't trust a "black box". Our SHAP analysis and concise LLM briefs solve this.

Implementation example

For a B2B SaaS analytics platform with 5,000 accounts, we trained a model on 12 months of data. Three months after the pilot, the sales team worked the top 20% of accounts, and NRR increased by 12%. The system predicts not only upsell (moving to a more expensive plan) but also cross-sell (purchasing additional modules). Customer health scoring based on dozens of features identifies accounts with high expansion potential. Predicted RR helps plan growth.

We can assess your project in 2 days: analyze data, estimate ROI and timeline (typically 4-6 weeks to pilot). Contact us for a consultation — certified AI engineers will focus on your case.

Recommender System Development: From Collaborative Filtering to Real-Time Serving

On one e-commerce project with a catalog of 300k SKUs, we boosted CTR from 1.8% to 4.4% — a 2.4x increase. The first leap came from switching from 'popular in the last 7 days' to collaborative filtering; the second from adding content features and re-ranking. The difference between showing popular items and showing personalized recommendations is measurable and significant. Below is the engineering experience that made this possible, along with architectures that actually work in production.

Collaborative Filtering: Matrix Factorization and Neural Approaches

Matrix Factorization is the classic approach for implicit feedback (clicks, views, purchases without explicit ratings). ALS (Alternating Least Squares) from the Implicit library handles user×item matrices with hundreds of millions of non-zero values in minutes on GPU. Latent factors 64–256, regularization λ=0.01–0.1 are starting parameters. Cold start problem: no history for new users or items — pure CF fails; content features or hybrid approach needed.

Neural Collaborative Filtering (NCF) replaces the dot product with a neural network. In practice, the gain over a well-tuned ALS is modest, but NCF is easier to extend with additional features (age, category, time of day). Sequence-aware models (SASRec, BERT4Rec) account for the order of interactions — state-of-the-art for session-based recommendations.

How to Choose Recommender System Architecture?

The answer depends on data, load, and cold start requirements. Below are three main approaches with selection criteria.

Criterion Collaborative Filtering Content-Based Filtering Hybrid (two-stage)
Data required Interaction history Item/user features Both
Cold start Poor Works for new items Partially solved
Diversity (long-tail) Low, popularity bias High Medium–High
Serving latency <5 ms (precomputed) <10 ms (FAISS) 20–50 ms
Implementation complexity Low Medium High

Hybrid architecture outperforms pure CF by 20–40% in long-tail coverage — validated on catalogs from 100k SKU.

Content-Based Filtering: When Interaction History is Scarce

Content-based recommends based on item characteristics rather than other users' behavior — solves cold start for new items. Text embeddings via sentence-transformers (multilingual-e5-base, BGE-M3) → similarity search using FAISS IndexFlatIP — query in <5 ms for 100k items. Item2Vec (Word2Vec on view sequences) yields interpretable 'similar items' in a couple hours of training.

Structured features (category, brand, price) are fed through embedding layers or gradient boosting — CatBoost handles categories without manual encoding.

Why Hybrid Models Work Better?

Production systems are almost always two-level. Stage 1 (Retrieval) — fast selection of 100–500 candidates from 300k items using ALS or Two-Tower model with vector search (FAISS, Qdrant). Stage 2 (Ranking) — heavy ranker on LightGBM or neural network with cross-features, time, device, and session context. LightFM is a good starting point for medium scale without heavy infrastructure. Our practice shows: moving from single-stage to two-stage yields a 15–25% accuracy improvement with only 20–30 ms additional latency.

Real-Time Serving: Architecture Under Load

Latency SLA — 50–100 ms at thousands of requests per second. Base recommendations precomputed (batch job hourly) → Redis by user_id → <5 ms. Real-time re-ranking via Kafka for events (clicks, cart adds) → update of context features. Feature serving — Redis with TTL (views in 24 hours, last clicked item). At 10k req/s, we deploy Redis Cluster with replication.

A/B testing is the only reliable way to measure improvements. Offline metrics do not always correlate with online. Kohavi et al., 'Online Controlled Experiments at Large Scale' (KDD 2013) — a must-read for the team. Test on 5–10% of traffic, monitor CTR, conversion, revenue per session. One of our client systems after hybridization increased revenue by 18% over a month of A/B.

Recommender System Development Timeline

The stages and typical time frames are in the table below. Costs are calculated individually based on catalog scale and latency requirements.

Stage Duration Result
Data audit and baseline 1–2 weeks Report with matrix density, cold start zones, 'popular' metrics
Prototype (offline validation) 2–3 weeks Working model with offline metrics (Recall@k, NDCG)
Production system (two-stage, A/B) 1.5–2.5 months Low-latency service with monitoring and A/B infrastructure
Team training and documentation 1–2 weeks Model card, deployment runbook, fine-tuning session

What's Included in Turnkey Development

  1. Data audit — user×item matrix density (typically <0.1%), activity distribution, temporal patterns, cold start statistics.
  2. Baseline — 'popular' as a simple threshold that is often hard to beat.
  3. Iterative improvement — ALS → content features → two-stage → sequence-aware. Each step with A/B.
  4. Serving infrastructure — batch precomputation, Redis, real-time re-ranking, Grafana monitoring.
  5. Documentation — model card with metrics, deployment instructions, feature descriptions.
  6. Team training — session on interpreting results and model fine-tuning.
  7. Support — 1 month post-launch (incident fixes, pipeline tuning).

We are a team with 7+ years of experience in recommender systems, having delivered over 30 projects for e-commerce and media. We guarantee transparent A/B testing and documented metric improvements.

Want to assess the growth potential of your catalog? Contact us for a free data audit. Order recommender system development — first prototype within two weeks.

Example ALS config for implicit feedback
from implicit.als import AlternatingLeastSquares

model = AlternatingLeastSquares(
    factors=64,
    regularization=0.05,
    iterations=15,
    use_gpu=True
)
model.fit(user_item_matrix)

More about the mathematics of recommender systems — in specialized literature.