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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
-
Tracks: AI Agents & Agentic Workflows | FineβTuning on AMD GPUs | Hugging Face Challenge
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
title: RustVital-AMD
|
| 4 |
emoji: π₯
|
|
|
|
| 8 |
pinned: true
|
| 9 |
---
|
| 10 |
|
| 11 |
+
<div align="center">
|
| 12 |
+
<img src="https://img.shields.io/badge/Rust-1.95-dea584?logo=rust&logoColor=white" alt="Rust"/>
|
| 13 |
+
<img src="https://img.shields.io/badge/AMD-ROCm-ED1C24?logo=amd&logoColor=white" alt="AMD ROCm"/>
|
| 14 |
+
<img src="https://img.shields.io/badge/Model-Qwen2.5_7B-615EFF?logo=huggingface&logoColor=white" alt="Qwen2.5"/>
|
| 15 |
+
<img src="https://img.shields.io/badge/Chain-Base_Sepolia-0052FF?logo=ethereum&logoColor=white" alt="Base Sepolia"/>
|
| 16 |
+
<img src="https://img.shields.io/badge/Audit-Filecoin_CID-0090FF?logo=ipfs&logoColor=white" alt="Filecoin CID"/>
|
| 17 |
+
</div>
|
| 18 |
+
|
| 19 |
+
# π₯ RustVitalβAMD β ZeroβTrust Medical AI Triage Gateway
|
| 20 |
+
|
| 21 |
+
**Pure Rust β’ AMD MI300X GPU β’ Real Web3 Audit Trail**
|
| 22 |
+
|
| 23 |
+
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**.
|
| 24 |
+
|
| 25 |
+
π **Live Demo:** [Launch on Hugging Face Spaces](https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/rustvital-amd)
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## 𧬠Key Features
|
| 30 |
+
|
| 31 |
+
- **π‘οΈ ZeroβTrust PII Shield** β Deterministic, preβGPU redaction of names, ages, SSN, MRN, insurance IDs, and more.
|
| 32 |
+
- **π§ Real AMD MI300X Inference** β Calls a live vLLM endpoint running Qwen2.5β7B on ROCm, with graceful CPU fallback.
|
| 33 |
+
- **π‘ Streaming Agent Observability** β WebSocket + SSE endpoint show every pipeline step in real time.
|
| 34 |
+
- **π PubMed Enrichment** β Queries NCBI Eβutilities for relevant biomedical literature after each triage.
|
| 35 |
+
- **π©» DICOM Surrogate Redaction** β Demonstrates multiβmodal PII removal from medical imaging headers and burnedβin text.
|
| 36 |
+
- **π Cryptographic Audit** β A ZKβsimulated proof of correct redaction is generated and verified on every request.
|
| 37 |
+
- **βοΈ Blockchain Immutability** β Each triage produces a Filecoin CID and an onβchain transaction on Base Sepolia (via alloyβrs).
|
| 38 |
+
- **π₯ Consortium Attestations** β Simulates three independent hospital attestations, creating a decentralised trust model.
|
| 39 |
+
- **βοΈ Federated FineβTuning Trigger** β Exposes an endpoint that launches a LoRA fineβtuning job on MI300X, using only redacted data.
|
| 40 |
+
- **π¨ Professional Dark UI** β Built with HTMX + Alpine.js + Tailwind CSS, served from Axum with no JavaScript build step.
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## π How It Works
|
| 45 |
+
|
| 46 |
+
```
|
| 47 |
+
βββββββββββββββββ βββββββββββββββββββββββ βββββββββββββββββββββββββ
|
| 48 |
+
β Clinician β β RustVital-AMD β β AMD MI300X GPU β
|
| 49 |
+
β (Browser) β β (Axum Server) β β (vLLM + ROCm HIP) β
|
| 50 |
+
βββββββββ¬ββββββββ ββββββββββββ¬βββββββββββ βββββββββββββ¬ββββββββββββ
|
| 51 |
+
β Submit consent form β β
|
| 52 |
+
ββββββββββββββββββββββββββΊβ β
|
| 53 |
+
β β (1) PII Shield β
|
| 54 |
+
β β Redact PHI from note β
|
| 55 |
+
β β Generate ZKβstyle proof β
|
| 56 |
+
β β β
|
| 57 |
+
β β (2) Send redacted prompt β
|
| 58 |
+
β βββββββββββββββββββββββββββββββΊβ
|
| 59 |
+
β β β Run Qwen2.5β7B
|
| 60 |
+
β ββββββββββββββββββββββββββββββββ
|
| 61 |
+
β β (3) Clinical synthesis β
|
| 62 |
+
β β β
|
| 63 |
+
β β (4) Enrich with PubMed β
|
| 64 |
+
β β (5) Compute CID + anchor β
|
| 65 |
+
β β on Base Sepolia β
|
| 66 |
+
β β (6) Simulate consortium β
|
| 67 |
+
β β attestations β
|
| 68 |
+
β β β
|
| 69 |
+
βββββββββββββββββββββββββββ (7) Return rehydrated resultβ
|
| 70 |
+
β View real report β β
|
| 71 |
+
β (PII never revealed) β β
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
## π οΈ Technology Stack
|
| 77 |
+
|
| 78 |
+
| Layer | Technology |
|
| 79 |
+
|---------------------|-------------------------------------|
|
| 80 |
+
| **Language** | Rust (edition 2021) |
|
| 81 |
+
| **Web Framework** | Axum + Tower + Tokio |
|
| 82 |
+
| **Inference** | vLLM (OpenAIβcompatible) on AMD ROCm|
|
| 83 |
+
| **LLM** | Qwen2.5β7BβInstruct |
|
| 84 |
+
| **PII Shield** | Custom regex engine (deterministic) |
|
| 85 |
+
| **Crypto** | SHAβ256, ECDSA (k256), ZKβsimulated |
|
| 86 |
+
| **Blockchain** | alloyβrs β Base Sepolia testnet |
|
| 87 |
+
| **CID** | cid + sha2 β Filecoinβcompatible |
|
| 88 |
+
| **Medical APIs** | NCBI Eβutilities (PubMed) |
|
| 89 |
+
| **UI** | HTMX + Alpine.js + Tailwind CSS |
|
| 90 |
+
| **Observability** | WebSocket + ServerβSent Events |
|
| 91 |
+
| **Deployment** | Docker, Hugging Face Spaces |
|
| 92 |
+
|
| 93 |
+
---
|
| 94 |
+
|
| 95 |
+
## π Use Cases
|
| 96 |
+
|
| 97 |
+
### π Emergency Room Triage
|
| 98 |
+
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**.
|
| 99 |
+
|
| 100 |
+
### π₯ MultiβHospital Consortium
|
| 101 |
+
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**.
|
| 102 |
+
|
| 103 |
+
### π Continuous Federated Learning
|
| 104 |
+
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.
|
| 105 |
+
|
| 106 |
+
---
|
| 107 |
+
|
| 108 |
+
## βοΈ Quick Start (Local Development)
|
| 109 |
+
|
| 110 |
+
### Prerequisites
|
| 111 |
+
- Rust 1.90+ (stableβtoolchain)
|
| 112 |
+
- 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)
|
| 113 |
+
- Base Sepolia wallet (optional, for onβchain transactions)
|
| 114 |
+
|
| 115 |
+
### 1. Clone the repository
|
| 116 |
+
```bash
|
| 117 |
+
git clone https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/rustvital-amd
|
| 118 |
+
cd rustvital-amd
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
### 2. Configure environment
|
| 122 |
+
Create a `.env` file:
|
| 123 |
+
```env
|
| 124 |
+
VLLM_URL=http://129.212.188.154:8000/v1/chat/completions
|
| 125 |
+
PUBMED_EMAIL=you@example.com
|
| 126 |
+
PRIVATE_KEY=your_base_sepolia_private_key_hex
|
| 127 |
+
PORT=7860
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
### 3. Build & Run
|
| 131 |
+
```bash
|
| 132 |
+
cargo build --release
|
| 133 |
+
cargo run
|
| 134 |
+
```
|
| 135 |
+
The server will start on `http://localhost:7860`. Open the URL in your browser.
|
| 136 |
+
|
| 137 |
+
### 4. Connect to real GPU
|
| 138 |
+
If you have a droplet running vLLM, expose it with Cloudflare Tunnel:
|
| 139 |
+
```bash
|
| 140 |
+
cloudflared tunnel --url http://localhost:8000
|
| 141 |
+
```
|
| 142 |
+
Then update `VLLM_URL` with the generated `https://*.trycloudflare.com/v1/chat/completions` address.
|
| 143 |
+
|
| 144 |
+
---
|
| 145 |
+
|
| 146 |
+
## π‘ API Endpoints
|
| 147 |
+
|
| 148 |
+
| Method | Path | Description |
|
| 149 |
+
|--------|---------------------------|-------------|
|
| 150 |
+
| `GET` | `/` | Serves the interactive UI |
|
| 151 |
+
| `GET` | `/health` | Liveness check (`healthy`) |
|
| 152 |
+
| `GET` | `/status` | GPU status, model info, triage count |
|
| 153 |
+
| `POST` | `/triage/html` | Formβencoded triage request (returns HTML) |
|
| 154 |
+
| `POST` | `/triage` | JSON triage request (`TriageRequest` β `TriageResponse`) |
|
| 155 |
+
| `GET` | `/triage/stream` | SSE stream of agent events (Shield β Triage β Audit) |
|
| 156 |
+
| `GET` | `/agents/status` | WebSocket for realβtime agent states |
|
| 157 |
+
| `POST` | `/dicom/redact` | Upload a DICOM file for metadata / burnedβin text redaction |
|
| 158 |
+
| `GET` | `/medical/enrich` | Fetch PubMed evidence for a given clinical note |
|
| 159 |
+
| `POST` | `/trigger-federated-tune` | Launch a simulated federated LoRA fineβtuning job |
|
| 160 |
+
| `GET` | `/federation/round` | Show current federated learning round and nodes |
|
| 161 |
+
| `GET` | `/dashboard` | HTML fragment of recent triage history |
|
| 162 |
+
| `GET` | `/history` | JSON list of all triage records |
|
| 163 |
+
|
| 164 |
+
---
|
| 165 |
+
|
| 166 |
+
## βοΈ Deployment
|
| 167 |
+
|
| 168 |
+
The project is containerised with Docker. A preβbuilt image is automatically deployed to Hugging Face Spaces on every push.
|
| 169 |
+
|
| 170 |
+
### Dockerfile (production)
|
| 171 |
+
```dockerfile
|
| 172 |
+
FROM rust:1.95-slim-bookworm AS builder
|
| 173 |
+
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
|
| 174 |
+
WORKDIR /app
|
| 175 |
+
COPY Cargo.toml Cargo.lock* ./
|
| 176 |
+
COPY src src
|
| 177 |
+
COPY static static
|
| 178 |
+
COPY contracts contracts
|
| 179 |
+
RUN cargo build --release
|
| 180 |
+
|
| 181 |
+
FROM debian:bookworm-slim
|
| 182 |
+
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
| 183 |
+
COPY --from=builder /app/target/release/rustvital-amd /usr/local/bin/rustvital-amd
|
| 184 |
+
EXPOSE 7860
|
| 185 |
+
ENV PORT=7860
|
| 186 |
+
CMD ["rustvital-amd"]
|
| 187 |
+
```
|
| 188 |
+
|
| 189 |
+
### Hugging Face Space Secrets
|
| 190 |
+
Set these in **Settings β Secrets**:
|
| 191 |
+
|
| 192 |
+
| Key | Value |
|
| 193 |
+
|-----|-------|
|
| 194 |
+
| `VLLM_URL` | `https://*.trycloudflare.com/v1/chat/completions` |
|
| 195 |
+
| `PUBMED_EMAIL` | Your email for NCBI rate limits |
|
| 196 |
+
| `PRIVATE_KEY` | Base Sepolia hex private key (without `0x`) |
|
| 197 |
+
|
| 198 |
+
---
|
| 199 |
+
|
| 200 |
+
## π Hackathon Tracks
|
| 201 |
+
|
| 202 |
+
- **AI Agents & Agentic Workflows** (main)
|
| 203 |
+
- **FineβTuning on AMD GPUs** (LoRA on MI300X)
|
| 204 |
+
- **Hugging Face Challenge** (Space deployed)
|
| 205 |
+
- **Qwen Challenge** (Qwen2.5β7B via vLLM)
|
| 206 |
+
- **Build in Public** (updates on [X/Twitter](https://x.com/MoonloungeBrain))
|
| 207 |
+
|
| 208 |
+
---
|
| 209 |
+
|
| 210 |
+
## π€ Contributing
|
| 211 |
+
|
| 212 |
+
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).
|
| 213 |
+
|
| 214 |
+
---
|
| 215 |
|
| 216 |
+
## π License
|
| 217 |
+
|
| 218 |
+
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.
|
| 219 |
+
|
| 220 |
+
---
|
| 221 |
|
| 222 |
+
**Built with β€οΈ, Rust, and AMD ROCm for the AMD Developer Hackathon 2026.**
|
| 223 |
+
```
|
| 224 |
|
| 225 |
+
|
|
|