---
title: RustVital-AMD
emoji: π₯
colorFrom: blue
colorTo: purple
sdk: docker
pinned: true
---
# π₯ RustVitalβAMD β ZeroβTrust Medical AI Triage Gateway
**Pure Rust β’ AMD MI300X GPU β’ Real Web3 Audit Trail**
RustVitalβAMD is a productionβgrade, zeroβtrust medical triage agent that **never exposes raw patient data to the AI model**. It accepts clinical notes, strips personally identifiable information (PII) before the GPU ever sees them, runs inference on a real **Qwen2.5β7B** model backed by an **AMD MI300X** GPU, and rehydrates the response so the clinician sees a perfectly normal clinical report. Every triage is cryptographically proven and permanently anchored onβchain via **Filecoin CID** and **Base Sepolia**.
π **Live Demo:** [Launch on Hugging Face Spaces](https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/rustvital-amd)
---
## 𧬠Key Features
- **π‘οΈ ZeroβTrust PII Shield** β Deterministic, preβGPU redaction of names, ages, SSN, MRN, insurance IDs, and more.
- **π§ Real AMD MI300X Inference** β Calls a live vLLM endpoint running Qwen2.5β7B on ROCm, with graceful CPU fallback.
- **π‘ Streaming Agent Observability** β WebSocket + SSE endpoint show every pipeline step in real time.
- **π PubMed Enrichment** β Queries NCBI Eβutilities for relevant biomedical literature after each triage.
- **π©» DICOM Surrogate Redaction** β Demonstrates multiβmodal PII removal from medical imaging headers and burnedβin text.
- **π Cryptographic Audit** β A ZKβsimulated proof of correct redaction is generated and verified on every request.
- **βοΈ Blockchain Immutability** β Each triage produces a Filecoin CID and an onβchain transaction on Base Sepolia (via alloyβrs).
- **π₯ Consortium Attestations** β Simulates three independent hospital attestations, creating a decentralised trust model.
- **βοΈ Federated FineβTuning Trigger** β Exposes an endpoint that launches a LoRA fineβtuning job on MI300X, using only redacted data.
- **π¨ Professional Dark UI** β Built with HTMX + Alpine.js + Tailwind CSS, served from Axum with no JavaScript build step.
---
## π How It Works
```
βββββββββββββββββ βββββββββββββββββββββββ βββββββββββββββββββββββββ
β Clinician β β RustVital-AMD β β AMD MI300X GPU β
β (Browser) β β (Axum Server) β β (vLLM + ROCm HIP) β
βββββββββ¬ββββββββ ββββββββββββ¬βββββββββββ βββββββββββββ¬ββββββββββββ
β Submit consent form β β
ββββββββββββββββββββββββββΊβ β
β β (1) PII Shield β
β β Redact PHI from note β
β β Generate ZKβstyle proof β
β β β
β β (2) Send redacted prompt β
β βββββββββββββββββββββββββββββββΊβ
β β β Run Qwen2.5β7B
β ββββββββββββββββββββββββββββββββ
β β (3) Clinical synthesis β
β β β
β β (4) Enrich with PubMed β
β β (5) Compute CID + anchor β
β β on Base Sepolia β
β β (6) Simulate consortium β
β β attestations β
β β β
βββββββββββββββββββββββββββ (7) Return rehydrated resultβ
β View real report β β
β (PII never revealed) β β
```
---
## π οΈ Technology Stack
| Layer | Technology |
|---------------------|-------------------------------------|
| **Language** | Rust (edition 2021) |
| **Web Framework** | Axum + Tower + Tokio |
| **Inference** | vLLM (OpenAIβcompatible) on AMD ROCm|
| **LLM** | Qwen2.5β7BβInstruct |
| **PII Shield** | Custom regex engine (deterministic) |
| **Crypto** | SHAβ256, ECDSA (k256), ZKβsimulated |
| **Blockchain** | alloyβrs β Base Sepolia testnet |
| **CID** | cid + sha2 β Filecoinβcompatible |
| **Medical APIs** | NCBI Eβutilities (PubMed) |
| **UI** | HTMX + Alpine.js + Tailwind CSS |
| **Observability** | WebSocket + ServerβSent Events |
| **Deployment** | Docker, Hugging Face Spaces |
---
## π Use Cases
### π Emergency Room Triage
A clinician pastes a raw ambulance report. The system redacts patient identity, runs the case through the MI300X, and instantly returns a structured clinical assessment with PubMed references β all while **maintaining HIPAA compliance** and **creating an immutable legal audit trail**.
### π₯ MultiβHospital Consortium
Three independent hospitals can run RustVitalβAMD nodes. After each triage, they attest to the correctness of the redaction proof. The onβchain record shows consensus, giving regulators and insurers **cryptographic proof that PII was never exposed**.
### π Continuous Federated Learning
Hospitals trigger fineβtuning jobs on their own AMD GPUs using only **deβidentified logs**. The model improves without any raw patient data leaving the gateway. The system logs every training event, creating a **fully auditable model lineage** onβchain.
---
## βοΈ Quick Start (Local Development)
### Prerequisites
- Rust 1.90+ (stableβtoolchain)
- An AMD MI300X instance running vLLM (or the [Hugging Face Space](https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/rustvital-amd) for immediate testing)
- Base Sepolia wallet (optional, for onβchain transactions)
### 1. Clone the repository
```bash
git clone https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/rustvital-amd
cd rustvital-amd
```
### 2. Configure environment
Create a `.env` file:
```env
VLLM_URL=http://129.212.188.154:8000/v1/chat/completions
PUBMED_EMAIL=you@example.com
PRIVATE_KEY=your_base_sepolia_private_key_hex
PORT=7860
```
### 3. Build & Run
```bash
cargo build --release
cargo run
```
The server will start on `http://localhost:7860`. Open the URL in your browser.
### 4. Connect to real GPU
If you have a droplet running vLLM, expose it with Cloudflare Tunnel:
```bash
cloudflared tunnel --url http://localhost:8000
```
Then update `VLLM_URL` with the generated `https://*.trycloudflare.com/v1/chat/completions` address.
---
## π‘ API Endpoints
| Method | Path | Description |
|--------|---------------------------|-------------|
| `GET` | `/` | Serves the interactive UI |
| `GET` | `/health` | Liveness check (`healthy`) |
| `GET` | `/status` | GPU status, model info, triage count |
| `POST` | `/triage/html` | Formβencoded triage request (returns HTML) |
| `POST` | `/triage` | JSON triage request (`TriageRequest` β `TriageResponse`) |
| `GET` | `/triage/stream` | SSE stream of agent events (Shield β Triage β Audit) |
| `GET` | `/agents/status` | WebSocket for realβtime agent states |
| `POST` | `/dicom/redact` | Upload a DICOM file for metadata / burnedβin text redaction |
| `GET` | `/medical/enrich` | Fetch PubMed evidence for a given clinical note |
| `POST` | `/trigger-federated-tune` | Launch a simulated federated LoRA fineβtuning job |
| `GET` | `/federation/round` | Show current federated learning round and nodes |
| `GET` | `/dashboard` | HTML fragment of recent triage history |
| `GET` | `/history` | JSON list of all triage records |
---
## βοΈ Deployment
The project is containerised with Docker. A preβbuilt image is automatically deployed to Hugging Face Spaces on every push.
### Dockerfile (production)
```dockerfile
FROM rust:1.95-slim-bookworm AS builder
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY Cargo.toml Cargo.lock* ./
COPY src src
COPY static static
COPY contracts contracts
RUN cargo build --release
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/rustvital-amd /usr/local/bin/rustvital-amd
EXPOSE 7860
ENV PORT=7860
CMD ["rustvital-amd"]
```
### Hugging Face Space Secrets
Set these in **Settings β Secrets**:
| Key | Value |
|-----|-------|
| `VLLM_URL` | `https://*.trycloudflare.com/v1/chat/completions` |
| `PUBMED_EMAIL` | Your email for NCBI rate limits |
| `PRIVATE_KEY` | Base Sepolia hex private key (without `0x`) |
---
## π Hackathon Tracks
- **AI Agents & Agentic Workflows** (main)
- **FineβTuning on AMD GPUs** (LoRA on MI300X)
- **Hugging Face Challenge** (Space deployed)
- **Qwen Challenge** (Qwen2.5β7B via vLLM)
- **Build in Public** (updates on [X/Twitter](https://x.com/MoonloungeBrain))
---
## π€ Contributing
This project was built solo for the AMD Developer Hackathon (May 2026). Contributions are welcome via pull requests. Please discuss major changes first in the [Hugging Face Community tab](https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/rustvital-amd/discussions).
---
## π License
MIT License β see the `LICENSE` file (if present) or the [Hugging Face Space page](https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/rustvital-amd) for details.
---
**Built with β€οΈ, Rust, and AMD ROCm for the AMD Developer Hackathon 2026.**
```