2 Downloads Updated 1 month ago
ollama run dhairyapandya/pathos
Updated 1 month ago
1 month ago
d2984b43c550 · 5.7GB ·
Offline AI diagnostic assistant that runs on any laptop via Ollama. No GPU required.
PathOS is a distilled Gemma 4 model fine-tuned for H&E stained histopathology analysis. It produces definitive, structured diagnoses with <answer> tags — no hedging, no “cannot determine”.
# Install Ollama (if not installed)
# Windows: winget install Ollama.Ollama
# macOS: brew install ollama
# Linux: curl -fsSL https://ollama.com/install.sh | sh
# Run PathOS (default Q8_0, ~3GB) - downloads automatically on first run
ollama run dhairyapandya/pathos
# Or run the lighter 4-bit version (~2.5GB) for very constrained hardware
ollama run dhairyapandya/pathos:4b
That’s it. You now have a local AI pathologist.
ollama run dhairyapandya/pathos "What are the features of colorectal adenocarcinoma?"
# Analyze a single slide
ollama run dhairyapandya/pathos "Is malignancy present?" --images slide.png
# Tissue identification
ollama run dhairyapandya/pathos "What tissue type is present?" --images biopsy_patch.jpg
# Check for specific features
ollama run dhairyapandya/pathos "Is nuclear pleomorphism present?" --images tumor_section.png
# Open-ended analysis
ollama run dhairyapandya/pathos "Describe the key histological features." --images tissue.png
# Start interactive mode
ollama run dhairyapandya/pathos
# Then type questions at the prompt:
>>> Is malignancy present? [attach image via drag-drop]
>>> What tissue type is this? [attach another image]
>>> /bye
# Start Ollama server
ollama serve
# Call the API
curl http://localhost:11434/api/generate -d '{
"model": "dhairyapandya/pathos",
"prompt": "Is malignancy present?",
"images": ["<base64_encoded_image>"],
"stream": false
}'
| Type | Example | Response Format |
|---|---|---|
| Yes/No | “Is malignancy present?” | Yes. <answer>yes</answer> Evidence... |
| Tissue ID | “What tissue type is present?” | Features: ... <answer>tissue name</answer> |
| Open-ended | “What is the primary finding?” | Description. <answer>finding</answer> |
Is malignancy present?
What tissue type is present in this histopathology patch?
Is nuclear pleomorphism present?
Are mitotic figures visible?
Is necrosis present?
Are goblet cells visible?
Is lymphocytic infiltrate present?
Is desmoplastic stroma present?
What is the primary clinical finding?
Is carcinoma in situ present?
Are glandular structures regular or irregular?
Is there evidence of invasion beyond the basement membrane?
ollama run dhairyapandya/pathos
# or for the 4-bit version:
ollama run dhairyapandya/pathos:4b
# Download from HuggingFace
wget https://huggingface.co/dhairyapandya/pathos-gemma4-distilled-GGUF/resolve/main/pathos-Q8_0.gguf
wget https://huggingface.co/dhairyapandya/pathos-gemma4-distilled-GGUF/resolve/main/Modelfile
# Create local model with custom system prompt
ollama create pathos -f Modelfile
# Run
ollama run pathos "Is malignancy present?" --images slide.png
# Install llama.cpp
# Windows: winget install llama.cpp
# macOS: brew install llama.cpp
# Run with web UI
llama-server -hf dhairyapandya/pathos-gemma4-distilled-GGUF:Q8_0
# Or direct CLI
llama-cli -hf dhairyapandya/pathos-gemma4-distilled-GGUF:Q8_0
docker model run hf.co/dhairyapandya/pathos-gemma4-distilled-GGUF:Q8_0
| Component | Minimum | Recommended |
|---|---|---|
| RAM | 4 GB (for 4b model) | 8 GB+ (for Q8 model) |
| GPU | Not required | Any (speeds up inference) |
| Disk | 3 GB free (for 4b model) | 5 GB+ free |
| OS | Windows 10+, macOS 12+, Linux, Raspberry Pi OS | Any |
Because of the extreme efficiency of the Gemma 4 E2B architecture combined with 4-bit quantization, the 4b model is specifically designed for Edge AI deployment.
You can run PathOS as a local, offline AI pathologist on resource-constrained devices like the Raspberry Pi 5 (8GB) or Jetson Nano.
Performance estimates (No GPU, CPU only):
| Hardware | Model Version | Speed |
|---|---|---|
| Modern laptop (16GB RAM) | latest (Q8_0) |
~5-8 tokens/sec |
| Desktop with GPU | latest (Q8_0) |
~20-30 tokens/sec |
| Older laptop (8GB RAM) | 4b (Q4_K_M) |
~5-10 tokens/sec |
| Raspberry Pi 5 (8GB) | 4b (Q4_K_M) |
~2-3 tokens/sec |
Note: Running on a Raspberry Pi is slower, but it allows for a completely offline, battery-powered diagnostic assistant in remote or low-resource clinical settings.
PathOS is a Gemma 4 E2B (2.6B params) model with 6 inference-time techniques distilled into the weights:
<answer> tagsgoogle/gemma-4-e2b-it (base)
↓ SFT on 19.5K histopathology examples
↓ GRPO with format/accuracy rewards (150 samples)
↓ LoRA merge + GGUF Q8_0 quantization
= PathOS (~3GB, runs on any laptop)
| Resource | URL |
|---|---|
| Ollama Model | dhairyapandya/pathos |
| GGUF Model (Q8_0) | dhairyapandya/pathos-gemma4-distilled-GGUF |
| GGUF Model (4B) | dhairyapandya/pathos-gemma4-distilled-rl-4B-GGUF |
| LoRA Adapter | dhairyapandya/pathos-gemma4-distilled-rl-histopathology |
| Base Model | google/gemma-4-e2b-it |
PathOS is a research tool for educational and assistive purposes only. It is NOT a certified medical device, it works as an advisory assistance to a certified pathologist, it’s use case is to fasten the process for a professional and not replace them. All outputs must be reviewed by a qualified pathologist before clinical use.
Apache 2.0