DEV Community

Rifat
Rifat

Posted on • Originally published at qioiper.com

How I Built 7 AI Systems to Run a Social Media App — Architecture Deep Dive

When I started building Qioiper, I had one architectural constraint that shaped everything: the platform could not optimize for screen time.

This sounds simple. It isn't. Every major social platform — Instagram, TikTok, Twitter — runs on engagement-maximization algorithms. The entire infrastructure of modern social media is built to answer one question: how do we keep users on longer?

Building against this required not one AI system, but seven. Each one handles a specific part of the problem. Here's the architecture.

## The Core Problem With One Algorithm

A single engagement-optimization algorithm creates a specific failure mode. It surfaces content that provokes reaction — outrage, envy, anxiety — because those emotions drive clicks. It can't simultaneously optimize for content quality, user wellbeing, creator reach, platform safety, and meaningful connection.

You need specialized systems. Here's how I built them.

## System 1: Content Guard

Stack: Python, custom classifier, real-time inference pipeline

What it does: Screens every upload before it reaches the platform. Not after. Before.

Most platforms moderate reactively — content goes up, gets reported, eventually gets reviewed. By then the damage is done. Content Guard operates at upload speed, running parallel inference against multiple violation categories simultaneously.

The challenge: Latency. Real-time moderation at upload speed means you have milliseconds, not seconds. The solution was a tiered approach — fast lightweight classifier for obvious violations, heavier model for edge cases, human review queue for genuinely ambiguous content.

System 2: Copyright Guard

Stack: Audio fingerprinting, video hash comparison, metadata analysis

What it does: Detects copyright violations in video and audio before publishing.

This goes beyond simple hash matching. Copyright Guard analyzes audio waveforms for music detection, compares video segments against a reference database, and flags content that's been re-encoded to avoid fingerprinting.

Why it matters: Creators on Qioiper own their work. That requires protecting original content from unauthorized reproduction — and protecting users from unknowingly consuming it.

System 3: CLIP AI

Stack: OpenAI CLIP, fine-tuned for platform content categories

What it does: Understands what content actually is — not just its filename or hashtags.

CLIP (Contrastive Language-Image Pretraining) is a multimodal model that understands the relationship between images and language. On Qioiper, it serves as the content intelligence layer — reading the actual visual and semantic meaning of uploaded content.

Practical impact: Instead of distributing content based on hashtags, Qioiper distributes based on what the content actually shows. A photographer's work reaches people who genuinely appreciate photography, not just people who followed a generic tag.

Secondary function: Context-aware moderation. A word or image that's harmful in one context is neutral in another. CLIP understands the difference. This dramatically reduces false positives compared to keyword-based systems.

System 4: Feed Ranker

Stack: Collaborative filtering + content-based signals, custom ranking model

What it does: Determines what each user sees — without optimizing for engagement.

This is where most social platforms make their most consequential decision. The Feed Ranker on Qioiper optimizes for relevance, not reaction. The signals it uses:

  • Content-user interest alignment (via User Profiler data)
  • Content quality score (via CLIP AI)
  • Creator trust score
  • Temporal relevance (content lifecycle stage)

What it deliberately ignores: predicted engagement rate. A post that will get 100 genuine reactions from relevant users ranks higher than a post that will get 10,000 reactions from irrelevant users.

System 5: User Profiler

Stack: Behavioral sequence modeling, interest graph construction

What it does: Builds a behavioral model of each user over time — interests, engagement patterns, content preferences, active hours.

This isn't surveillance. It's the same kind of learning that makes any recommendation better with use. The User Profiler feeds into every other system, making each one more accurate as it learns.

Privacy approach: All profiling data stays on-platform and is used exclusively for the user's benefit — better recommendations, better timing, better content matching. It's never sold or used for advertising targeting.

System 6: Notification Generator

Stack: Multi-armed bandit optimization, user behavioral signals

What it does: Decides what's actually worth notifying you about.

Most platforms send notifications to maximize re-engagement. Qioiper's Notification Generator has a different objective function: maximize the ratio of meaningful notifications to total notifications.

In practice this means: fewer notifications, but higher signal-to-noise ratio. When Qioiper sends you a notification, something genuinely relevant has happened — not a manufactured trigger designed to pull you back.

Technical approach: The system models each user's notification tolerance and adjusts frequency dynamically. Users who respond positively to more notifications get more. Users who dismiss or ignore notifications get fewer, with higher relevance thresholds.

System 7: Timing Optimizer

Stack: Time-series behavioral analysis, audience activity modeling

What it does: Identifies the Golden Moment — the exact window when a specific creator's audience is most active and receptive.
Research consistently shows creators lose up to 70% of potential reach by posting when their audience isn't active. The Timing Optimizer solves this by building a behavioral map of each creator's audience — not a generic "best time to post" recommendation, but a specific prediction based on that creator's actual followers.

How it works:

  1. Aggregate activity data for users who follow a given creator
  2. Identify peak activity windows by day and hour
  3. Cross-reference with content type (Flash vs Memory vs Forever have different optimal windows)
  4. Surface the recommendation in the posting interface before the creator hits publish

Update frequency: The model recalculates continuously as the creator's audience grows and behavior shifts.

How the Systems Work Together

These seven systems aren't independent — they form a pipeline:

Upload → Content Guard → Copyright Guard → CLIP AI → Feed Ranker ← User Profiler → Notification Generator → Timing Optimizer

Content Guard and Copyright Guard are gates — content that doesn't pass doesn't enter the pipeline. CLIP AI enriches the content with semantic understanding. Feed Ranker uses that enrichment plus User Profiler data to make distribution decisions. Notification Generator and Timing Optimizer handle the delivery layer.

What I'd Do Differently

Latency on Content Guard. The tiered approach works but the edge case queue creates unpredictable delays for content that requires deeper analysis. A better architecture would use distillation to make the heavy model faster rather than routing to it selectively.

User Profiler cold start. New users have no behavioral history, so initial recommendations are generic. I'm exploring ways to bootstrap the profiler faster — either through explicit interest signals at onboarding or through transfer learning from aggregate patterns.

Timing Optimizer for small audiences. The model works well for creators with established audiences. For new creators with few followers, the behavioral data is sparse and predictions are less reliable. This is an active area of improvement.

Stack Summary

  • Mobile: Flutter
  • Backend: PHP (migrating to more performant stack)
  • AI/ML: Python, custom models + CLIP
  • Infrastructure: Cloudflare
  • Compliance: GDPR, KVKK, COPPA

If you're building something similar or have questions about any of the systems, happy to go deeper in the comments.

Qioiper is available on Android: Google Play

Top comments (0)