Safeguarding oneself from any form of physical hurt is a natural human instinct. Most people have this tendency to run away for personal safety when seeing a mob or somebody assaulting another.
Particularly when we are not part of the mob fury or when the cause of someone assaulting another is unknown, I would say it is better to run away rather than trying to interfere. It may be considered selfish or cowardly. I would still personally believe that it is ‘karma neutral’. It means you would neither acquire bad karma or good karma.
But if you are a policeman and you try to run for your safety, then it is definitely adharma and you will acquire bad karma.
If the mob is trying to molest a girl and the girl is appealing for our help, then our running away selfishly will have an element of adharma in it and we will acquire bad karma, I think.
Suppose the person getting attacked is a known person and there is injustice in that attack, then too it would be adharma to run away without doing something to protect or support him.
Suppose we are forced to be part of the mob (because of our allegiance to a community, caste, political party or a group of vested interests) and the mob suddenly turns violent; in this case, if our personal ethos is against indulging in mob violence, then I would say running away is not adharma and it will not add bad karma to us.