Skip to content

[IA + SPAM] Use LLMs for supervising RSpamD bayesian learning #1876

@chibenwa

Description

@chibenwa

Why?

Per user bayes DB is very effective at spam qualification: low false positives / negatives and low run overhead.

However is is a supervised learning method and suffer from cold boot: the user needs to manually report ~50 mails in order for the bayesian qualifier to be effective.

In contrast LLMs are way more expensive to run (an order of magnitude) and less relevant than specialized well trained algorithms.

Ref https://fosdem.org/2025/schedule/event/fosdem-2025-5114-enhancing-email-spam-detection-with-llms-practical-experience-with-rspamd-and-gpt/

What?

We want that, if the bayes sample is insufficiant for effective qualification, fallback to LLMs prediction and use it to train bayes.

How?

Modify RspamD mailet to add decision symbols into headers (at least the bayes ones).

Write a IsRspamdBayesCalledmatcher that returns true if the bayesian module is sufficiently trained to run.

Write a LLMSpamOracle mailet that calls a generative AI model and ask the question: choose one of these three world to qualify the following email message: SPAM, HAM or NEUTRAL. Store that result into an attibute.

Write a LearnAsHam mailet.

Write a LearnAsSpam mailet.

Write a Sampling matcher that takes a float between 0 and 1 and represent the chance to be matched. Can be usefull to control the workload pushed to the LLM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions