I once heard that filtering spam by using blacklists is not a good approach, since some user searching for entries in your dataset may be looking for particular information from the sources blocked. Also it'd become a burden to continuously validate the current state of each spammer blocked, checking if the site/domain still disseminate spam data.

Considering that any approach must be efficient and scalable, so as to support filtering on very large datasets, what are the strategies available to get rid of spam in a non-biased manner?

Edit: if possible, any example of strategy, even if just the intuition behind it, would be very welcome along with the answer.


2 Answers 2


Spam filtering, especially in email, has been revolutionized by neural networks, here are a couple papers that provide good reading on the subject:

On Neural Networks And The Future Of Spam A. C. Cosoi, M. S. Vlad, V. Sgarciu http://ceai.srait.ro/index.php/ceai/article/viewFile/18/8

Intelligent Word-Based Spam Filter Detection Using Multi-Neural Networks Ann Nosseir, Khaled Nagati and Islam Taj-Eddin http://www.ijcsi.org/papers/IJCSI-10-2-1-17-21.pdf

Spam Detection using Adaptive Neural Networks: Adaptive Resonance Theory David Ndumiyana, Richard Gotora, and Tarisai Mupamombe http://onlineresearchjournals.org/JPESR/pdf/2013/apr/Ndumiyana%20et%20al.pdf

EDIT: The basic intuition behind using a neural network to help with spam filtering is by providing a weight to terms based on how often they are associated with spam.

Neural networks can be trained most quickly in a supervised -- you explicitly provide the classification of the sentence in the training set -- environment. Without going into the nitty gritty the basic idea can be illustrated with these sentences:

Text = "How is the loss of the Viagra patent going to affect Pfizer", Spam = false Text = "Cheap Viagra Buy Now", Spam = true Text = "Online pharmacy Viagra Cialis Lipitor", Spam = true

For a two stage neural network, the first stage will calculate the likelihood of spam based off of if the word exists in the sentence. So from our example:

viagra => 66% buy => 100% Pfizer => 0% etc..

Then for the second stage the results in the first stage are used as variables in the second stage:

viagra & buy => 100% Pfizer & viagra=> 0%

This basic idea is run for many of the permutations of the all the words in your training data. The end results once trained is basically just an equation that based of the context of the words in the sentence can assign a probability of being spam. Set spamminess threshold, and filter out any data higher then said threshold.

  • 1
    $\begingroup$ +1 Thanks for the references. Do you have any small example, or could show just an intuition behind one of the approaches? I'm not acquainted to neural networks, but I can check it out if the example requires such knowledge base. $\endgroup$
    – Rubens
    Jun 15, 2014 at 15:25
  • $\begingroup$ Could you be more specific about your use case? Strategy can vary wildly depending on how you tend to implement the solution. $\endgroup$
    – neone4373
    Jun 15, 2014 at 20:26
  • $\begingroup$ I mean, I just would like to see what is the idea behind a different approach. For example, if I was to tell you what is done by using blacklists (which we know is not good), I could describe the algorithm as: scan the dataset looking for entries containing "viagra"; add such entries to the blacklist. I just would like to see a high-level description of a methodology/algorithm. Do they gather spam network usage information and put on a neural network classifier, or what do they do? $\endgroup$
    – Rubens
    Jun 15, 2014 at 20:35

Blacklists aren't have value for a number of reasons:

  1. They're easy to set up and scale - it's just a key/value store, and you can probably just re-use some of your caching logic for the most basic implementation.
  2. Depending on the size and type of the spam attack, there will probably be some very specific terms or URLs being used. It's much faster to throw that term into a blacklist than wait for your model to adapt.
  3. You can remove items just as quickly as you added them.
  4. Everybody understands how they work and any admin can use them.

The key to fighting spam is monitoring. Make sure you have some sort of interface showing which items are on your blacklist, how often they've been hit in the last 10 minutes / hour / day / month, and the ability to easily add and remove items.

You'll want to combine a number of different spam detection models and tactics. Neural nets seem to be a good suggestion, and I'd recommend looking at user behavior patterns in addition to just content. Normal humans don't do things like send batches of 1,000 emails every 30 seconds for 12 consecutive hours.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.