discourse/plugins/discourse-ai/lib/embeddings
Rafael dos Santos Silva 281d0c3e11
FEATURE: add configurable age penalty for semantic related topics (#34842)
Introduces two new site settings to apply exponential age-based
penalties to semantic topic suggestions, similar to algorithms
used by Reddit/HN:

* ai_embeddings_semantic_related_age_penalty (default: 0.3)
  Controls penalty strength. 0.0 = disabled, 0.3 = gentle bias
  toward newer content, 1.0+ = strong recency preference

* ai_embeddings_semantic_related_age_time_scale (default: 365 days)
  Controls time horizon. Use 365 for yearly scale, 90 for
  quarterly scale, etc.

Formula: similarity_score / POWER(age_in_days / time_scale + 1, penalty)

This allows sites to de-prioritize older topics in suggestions
while maintaining configurability for forums with different
content lifecycles. Performance optimized with conditional
JOINs only when penalty > 0.


"Age" here is using bumped_at to work with communities with long
lived mega topics too.

---------

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2025-09-18 10:24:19 -03:00
..
strategies FEATURE: Make HyDE optional in AI search (#34074) 2025-08-05 11:50:16 -03:00
entry_point.rb FEATURE: Use embeddings to find similar topics to the one being composed (#34448) 2025-08-25 13:38:01 +10:00
schema.rb FEATURE: add configurable age penalty for semantic related topics (#34842) 2025-09-18 10:24:19 -03:00
semantic_related.rb FEATURE: add configurable age penalty for semantic related topics (#34842) 2025-09-18 10:24:19 -03:00
semantic_search.rb PERF: do not hydrate all candidates in big relation (#34553) 2025-08-27 14:09:04 +10:00
semantic_topic_query.rb
vector.rb FEATURE: Make HyDE optional in AI search (#34074) 2025-08-05 11:50:16 -03:00