LogLens AI β Custom Sliding Window Log Analyzer
A custom-architected causal LM with Sliding Window Attention, trained on real production log data.
Memory usage: 61 MB fixed regardless of log file size.
10Γ cheaper than GPT-4 for log analysis.
β οΈ PROOF OF CONCEPT (PoC) DISCLAIMER
This model proves the architecture and memory math of Sliding Window Attention. This custom 16M parameter model was trained on a small synthetic dataset of log files to prove the plumbing (RAG pipeline, vLLM deployment). It is NOT a general-purpose AI like ChatGPT. To get true natural language generation in production, this architectural concept must be injected into a large pre-trained model (like Llama-3 8B) rather than using our tiny custom-built weights.
What's in This Repo
| File | What it does |
|---|---|
model.safetensors |
Trained weights (16M params) |
config.json |
Model architecture config |
tokenizer.json + vocab |
GPT-2 tokenizer |
log_attention.py |
Custom sliding window attention module |
mini_deepseek_model.py |
Full causal LM architecture (RMSNorm, SwiGLU, RoPE) |
train_mini_deepseek.py |
Training pipeline β run this to retrain on your own logs |
save_and_upload.py |
Verify saved model + upload to HuggingFace |
ingest_logs.py |
Embed log files into ChromaDB vector store |
rag_query.py |
Query logs via ChromaDB + this model (RAG pipeline) |
requirements.txt |
All Python dependencies |
Quick Start
1. Run the live demo (no setup needed)
π https://huggingface.co/spaces/ShivanshiNigam/loglens-demo
2. Use the RAG pipeline locally
# Clone the GitHub repo
git clone https://github.com/shivanshinigam/DeepseekLogLens
cd DeepseekLogLens
# Install dependencies
pip install -r requirements.txt
# Generate sample logs
python3 generate_logs.py
python3 generate_3_log_files.py
# Step 1 β Embed your log files into the vector DB
python3 ingest_logs.py
# Step 2 β Ask a question (local keyword analysis, no GPU needed)
python3 rag_query.py --query "Why did the payments fail?"
# Step 3 β With a live vLLM endpoint (RunPod)
python3 rag_query.py --query "Why did the payments fail?" \
--endpoint https://YOUR_POD_ID-8000.proxy.runpod.net/v1 \
--model ShivanshiNigam/loglens-mini-deepseek
3. Retrain on your own log data
# Put your .log files in logs/
python3 train_mini_deepseek.py --epochs 5 --device cuda
# Save and upload
python3 save_and_upload.py --repo-id YOUR_USERNAME/loglens-mini-deepseek
Architecture
Input log tokens
β
Embedding (vocab=50257, dim=256)
β
4Γ DeepSeekDecoderLayer:
βββ RMSNorm
βββ LogWindowAttention (window=128, RoPE)
βββ RMSNorm
βββ SwiGLU FFN (dim=256 β 1024 β 256)
β
RMSNorm
β
LM Head (tied to embedding weights)
β
Logits (vocab=50257)
Memory: 61 MB Β· Parameters: 16M Β· Training loss: 10.8 β 2.9 (2 epochs, CPU)
Full RAG System Flow
Your Log Files (any size)
β
ingest_logs.py β ChromaDB vector store
β (semantic search)
User Query β rag_query.py β vLLM endpoint β Answer
Deploy on RunPod
See the full guide: docs/runpod_deployment.md
One-line vLLM command:
--model ShivanshiNigam/loglens-mini-deepseek --port 8000 --trust-remote-code
Cheapest GPU: RTX 4000 Ada @ $0.28/hr (20 GB VRAM β 20Γ more than needed)
- Downloads last month
- 12