Candidate generation reduces a large catalog to a tractable set, but eligibility must still be enforced before anything is served.
Candidate retrieval: separate broad discovery from hard eligibility
Combine candidate sources
A lesson feed can draw from prerequisites, related subjects, recently updated material and broad popularity. Each source can nominate item IDs with a source label. Deduplicate by canonical path before ranking; otherwise the same lesson can occupy several positions. Cold-start routes need a nonbehavioral source so new lessons enter the pool.
Apply hard gates early
Exclude unpublished pages, completed lessons when the product requires novelty, and content outside the learner’s accessible curriculum. A model score is not a permission grant. Recheck at serving time because publication or access state can change after a batch index is built. Document lifecycle has the same stale-index problem.
Measure candidate recall
If a relevant future lesson never appears in the candidate pool, the ranker cannot recover it. Evaluate retrieval recall on held-out, eligible outcomes while separating missing judgment from irrelevant item. Report coverage by new items, sparse learners and subject areas. A pool of only popular Java lessons may score well overall while starving AI & Data discoveries.
Bound latency and fallback
Cap each source and the final union, and document what happens when a personalized source times out. A fallback can use prerequisite and editorial paths, but must obey the same eligibility rules. Test duplicate nominations, a deleted page and an empty pool. An empty eligible set should return an explicit state rather than reintroducing barred items.
Implementation
def eligible_candidates(nominations, published_paths, completed_paths, limit=60):
if limit < 1:
raise ValueError("limit must be positive")
selected = []
seen = set()
for lesson_path in nominations:
if lesson_path in seen or lesson_path not in published_paths or lesson_path in completed_paths:
continue
seen.add(lesson_path)
selected.append(lesson_path)
if len(selected) == limit:
break
return selectedPerformance and operating cost
M nominations require O(M) expected time and O(K) memory for K retained paths. Hard-gate checks are O(1) expected with sets; a remote permission check changes the latency budget and may need a versioned local cache plus final validation.
Common Mistakes
- Do not treat the ranker as an eligibility filter.
- Do not count duplicate nominations as extra catalog coverage.
- Do not hide recall losses behind ranking metrics.
Read next
- Ranking and re-ranking: balance relevance with coverage and curriculum rules
- Offline recommendation evaluation: replay catalog and learner state in time
- Content and collaborative signals: give sparse learners a real fallback
- Retrieval corpus contracts: identity, permissions and document lifecycle
Continue the workflow: Graph model evaluation: report sparse-node and relation-specific failures.
Continue the workflow: Retrieval index versions, eligibility filters and candidate parity.
