]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Feature] Add expression-based autolearn for neural LLM providers
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 12 Jan 2026 10:58:03 +0000 (10:58 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 12 Jan 2026 10:58:03 +0000 (10:58 +0000)
commitcdaf02ca1a81afc5ca4b138c5f5ae297ec9cbf93
treedb758d40581851d0cc4207e611f06e80c51f8e6f
parentfe2e4211f0ac504d81c14961d241f7a5ab9fba7b
[Feature] Add expression-based autolearn for neural LLM providers

Add integrated autolearn system for neural networks with LLM providers:

- New lua_neural_learn library with guards system and rspamd_expression
  support for complex conditions
- Expression-based conditions: spam_condition, ham_condition using
  rspamd_expression syntax (e.g., "BAYES_SPAM & DMARC_POLICY_REJECT")
- Score, action, and symbol-based thresholds
- Pluggable guards via rspamd_plugins['neural'].autolearn hooks
- Mempool-based flag passing (no double scanning)
- Probabilistic sampling for training volume control

Also includes contrib/neural-embedding-service with a FastEmbed-based
Python service for CPU-optimized embedding inference, compatible with
both Ollama and OpenAI API formats.

Configuration example:
  autolearn {
    enabled = true;
    spam_score = 15.0;
    spam_condition = "BAYES_SPAM & (DMARC_POLICY_REJECT | RBL_SPAMHAUS)";
    ham_condition = "BAYES_HAM & DKIM_VALID_AU & SPF_PASS";
  }
conf/modules.d/neural_autolearn.conf [new file with mode: 0644]
contrib/neural-embedding-service/Dockerfile [new file with mode: 0644]
contrib/neural-embedding-service/README.md [new file with mode: 0644]
contrib/neural-embedding-service/embedding_service.py [new file with mode: 0644]
contrib/neural-embedding-service/requirements.txt [new file with mode: 0644]
lualib/lua_neural_learn.lua [new file with mode: 0644]
src/plugins/lua/neural.lua