The interview problem
Design a recommendation system that suggests useful new collaborators in an opt-in engineering community. Past joint projects form a graph. Predict new collaborations over the next thirty days without leaking future graph structure, overwhelming popular members or recommending people who are unavailable.
Original ML system-design practice, not a reported company interview. All examples and scale assumptions are hypothetical. Primary reference retrieved September 27, 2026; publication date not stated; interview date not applicable.
1. Define the edge and the product outcome
A node is a community member. An undirected historical edge indicates a verified joint project, with an event time and time the platform learned about it. The target is a first collaboration between two currently eligible members during the prediction horizon. Repeated collaboration is a different task and should not silently become a positive example here.
A likely future link is not necessarily a useful recommendation. Two people may already plan to collaborate, while a lower-probability suggestion might create new value. Begin with predictive quality, then evaluate whether exposure causes useful introductions. Do not treat observational link prediction as a causal estimate of recommendation benefit.
Exclude self-links, existing collaborators, blocked pairs and members outside the opted-in discovery population. Respect availability and limits on incoming suggestions. Membership in a graph does not authorize revealing private project relationships or using them as visible recommendation explanations.
2. Build examples from what was known at prediction time
For each cutoff t, construct a graph using only relationships known by t and available under the data policy. Features describe that snapshot; labels record first collaborations in (t,t+30 days]. A project completed before t but ingested afterward was not available to the online system at t. Preserve both timestamps so a historical backfill does not create an impossible offline advantage.
Wait for the outcome horizon and defined reporting delay before labeling a cohort complete. An unobserved pair is not proof that the members could never collaborate. It means no qualifying event was recorded within the observed horizon and coverage. Track platform observation gaps and avoid pretending that off-platform activity is exhaustively labeled.
Use chronological training, validation and final test cohorts. Ensure training labels have matured before the model's simulated fit time. Freeze transforms and graph features at the appropriate cutoff, including node attributes, degrees and embeddings. A temporal split of labels alone is insufficient if feature computation still uses the final graph.
3. Trace a leaked common-neighbor feature
At cutoff t, the only relevant edges are A–C and B–D. A and B have zero common neighbors. During the future label window, B–C appears and A–B becomes a positive target. Computing features from the final graph now gives A and B the common neighbor C, information unavailable at prediction time.
Removing only the held-out target A–B does not fix the leak: future edge B–C still changes the feature. A graph neural network can absorb the same information through message passing even when no explicit common-neighbor column exists. Training embeddings on the complete graph and then splitting pairs also leaks.
The fix is to reconstruct the entire permitted graph at each cutoff before candidate generation, feature aggregation or embedding training. For undirected edges, remove or include both adjacency directions consistently. Add fixtures in which introducing a future edge must leave historical features unchanged.
Open Graph Benchmark's collaboration task uses temporal splits and a defined negative-candidate ranking protocol. It is useful background for making the evaluation contract explicit. The new-collaborator eligibility rule and point-in-time feature requirements here describe this original application, not a claim that every benchmark has identical semantics.
4. Retrieve candidates before ranking
time-versioned project events + permitted member attributes
↓
cutoff graph / feature snapshot
↓
candidate union: graph neighborhood + skill retrieval
↓
pair scorer → policy/rate filtering
↓
limited recommendation slate → feedbackStart with a baseline using shared neighbors, recency, degree-adjusted similarity and compatible interests. Compare it with learned embeddings or a graph model on the same candidate sets. A complex model should earn its place through improvements under the operational evaluation, not merely through a better training loss.
Generate a bounded union of two-hop candidates and attribute-based retrieval. Attribute retrieval gives new or isolated members a path into the candidate set. Score pairwise compatibility, recency and availability, while avoiding a feature that merely rewards everyone for connecting to the most popular node.
For an undirected target, a symmetric pair score is natural, but recommendation exposure remains directional: suggesting B to A differs from suggesting A to B. Apply recipient capacity and user preferences at serving time. Recheck blocks and opt-out state after retrieval; a stale embedding index must not override current eligibility.
Log snapshot, model, candidate-generator and policy versions with each slate. Separate a candidate that was never retrieved from one retrieved but ranked poorly. Without retrieval diagnostics, ranking changes may be blamed for an unreachable target.
5. Choose negatives that match the question
Uniformly sampled nonedges are often easy: unrelated members with incompatible interests may dominate. Evaluate against the actual eligible retrieval population as well as a documented sampled benchmark. Hard negatives such as members with similar skills can expose ranking failures, but changing the mixture changes the measured difficulty.
For illustration, a target ranks second among itself and ninety-nine random negatives, yielding reciprocal rank 1/2=0.5. Against itself and 9,999 eligible candidates it ranks 101st, yielding about 0.009901. Neither number is false, but they answer different ranking questions. Report candidate construction, size, filtering and tie handling with the metric.
Negative sampling also alters probability interpretation. Suppose training retains every positive and independently samples one percent of negatives, with selection depending only on the label. If a model is calibrated to the sampled distribution and outputs qs=0.5, sampled odds are one. Writing s0=0.01 for negative inclusion probability and s1=1 for positive inclusion probability, population odds are (s0/s1)×sampled odds=0.01, giving population probability 0.01/1.01≈0.009901.
This correction requires the stated selection mechanism and calibration assumptions. Feature-dependent hard-negative sampling generally needs more detailed inclusion probabilities; a single prior adjustment is not sufficient. A ranking score need not be a calibrated chance of collaboration, and its UI should not claim otherwise.
6. Measure retrieval, ranking and degree effects
For 1,000 eligible held-out positive pairs, count each undirected pair once and define retrieval or exposure as occurring in either endpoint’s candidate set or slate. Suppose candidate generation retrieves 700 pairs and the final top-ten slates expose 280 of them. Candidate recall is 70%. Conditional success among retrieved positives is 280/700=40%. End-to-end recall is 28%, equal to 0.7×0.4 for this common denominator. Advertising only 40% hides the retrieval misses.
Report metrics by node degree, tenure, community and activity level. High-degree nodes can dominate micro-averaged edge metrics. Include user-level summaries and new-member coverage, making clear how users with no observed positive outcomes enter or are excluded from each statistic. Popularity alone is a useful baseline and a possible failure mode.
Evaluate concentration of incoming recommendations and resulting acceptance workload. A higher link score does not justify sending hundreds of introductions to one member. In an online trial, measure meaningful accepted introductions and subsequent collaborations, plus unwanted contact, opt-outs and overload.
Graph recommendations create interference: one member's treatment can affect another's outcomes. A simple per-user experiment may not isolate effects cleanly. Choose an experiment design and analysis that reflects the connected population, and explain remaining uncertainty instead of interpreting every observed difference causally.
7. Size the graph and refresh path
With one million members, all unordered pairs total 1,000,000×999,999/2=499,999,500,000. Scoring every pair is unnecessary and expensive. At five hundred candidates per active user, a full one-million-user refresh scores five hundred million directed candidate entries, before overlap or eligibility filtering. Directional serving entries and undirected unique pairs are different counts.
One million 128-dimensional float32 embeddings occupy 512 MB decimal before index overhead. Twenty million undirected edges stored twice as eight-byte neighbor IDs need 320 MB for raw IDs alone; offsets, timestamps, weights and storage/index overhead add to that. These are lower-level component estimates, not a complete memory budget.
Use periodic embedding refresh plus fresher lightweight eligibility and recent-event features. Version the refresh so historical evaluation can reproduce it. Keep a fallback for stale or missing embeddings, especially new members. A global rebuild should not temporarily erase blocks or make opted-out members discoverable.
8. Diagnose failures and trade-offs
False improvements can come from future edges, backfilled profiles, duplicate pair labels across cohorts or easy negative samples. Real failures include popularity feedback loops, missing cold-start candidates and a model that predicts existing social momentum without creating useful introductions. Trace each through data, retrieval, scoring and exposure separately.
A richer graph model can encode multi-hop structure while increasing refresh cost and leakage risk. Simpler pair features are easier to audit but may miss subtle compatibility. More candidates improve potential recall while increasing scoring and recipient-load management. Optimize the actual constrained product, not an unqualified link-ranking score.
Follow-ups: How do you handle deleted relationships? What if the graph is directed? How do you distinguish a missing edge from an unobserved edge? Should repeated collaboration use the same labels? How would you prevent a popular node from consuming every slate? Which historical attributes must be versioned?
9. Self-review rubric
- Define first versus repeated collaboration and the observation horizon.
- Build all graph features using knowledge available at the cutoff.
- Demonstrate leakage through a future non-target edge.
- Separate candidate recall from conditional ranking success.
- Document negatives and avoid unearned probability claims.
- Measure degree bias, cold start and recipient overload.
- Distinguish predicted links from causal recommendation value.
Sources and related practice
Open Graph Benchmark: Link Property Prediction, publication date not stated; retrieved September 27, 2026. Primary background for temporal collaboration splits and explicit negative-candidate metrics. All examples, product constraints and calculations here are original practice.
Continue with marketplace cold start and selection bias.
Continue your preparation
Choose a connected learning path or browse more ML system design questions. Read our editorial method and attribution policy.