Introduction
Imagine: you have 500,000 users, a catalog of 100,000 products, but the conversion on recommendations is only 2%. The reason? Standard popular items are not personalized. We solve this with collaborative filtering (CF), which analyzes the user×item interaction matrix and delivers personalized results. No product information is needed—only behavioral signals. That's why CF works where Content-Based falls short: in recommendations for clothing, books, content with unstructured metadata. According to Amazon research, implementing CF increases sales by 20–30% in the first months. Our implementation experience shows that proper weight tuning and A/B testing can achieve a stable CTR increase of 30–50%.
Collaborative Filtering: Technical Core and Main Challenges
Matrix Factorization as the Foundation
Classic CF via dot-product nearest neighbor search doesn't scale beyond 100K users. The working approach is to decompose the interaction matrix into two embedding spaces: users and items are represented as fixed-dimension vectors (usually 64–256). The recommendation is finding items whose embeddings are closest to the user's embedding.
Libraries for training: Implicit (Python, specialized for implicit feedback), LightFM (hybrid CF+content), RecBole (research framework with 70+ algorithms). For production deployment, we usually choose Implicit + FAISS for ANN search. In terms of speed, Implicit is 3x faster than LightFM on sparse matrices.
| Library | Data Type | Training Speed | Flexibility | Production Readiness |
|---|---|---|---|---|
| Implicit | Implicit/Explicit | ★★★★★ | ★★★ | ★★★★★ |
| LightFM | Hybrid | ★★★★ | ★★★★★ | ★★★★ |
| RecBole | Research | ★★★ | ★★★★ | ★★★ |
How Does Collaborative Filtering Solve the Cold Start Problem?
A new user with no interaction history is a typical cold start. Standard solution: for the first 5–10 interactions, we use a "popular items from the category of interest" rule (onboarding flow with preference selection). After accumulating minimal history, we switch to the personalized model.
In code, this looks like a strategy pattern:
// Android: recommendation strategy based on interaction count
interface RecommendationStrategy {
suspend fun getRecommendations(userId: String, count: Int): List<Product>
}
class ColdStartStrategy(private val api: RecommendationApi) : RecommendationStrategy {
override suspend fun getRecommendations(userId: String, count: Int) =
api.getPopularByPreferences(userId, count)
}
class CFStrategy(private val api: RecommendationApi) : RecommendationStrategy {
override suspend fun getRecommendations(userId: String, count: Int) =
api.getPersonalized(userId, count)
}
class RecommendationRepository(private val api: RecommendationApi) {
suspend fun getRecommendations(user: User): List<Product> {
val strategy = if (user.interactionCount < 10) {
ColdStartStrategy(api)
} else {
CFStrategy(api)
}
return strategy.getRecommendations(user.id, count = 20)
}
}
Why Is Implicit Feedback Better Than Explicit?
In most mobile apps, users don't rate items. Implicit feedback—views, clicks, add-to-cart, time spent on product card—is much more informative but requires proper weighting: a view without a click ≠ interest, a click without a purchase ≠ satisfaction.
The weight scheme we use in practice:
| Action | Weight |
|---|---|
| View card > 3 seconds | 1 |
| Click "details" | 3 |
| Add to favorites | 5 |
| Add to cart | 7 |
| Purchase | 10 |
| Return | -5 |
CF with proper weights gives a CTR increase of 30–50% compared to Content-Based, given sufficient data. In one project for a clothing retailer, we implemented Implicit ALS with the above weights. After 2 weeks of A/B testing, CTR increased by 40%, and conversion to purchase by 15%. We guarantee that with your data, the result will be at least as good.
Client-Side Event Logging
The quality of CF directly depends on the completeness and accuracy of logging:
// iOS: tracking interactions with precise viewing time
class ProductInteractionTracker {
private var viewStartTime: Date?
private let analytics: AnalyticsService
func trackViewStart(productId: String) {
viewStartTime = Date()
}
func trackViewEnd(productId: String) {
guard let start = viewStartTime else { return }
let duration = Date().timeIntervalSince(start)
if duration > 3.0 {
analytics.log(InteractionEvent(
productId: productId,
type: .view,
weight: min(Int(duration / 3), 3),
timestamp: start
))
}
viewStartTime = nil
}
func trackAddToCart(productId: String) {
analytics.log(InteractionEvent(productId: productId, type: .addToCart, weight: 7))
}
}
Tracking view time via viewStartTime allows distinguishing accidental views from real interest. Without this signal, the interaction matrix becomes noisy.
Serving: FAISS for ANN Embedding Search
The trained model exports item embeddings into a FAISS index. On request for user recommendations: get their embedding → search K nearest items in FAISS → filter already purchased → return the list. Latency with 1M items: 5–15 ms on the server.
FAISS serving architecture
The index is built offline after model training. For inference, we use a REST API (Ktor/Kotlin or Vapor/Swift). On each user request, the user embedding is computed on the fly or cached. The top-K search is performed using `IndexIVFFlat` with nprobe=10 for speed. Results are post-processed: already purchased items are removed, and business logic is applied (e.g., category diversity).What the Work Includes
- Data audit: interaction matrix size, sparsity, cold start presence.
- Setup of event logging on iOS/Android clients, considering App Store Review Guidelines and Google Play Console.
- Model training (Implicit ALS or LightFM) on historical data.
- Development of recommendation API + FAISS serving using Ktor (Kotlin) or Vapor (Swift).
- A/B testing: CF recommendations vs popular items → measuring CTR and conversion.
- Documentation and team training.
- Post-launch support, monitoring for data drift.
Timelines
MVP with Implicit ALS + basic serving: 2–3 weeks. Full system with event logging, cold start fallback, A/B testing, and monitoring: 6–8 weeks. The cost is calculated individually after a project audit. We have over 10 years of experience in mobile development, and we guarantee a transparent process with regular demos.
Boost your recommendation conversion — get a consultation from our engineer on configuring CF for your data. Order an audit of your interaction matrix — we'll assess the potential. Contact us to start the project.







