Recommender systems
Context-Aware Recommendation
Model device, location, query, time, weather, companions, and surface context while controlling sparsity, privacy, and spurious feature crosses.
By the end you can
- Explain how context changes user-item utility
- Distinguish additive effects, feature crosses, and routed context experts
- Identify confounding, sparsity, privacy, and serving-skew risks
- Design ablation, shuffle, counterexample, and proportionality tests
Key idea
Collect the signal only if it changes the decision
Context is useful when it changes the decision and is available, lawful, stable, and supported at serving time. Two of those words have a price, and the bill has already been sent to somebody.
Lawful is not a house preference. It is Article 5(1) of the GDPR. Personal data must be “collected for specified, explicit and legitimate purposes” — that is 5(1)(b). It must be “adequate, relevant and limited to what is necessary in relation to the purposes for which they are processed (‘data minimisation’)”, which is 5(1)(c). And it must be “kept in a form which permits identification of data subjects for no longer than is necessary”, which is 5(1)(e).
That has already been turned into an instruction a feature team can act on. The European Data Protection Board's Guidelines 4/2019, section 3.5, tell controllers to predetermine which features and parameters of a processing system are permissible. They must determine first whether they need personal data at all, and whether the purpose can be met with less detailed or aggregated data. Then they must reconsider periodically whether the data they process is still adequate, relevant and necessary, or should be deleted or anonymised.
What precise location resolves to in practice is on the public record. On 9 January 2024 the Federal Trade Commission announced a proposed consent order against the data broker X-Mode Social and its successor Outlogic. The seven-count complaint alleged violations of Section 5(a) of the FTC Act, among them unfairly selling sensitive location data and unfairly categorising consumers by sensitive characteristics. The FTC's analysis of the order describes one thing the coordinates were used for: “X-Mode entered into an agreement with a privately held clinical research company to trace consumers in Ohio within a 200-meter radius of Cardiologist offices, Gastroenterologist offices, Endocrinologist offices, Pharmacies, and Drugstores.”
The order bans selling, licensing or using sensitive location data. It defines seven categories of sensitive location. It requires a documented retention schedule, updated before any newly collected data type is used. It requires the deletion or destruction of all historic location data and everything derived from it, absent consent or deidentification. It runs for 20 years.
Signals gathered on the chance they might help become a standing liability the moment they enter the pipeline. X-Mode's historic location data is being destroyed because a 20-year order requires it, not because anything about a stored feature expires on its own.
Example
Identical targeting, and the delivery system chose the audience
Buy ads with identical targeting, identical budgets and identical bidding. Then measure who actually receives them. The advertiser's inputs are held constant by construction, so anything that varies downstream came from the system. That was the experiment Ali, Sapiezynski and four co-authors published in 2019.
What they measured: “In the most extreme cases, our ads for jobs in the lumber industry reach an audience that is 72% white and 90% male, our ads for cashier positions in supermarkets reach an 85% female audience, and our ads for positions in taxi companies reach a 75% Black audience, even though the targeted audience specified by us as an advertiser is identical for all three.”
The skew came from the platform's own delivery optimisation, not from the advertiser's targeting. Read those delivered audiences as evidence about who wanted the job, and you have a causal story about preference. It rests entirely on the ranker's behaviour. That is the mistake a context model makes when it reports back the pattern its own pipeline created.
- Held constant: Targeting, budgets and bidding were identical across the ads being compared, so the study measured delivery rather than intent.
- The system, not the input: Neutral album ads reached a 45%-white audience, while country and hip-hop ads from the same campaign reached audiences 80% and 13% white.
- Housing slice: Housing ads with the same targeting and the same budget ranged from over 72% Black to as little as 51% Black.
- The blank-image ablation: Ads whose images were made visually blank with a 98%-transparent alpha channel still delivered with statistically significant demographic differences, indicating an automated image classification driving the relevance estimate.
- The sequel: The United States sued Meta over its housing advertising system in 2022 — complaint on 21 June, final judgment on 27 June. Meta stopped using the “Special Ad Audience” tool for housing ads and agreed to offer housing advertisers no targeting options that directly describe or relate to FHA-protected characteristics.
Context changes the meaning of preference
A recommender can condition its policy on the current situation: query, surface, device, time, location, task, party, weather, inventory, or recent sequence. The same user-item pair can have different value under different conditions.
Context features slice the evidence thin and offer tempting correlations. A model may end up learning an artifact of the market, the interface, or the way the data was collected, instead of a contextual effect that transfers anywhere else.
Context has a long paper trail in this field. The multidimensional design was set out in 2005: contextual dimensions sit alongside the user and item dimensions, and the model also supports profiling information and hierarchical aggregation of recommendations. Adomavicius and three co-authors put it in one sentence in their abstract: “The article presents a multidimensional (MD) approach to recommender systems that can provide recommendations based on additional contextual information besides the typical information on users and items used in most of the current recommender systems.” Besides, not inside.
The paper conceded the cost inside its own design. Its rating-estimation method selects two-dimensional segments of ratings pertinent to the recommendation context. That method is paired with a combined one, which falls back to the standard two-dimensional approach where the multidimensional one does not win. The design problem has not moved since. Every added dimension divides the evidence again.
Adding a context dimension is a bet that the effect is real and transfers, paid for with thinner evidence in every cell. The 2005 framework hedged that bet itself, with a combined method that falls back to the standard two-dimensional approach where the multidimensional one does not win.
Analogy
A menu for a particular table
A restaurant that has learned the table's dietary restrictions, the hour, the weather outside, and whether anyone is celebrating will send out a different meal for the same diner on two different nights. A recommender conditions on the same kind of situation. One difference matters. The waiter was told what the table needs. The system infers it, from signals collected for other purposes and sometimes from choices the platform itself made earlier. So treat inferred context as evidence with a confidence attached, and as data with a sensitivity attached.
Situational relevance requires context that is useful, supported, and proportionate.
Visual
A context contract
A context feature earns its place by answering five questions, and teams skip the first: how could this value change what the system should do? Granularity and interaction support are the two questions a shipped system can answer in public, and one did.
Frappé was a context-aware Android app recommender, deployed in 2015 to about 1,000 users through Google Play, with a 33-user field study alongside it. Baltrunas and three co-authors published its precision budget. Fifteen input signals, each with its granularity fixed: four usage signals — installed, used, skipped and viewed apps — and eleven context signals. Time of day is one of 4 values, day of week one of 7, period of week one of 2. Location is one of 3 values: Home, Work, Other. City is a boolean, true if the user is within 20 km of the centre of a major city; country is a name. Weather is one of 9 values — Sunny, Cloudy, Foggy, Windy, Drizzle, Rainy, Stormy, Sleet, Snowy. Battery level is one of 5, energy source one of 3, connectivity one of 3, and screen state a boolean. Raw GPS is coarsened server-side rather than ranked on.
That one table answers granularity and interaction support at the same time, because a cross of coarse buckets has cells a deployment can actually fill. The system was not weaker for it: “In total we had 3726 view app detail events and 714 of these led to an install of an app. This equates to a 19% conversion rate and is similar to the results reported in [3] by a context-aware method.” The paper cites 9% for a popularity baseline. The client sampled phone state once per minute, at under 3% of daily battery consumption.
The same guidelines ask for that test before collection: can the purpose be met with less detailed or aggregated data? The contract then ends on change and fallback. That asks what happens when the value is missing, stale, or unlike anything the model was trained on.
Decision relevance
Explain how the feature could alter utility, eligibility, or presentation.
Availability
Confirm that the value exists before ranking and with acceptable latency.
Granularity
Choose a precision that supports the task without unnecessary privacy risk.
Interaction support
Measure how much data exists for important feature combinations.
Change and fallback
Define behavior when context is missing, stale, or out of distribution.
Steps
Add context through controlled evidence
Write the causal story before the feature exists. How could this piece of context change what the user decides?
Step three is where context features fail quietly, and it has a production taxonomy. Google's TFX platform includes a data-validation component used by hundreds of product teams to monitor several petabytes of production data per day. The team that built it published it in 2019. They classify training-serving skew into exactly three categories: feature skew, distribution skew, and scoring/serving skew. On the first they are blunt: “Several factors contribute to this issue but the most common is different code paths used for generation of training and serving data.”
They also name the specific trap a context feature walks into: “time travel”. A feature computed by querying a non-static source takes one value in training and another at serving. Their example is click counts read from a database. The check is mechanical rather than argumentative. Key-join corresponding batches of training data and logged serving data, and compare feature by feature.
Proportionality closes the sequence, weighing measured lift against data sensitivity, latency, and maintenance cost.
1. Write a causal story
State how the feature could change the user decision without claiming proof.
2. Check support and redundancy
Measure missingness, cardinality, correlation, and slice size.
3. Build serving parity
Use identical definitions, timestamps, defaults, and privacy controls.
4. Ablate and stress
Remove context, shuffle it, and test unusual combinations.
5. Evaluate proportionality
Compare lift with data sensitivity, latency, and maintenance cost.
Example
Context-model risks
Proxy discrimination and privacy overcollection come from the same instinct: gather more context and let the model decide. Location or device can stand in for something sensitive. Precise context can be collected long past the point where it changes any decision. Neither risk is hypothetical. Both have a docket number.
- Proxy discrimination: Location or device acts as a sensitive socioeconomic proxy, and the ranking system can construct the proxy itself. The United States sued Meta over that in 2022, and the Justice Department's summary of the case says what was alleged: “Specifically, the complaint alleged, among other things, that Meta uses algorithms in determining which Facebook users receive housing ads and that those algorithms rely, in part, on characteristics protected under the FHA.” Final judgment came on 27 June 2022. Meta built a new “Variance Reduction System” to reduce the gap between an ad's eligible audience and its actual audience. It paid a civil penalty of $115,054 — the maximum available under the FHA at the time — and accepted Guidehouse Inc. as third-party reviewer.
- Sparse memorization: Rare combinations receive extreme weights from tiny samples. That is why Frappé fixed its cardinalities in advance — time of day at 4 values, location at 3, weather at 9, city reduced to a boolean at 20 km from a major city centre.
- Training-serving skew: Context is computed differently or arrives too late online. Google's data-validation work sorts the failure into feature skew, distribution skew and scoring/serving skew. It also names “time travel” — a value read from a non-static source, such as click counts held in a database — as the way one context feature comes to mean two things.
- Confounded storytelling: Correlation is described as a causal reason for preference. The Facebook ads whose images were made visually blank by a 98%-transparent alpha channel still delivered with statistically significant demographic differences. That points at an automated image classification inside the relevance estimate, not at anything an audience preferred.
- Privacy overcollection: The system gathers precise context without proportional product value. X-Mode ingested billions of location signals daily and sold raw timestamped latitude/longitude tied to Mobile Advertiser IDs. The resulting order defines seven categories of sensitive location, bans selling, licensing or using them, and runs for 20 years.
Key idea
The context gate
Retain a contextual feature only when its incremental value survives ablation, serving-parity tests, privacy review, and sparse-slice analysis. The offline number is not the value. There is a published pair of numbers that shows the gap.
Google reported both for the same system in 2016, in the paper that introduced Wide & Deep. It ran a three-week A/B test on Google Play with 1% of users per arm. Offline holdout AUC was 0.726 for the wide-only control, 0.722 for deep-only and 0.728 for Wide & Deep. Online app acquisitions moved 0%, +2.9% and +3.9%. Their own reading: “While Wide & Deep has a slightly higher offline AUC, the impact is more significant on online traffic.” A 0.002 AUC difference sat next to a +3.9% live gain.
The same paper prices the availability question the contract asks. The system scored over 10 million apps per second at peak. A single-threaded batch took 31 ms, cut to 14 ms including serving overhead by splitting batches across threads. A context feature has to be computed inside that kind of window, from the same source and under the same definition as in training. Only then does any offline gain it showed count for anything.
A feature that cannot be reproduced at serving time is a training artifact, however much offline lift it showed. And offline lift is a weak witness in any case: 0.002 of AUC in the test where the live gain was +3.9%.
Key takeaways
- Context-aware recommendation should reduce ambiguity, not license collecting every available signal. Determine first whether you need personal data at all, and whether the purpose can be met with less detailed or aggregated data. That is what the European Data Protection Board's Guidelines 4/2019 tell controllers.
- Context-aware recommendation conditions the policy on the current situation: query, surface, device, time, location, task, party, weather, inventory, or recent sequence. Frappé shipped fifteen such inputs — four usage signals and eleven context signals, each at a granularity fixed in advance.
- Context is useful when it changes the decision and is available, lawful, stable, and supported at serving time. Lawful is enforceable: final judgment against Meta over housing ads on 27 June 2022, and a $115,054 civil penalty on the record.
- Decision relevance comes first, and it is the question teams skip: explain how the feature could alter utility, eligibility, or presentation before it exists. The 2005 multidimensional model hedged its own bet, pairing itself with a combined method that falls back to the standard two-dimensional approach where the multidimensional one does not win.
- Proxy discrimination remains a practical risk: location or device acts as a sensitive socioeconomic proxy, and a ranker can manufacture the proxy on its own. Ads made visually blank with a 98%-transparent alpha channel still delivered with statistically significant demographic differences.
- A context feature must justify its measured lift against the sensitivity of the data it needs, the latency it adds, and the cost of maintaining it. Frappé sampled phone state once per minute at under 3% of daily battery consumption; X-Mode's raw latitude/longitude business ended in an FTC order running 20 years.