Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
README.md
# Chat Message Moderation with Ollama
PG-13 content filter for chat messages using local LLM.
## Current Status
**Model:** gemma2:2b (1.6GB, Google's safety-focused model) ✅ **RECOMMENDED**
**Performance:** 100% accuracy on explicit content, ~50% false positive rate on edge cases
**Output:** Simple t/f decision
**Speed:** ~1-2s per message (slower but reliable)
### Why gemma2:2b?
- ✅ **NEVER misses explicit content** (0% false negatives)
- ✅ Correctly blocks: profanity, sexual content, violence, drugs, hate speech
- ✅ Allows: normal chat, URLs, questions
- ⚠️ May block some borderline content (false positives on foreign language, slang)
- 🎯 **Better to be safe than sorry** for content moderation
### Tested Alternatives
| Model | Size | Speed | Explicit Content | False Positives |
|-------|------|-------|------------------|-----------------|
| **gemma2:2b** ✅ | 1.6GB | ~1.5s | 100% blocked | ~50% on edge cases |
| qwen2.5:0.5b ❌ | 397MB | ~300ms | **0% blocked** | Low |
| qwen2.5:1.5b ❌ | 986MB | ~2.5s | Blocks everything | 100% |
## Setup
1. **Start Ollama daemon:**
```fish
ac-llama start
```
2. **Check status:**
```fish
ac-llama status
```
3. **View logs:**
```fish
ac-llama logs
```
## Usage
### Test MongoDB Messages
Test chat messages from the aesthetic.chat-system collection:
```fish
# Test 20 messages
node test-mongodb-messages.mjs 20
# Test 50 messages
node test-mongodb-messages.mjs 50
# Continuous testing (all messages)
node test-mongodb-messages.mjs 100 --continuous
```
### Direct HTTP Testing
Test single messages via HTTP (requires Caddy server running):
```fish
./start-server.fish
curl -X POST http://localhost:8080/censor \
-H "Content-Type: application/json" \
-d '{"message": "hello world"}'
```
## How It Works
- **Model:** qwen2.5:0.5b (397MB, fast inference)
- **Prompt:** Simple t/f rating for PG-13 appropriateness
- **Blocks:** Sexual content, body functions, profanity, violence, drugs, hate speech
- **Allows:** URLs, links, normal conversa…