Build a Recommendation Engine Pairing Freelance Experts with Open Jobs
System DesignModel answerLast updated
Design a low-latency engine that recommends eligible, available freelancers for client jobs, handles newcomers with no track record, and learns from downstream hiring outcomes.
Context
A marketplace connects companies with a pool of pre-screened freelance specialists. When a company publishes a job, or a recruiter runs a search, the platform should return a short list of freelancers who are eligible, have time to take the work, and are likely to deliver a good result.
Design the matching engine behind this feature.
What the system must do
- Eligibility screening. Exclude anyone who fails firm requirements: minimum overlap in working hours, a compatible pay range, valid authorization to work, and the required skills.
- Workload-aware ranking. Order the remaining people by how relevant their profile is, how well they have performed before, and how much free capacity they have. Do not push people who are already overbooked.
- Newcomer exposure. Freelancers who just joined have no client feedback. Give them a fair chance of being shown without hurting the quality of results for clients.
- Learning from outcomes. Record what happens after a recommendation (invite sent, interview passed, contract signed, client rating) and use it to update both the ranking model and per-freelancer scores.
Scale and targets
- 100,000 active freelancers
- 10,000 open jobs at any time
- About 500 new jobs per day
- p95 latency under 300 ms for query-time recommendations
- A change in a freelancer's availability (for example, they sign another contract) must reach the matching engine within 10 seconds
What to cover in your answer
- Overall architecture: services, storage, and queues or streams
- The matching pipeline from candidate generation through filtering, scoring, workload adjustment and exploration, to final top-K selection
- The core data model (freelancer, job, match/recommendation, feedback event)
- How you handle newcomers and how feedback flows back into ranking, both online and offline
State your assumptions, do a quick capacity estimate, and call out the main trade-offs.
Hints
Hint 1
Do the arithmetic first: 100K embeddings of a few hundred dimensions fit in memory on one machine, and 500 jobs per day is a trivial write rate. Let that shape how much infrastructure you propose.
Hint 2
Separate slowly changing data (profile text, embeddings, static eligibility fields) from fast-changing data (free hours, pending invites). Keep the former in a search index and read the latter live from a low-latency store so the 10-second freshness target does not depend on index lag.
Hint 3
For newcomers, think in terms of a prior built from vetting signals plus a bandit-style sampler, limited to a few slots that skip the top positions. Log the probability with which each item was shown so you can correct for position bias when retraining.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
1. Clarify and size
Questions to ask first:
- Is the output a ranked list for a human, or are invitations sent automatically?
- Is the goal "contract signed" or "contract that goes well"? This decides the training label. I will optimize for successful contracts: P(sign) x expected rating.
Back-of-envelope:
- Corpus: 100K freelancers with 768-dim float32 embeddings is roughly 300 MB. One node holds the full index; replicas exist for availability, not sharding.
- Writes: 500 jobs/day is about 0.006 QPS. Profile and availability updates are perhaps tens per minute. The system is read-heavy.
- Reads: assume around 50 searches/sec at peak, plus a batch match when a job is posted.
- Latency budget (300 ms p95): retrieval about 80 ms, capacity and feature fetch about 30 ms, scoring 500-1,000 candidates about 50 ms, re-rank and serialization about 30 ms, the remainder as headroom.
- Freshness: availability within 10 s; profile text and embeddings can lag by minutes.
2. API sketch
POST /jobscreates a job and triggers an asynchronous precompute of matches.POST /matchtakes a job id or inline criteria pluskand a cursor, and returns[{freelancer_id, score, reasons, is_exploration}]and arequest_id.POST /eventstakesrequest_id, job_id, freelancer_id, type, value, ts.PUT /freelancers/{id}/availability.
The request_id lets every later outcome be joined to the exact ranking, model version and position that produced it.
3. Data model
- Freelancer (Postgres, source of truth): skills with level and years, embedding, pay range, timezone and working window, work authorizations, vetting score, weekly hours, onboarded_at, status.
- Job: client, required and optional skills, embedding, pay range, minimum overlap hours, required authorization, hours per week, status.
- Match (one row per surfaced candidate): request_id, job_id, freelancer_id, model_version, position, score, was_exploration, propensity, created_at.
- FeedbackEvent (append-only, stream to warehouse): match_id, type, value, event time, ingest time.
- Capacity (Redis, derived): weekly hours and committed hours per freelancer, plus short-TTL "hold" keys for pending invitations and a sliding-window counter of recent invites.
4. Architecture
- Profile and Job services write to Postgres with a transactional outbox; CDC publishes to Kafka topics such as
freelancer-updatesandcontract-events. - An indexer upserts into a hybrid index (OpenSearch with BM25 plus HNSW, or Vespa). Static hard attributes (authorization, pay range, coarse timezone bucket, skills) are filterable fields.
- A capacity service consumes contract events and updates Redis atomically (Lua). Lag is typically under a second.
- A stateless matching service orchestrates the pipeline and calls a ranking service (gradient-boosted trees, or a small two-tower model feeding GBDT).
- A feature store with identical definitions online (Redis) and offline (warehouse) to avoid training/serving skew.
- A feedback pipeline: event log, stream job for per-freelancer posteriors, nightly retrain with offline evaluation and an A/B gate.
5. Matching pipeline
Candidate generation (about 1,000). One hybrid query: ANN on the job embedding plus BM25 on required skills. Apply cheap hard filters as pre-filters inside the index; post-filtering after ANN risks returning too few results. Pull a second, separate pool of newcomers (joined in the last 30 days or fewer than 3 reviews).
Exact filtering. Compute precise timezone overlap from working windows, verify each required skill meets its level, and batch-read capacity from Redis (MGET). Drop anyone whose weekly - committed - holds is below the job's hours. Capacity is always read live, never from the index, which is what makes the 10-second target cheap.
Scoring. A multi-task model predicts P(invite), P(pass | invite), P(sign | pass) and E[rating | sign]. Rank by P(sign) x E[rating]. Features: skill coverage, embedding similarity, pay fit, smoothed historical conversion, recent activity, vetting score, similarity to the client's past successful hires.
Workload adjustment and exploration. Multiply by a load factor such as min(1, available/needed) * exp(-lambda * pending_invites_7d) to softly demote overbooked or heavily invited people. Reserve a few slots (say 2 of the top 10, never positions 1-2) filled by Thompson sampling from newcomers who passed every hard filter and a minimum relevance bar. Log each slot's propensity.
Top-K and diversity. MMR-style re-rank to avoid near-duplicate profiles, attach readable reasons ("5/5 required skills, 6 h overlap"), and persist Match rows asynchronously.
6. Newcomers and feedback
Cold start. Give each newcomer a Beta prior seeded from vetting data (assessment, interview grade, résumé model) rather than a flat prior. Thompson sampling then shows promising people more often and retires weak ones as evidence accumulates. Guardrails: exploration candidates must clear all hard filters and a relevance floor, and they never occupy the top two slots.
Feedback.
- Online (seconds): a stream job updates Beta posteriors for invite-to-pass and pass-to-sign, plus conversion features in the online store.
- Offline (nightly/weekly): retrain on Match joined with FeedbackEvent.
- Debiasing: weight examples by inverse propensity, because position 1 attracts invites regardless of fit. Exploration traffic gives near-unbiased samples.
- Rollout: gate on offline NDCG/AUC, then A/B test on signed-contract rate and rating.
7. Trade-offs
- Pre- vs post-filtering in ANN: pre-filtering guarantees enough candidates but is slower; at 100K documents the cost is negligible.
- Precompute vs on-demand: precompute per-job shortlists for new jobs (cheap at 500/day) but always re-check capacity at read time.
- Exploration rate: more exploration speeds learning about newcomers but costs short-term quality; cap it and measure the quality delta in A/B tests.
- Delayed labels: reviews arrive weeks later, so use early proxies (interview pass, signing) for fast updates and correct with the final label when it arrives.
8. Common mistakes
- Reading availability from the search index, which blows the 10-second target.
- Optimizing clicks or invites instead of successful contracts.
- Exploration that ignores hard filters, which harms client trust.
- Not logging propensities, which makes later models biased toward whatever was shown first.
- Different feature code online and offline, causing skew.
- Ignoring failure modes: if Redis is down, fail closed on capacity (or fall back to a conservative cached view) rather than recommending overbooked people.