Design a Work-Together Distance Between Any Two Employees of a Company
Company: Glean
Role: Machine Learning Engineer
Category: ML System Design
Difficulty: medium
Interview Round: Onsite
Design a "people distance" `d(u1, u2)` between any two users in a company that quantifies how much the two of them work together. A smaller distance should mean a closer working relationship. This was a 60-minute ML design round for a machine learning engineer role.
The prompt gives no more detail, so you drive the framing: decide what the distance is for, which signals it can use, how to learn and evaluate it, and how to serve it for every pair of employees.
```hint Define "working together" first
Before choosing a model, list the observable events inside a company that show two people work together, and decide whether you have any labels at all or must build proxy labels.
```
```hint Evaluating without ground truth
Think about which future behaviour a good distance computed today should predict, and how you would hold that behaviour out in time.
```
### Clarifying Questions
- What consumes the distance: ranking search results or documents, people suggestions, expertise finding, or something else? Does the consumer need a true metric (symmetric, satisfying the triangle inequality) or only a ranking score?
- Which signals is the system permitted to use (org chart, calendar metadata, document co-editing, comments and mentions, chat or email metadata), and is message content off limits?
- How large are the companies, in employees per customer, and how fresh must the distance be?
- Should the distance be symmetric, and should recent collaboration count more than old collaboration?
### What a Strong Answer Covers
- A framing tied to a concrete consumer and an explicit definition of closeness
- A signal inventory with normalization for event size, time decay, and privacy and permission limits
- A graph-based baseline and a learned model, with proxy labels and a leakage-free time split
- Offline and online evaluation that does not depend on ground truth that does not exist
- Serving every pair without computing all N^2 distances, plus cold start for new hires
- Monitoring for reorganizations and drift
### Follow-up Questions
- How do you assign distances for a new hire with no interactions yet?
- Two people never interact directly, but both work closely with the same third person. How does your design handle that?
- How do you keep the distance from exposing private relationships, such as a confidential one-on-one or a private channel?
- After a reorganization, how quickly does your distance adapt, and how would you detect that it has gone stale?
Overview: Design a learned distance between any two employees of a company that reflects how much they actually work together. Tests ML framing without ground-truth labels, collaboration signals and their normalization, link-prediction training, evaluation, privacy and serving at company scale.