PublicRisk.ai

AI & Document Processing

State-of-the-art AI models, RAG, and STORM document generation for intelligent risk analysis

Overview

PublicRisk.ai provides access to leading large language models alongside custom PEFT fine-tuned models optimized via the DSPy framework specifically for insurance and risk management tasks.

Latest Updates: DSPy-optimized AI with 1000+ expert-labeled training examples achieving ~92% accuracy (up from ~75%)


AI Model Selection

Supported Providers

OpenRouter Integration

  • Multiple model access (GPT-5, Claude, Mistral)
  • Zero Data Retention (ZDR) compliance
  • Automatic fallback system
  • Temperature control (0.0 - 2.0)

Available Models:

  • moonshot-kimi-k2-thinking-general (recommended)
  • anthropic/claude-3.5-sonnet
  • openai/gpt-4-turbo

Zero Data Retention (ZDR) Policy

PublicRisk.ai only uses Zero Data Retention (ZDR) AI model providers. ZDR providers will not store your data for any period of time.

We only route to AI Model endpoints that have a Zero Data Retention policy. Note that a provider's general policy may differ from this specific policy for a given endpoint.

OpenRouter's ZDR Commitment:

  • Tracks each provider's specific policy for every endpoint
  • Works with providers to keep these policies up to date
  • In some cases, creates special agreements with providers to ensure data retention or training policies that are more privacy-focused than their default policies

Your data security is our top priority.

VirtualKimi for Risk Analysis

  • Specialized in complex reasoning
  • Extended context windows (128K tokens)
  • Cost-effective for bulk analysis

Best For:

  • Multi-document comparison
  • Long-form risk reports
  • Historical trend analysis

DeepSeek Open Source

  • Full data control
  • No external API dependencies
  • Self-hosted option available

Use Cases:

  • Sensitive document processing
  • Air-gapped environments
  • Compliance requirements

Ollama Local Deployment

  • Completely offline operation
  • GPU acceleration support
  • Custom model fine-tuning

Configuration:

# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh

# Pull models
ollama pull llama3.1:8b
ollama pull nomic-embed-text

Retrieval Augmented Generation (RAG)

How It Works

PublicRisk.ai's RAG system accesses an extensive document library to provide cited, highly accurate answers grounded in your unique knowledge base.

Storage Options

Primary RAG Store (Local Development)

  • Purpose: Testing and development
  • Technology: ChromaDB vector database
  • Embedding Model: nomic-embed-text (768 dimensions, FREE)
  • Chunk Size: 1000 tokens with 200 token overlap

Secondary RAG Store (Enterprise)

Coming Soon: Available with first paid subscription

Two Modal-based storage options:

  1. Private Modal Client - Isolated endpoint for proprietary documents

    • Complete data isolation
    • Your isolated Modal endpoint
    • Never shared with other clients
  2. Public Modal Client - Shared storage for public documents

    • Enhances PublicRisk.ai for all users
    • Shared backend infrastructure
    • Publicly contributed knowledge

Benefits:

  • ✅ Zero IT involvement - we deploy and manage
  • ✅ Enterprise security (HTTPS, API keys, IP whitelist)
  • ✅ 5-second updates without downtime
  • ✅ 99.9% uptime SLA
  • ✅ Auto-scaling infrastructure

DSPy Optimization

What is DSPy?

DSPy is a framework for algorithmic prompt optimization developed at Stanford. Instead of hand-crafting prompts, DSPy uses machine learning to optimize prompts based on training data.

Performance Improvements

MetricBefore DSPyAfter DSPyImprovement
Accuracy~75%~92%+17%
Response Time3-5s2-3s40% faster
Citation QualityGoodExcellentSignificant
Multi-turn ConsistencyFairExcellentMajor

Training Dataset

  • 1000+ expert-labeled examples
  • Domain-specific risk analysis patterns
  • Multi-turn conversation optimization
  • Insurance and regulatory contexts

Example Training Pair:

{
  "question": "What are the flood zone requirements for a property at 34.0522, -118.2437?",
  "answer": "Based on FEMA NFHL data, this property is in Zone AE...",
  "citations": ["FEMA NFHL 2024", "44 CFR 59.1"]
}

PEFT Domain Adapters

Specialized Models

Fine-tuned LoRA adapters for 35 specialized domains covering public sector, insurance, education, and enterprise risk management:

Public Sector & Government (11 domains):

  • public_education - K-12 and public education systems
  • public_financing - Municipal bonds, tax revenue, public budgets
  • municipal_codes - Local ordinances and regulations
  • municipal - General municipal operations
  • law_enforcement - Police, sheriff, corrections
  • emergency_management - Disaster response and preparedness
  • infrastructure - Roads, bridges, water systems
  • utilities - Power, water, gas distribution
  • CA_government_code - California Government Code compliance
  • CA_education_code - California Education Code compliance
  • procurement - Public purchasing and contracting

Insurance & Risk Management (8 domains):

  • insurance - General insurance operations
  • insurance_exposures - Coverage gaps and exposures
  • liability - General and professional liability
  • property - Property damage and coverage
  • workers-comp - Workers' compensation claims
  • regulatory - Insurance regulatory compliance
  • school-risk - K-12 school safety and risk
  • risk-analysis - Comprehensive risk assessment

Enterprise & Industry (10 domains):

  • cybersecurity - Data protection and cyber threats
  • healthcare - Medical facilities and HIPAA compliance
  • financial - Financial services and fraud prevention
  • legal - Contract risk and litigation
  • hr-employment - Employment law and workplace safety
  • operational - Business continuity and operations
  • supply_chain - Vendor and logistics risk
  • technology - IT infrastructure and SaaS
  • reputational - Brand and reputation management
  • geopolitical - International and political risk

Environmental & Research (6 domains):

  • environmental - Environmental compliance and hazards
  • climate - Climate change impacts
  • natural_disasters - Earthquake, flood, hurricane analysis
  • nepa - National Environmental Policy Act compliance
  • academic_research - Research risk and compliance
  • education - Higher education and universities

Production Ready: All 35 adapters are trained on 1,500-2,000 domain-specific examples and deployed to Modal Cloud with GPU inference (A100/A10G).

How to Use Adapters

  1. Navigate to Query Explorer
  2. Select Domain Adapter from dropdown
  3. Choose your industry (e.g., Healthcare)
  4. Ask domain-specific questions

Example Query:

"What HIPAA violations could occur if we store patient 
documents in Google Drive without encryption?"

Adapter Response:

Based on HIPAA Security Rule §164.312(a)(2)(iv):

1. Violation: Unencrypted ePHI at rest (§164.312(a)(2)(iv))
   Risk Level: HIGH
   Penalty Range: $50,000 - $1.5M per violation
   
2. Violation: Lack of access controls (§164.312(a)(1))
   ...

STORM Document Generation

What is STORM?

STORM (Synthesis of Topic Outline and Research Methodology) is Stanford's proven system for automated document creation with research backing.

Production Ready: Used for risk assessment reports, compliance summaries, policy analysis, and regulatory updates

Document Types

1. Risk Assessment Reports

  • Property-level risk analysis
  • Multi-hazard exposure summaries
  • Loss estimation tables
  • Mitigation recommendations

2. Compliance Summaries

  • Regulatory requirement checklists
  • Gap analysis reports
  • Remediation timelines
  • Cost estimates

3. Policy Analysis

  • Coverage gap identification
  • Policy comparison matrices
  • Premium optimization suggestions
  • Renewal recommendations

4. Regulatory Updates

  • New regulation summaries
  • Impact assessments
  • Action item lists
  • Deadline tracking

How to Generate Documents

Step 1: Select Document Type

// Navigate to STORM Generator
// Select: "Risk Assessment Report"

Step 2: Provide Context

Property Address: 123 Main St, Los Angeles, CA
Property Value: $850,000
Year Built: 1995
Hazards: Flood, Earthquake, Wildfire

Step 3: Generate & Review

  • STORM creates outline (30 seconds)
  • Researches each section (2-3 minutes)
  • Generates final document (1 minute)
  • Total Time: ~4 minutes

Step 4: Export

  • PDF with citations
  • DOCX for editing
  • Markdown for web

Example Output

# Property Risk Assessment Report
**Property:** 123 Main St, Los Angeles, CA 90012
**Assessed:** December 4, 2025
**Prepared by:** PublicRisk.ai STORM Generator

## Executive Summary
This property faces HIGH risk exposure from three natural hazards:
- Flood (Zone AE): 1% annual chance
- Earthquake (PGA 0.35g): Moderate-High shaking
- Wildfire (VHFHSZ): Very High Fire Hazard Severity

**Total Expected Annual Loss:** $12,450 (1.46% of property value)

## Detailed Analysis

### Flood Risk
Based on FEMA NFHL data (2024), this property is located in...
[Citations: FEMA NFHL 2024, 44 CFR 59.1]

### Earthquake Risk
USGS National Seismic Hazard Map indicates Peak Ground...
[Citations: USGS NSHM 2023, ASCE 7-22]

...

HITL (Human-in-the-Loop) Workflow

Training Pipeline

PublicRisk.ai learns from your feedback to improve AI responses over time.

Review Interface

Features:

  • Side-by-side comparison (AI vs. Human)
  • Approval/rejection workflow
  • Detailed feedback forms
  • Batch processing

Roles:

  • Editors: Can review and approve documents
  • Admins: Can train adapters on approved documents
  • SuperAdmins: Full system access

API Endpoints

DSPy Optimized Service

https://publicrisk--dspy-optimized-service-fastapi-app.modal.run

Endpoints:

  • POST /query - Optimized RAG query
  • GET /health - Service health check
  • POST /batch-query - Bulk queries

PEFT Adapters Service

https://publicrisk--publicrisk-peft-adapters-fastapi-app.modal.run

Endpoints:

  • POST /adapter/{domain} - Use domain adapter
  • GET /adapters - List available adapters
  • POST /train - Train new adapter (Admin only)

Best Practices

Query Optimization

Good Query:

"What flood mitigation measures are required for a commercial 
building in FEMA Zone AE with a basement?"

Poor Query:

"Tell me about floods"

RAG Document Organization

Naming Convention:

{category}/{document-type}_{date}_{version}.pdf

Examples:
- policies/commercial_property_2024_v3.pdf
- regulations/nfip_guidelines_2024_final.pdf
- claims/hurricane_harvey_2017_summary.pdf

Adapter Selection

Use CaseRecommended Adapter
Hospital risk assessmentHealthcare
Bank fraud analysisFinancial
Contract reviewLegal
Factory safety auditManufacturing

Troubleshooting

Common Issues

Issue: "Model timeout after 30s"

  • Cause: Modal cold start (service sleeping after inactivity)
  • Solution: Wait 30-60s and retry. Subsequent requests will be fast.

Issue: "No relevant documents found"

  • Cause: Empty RAG store or query too specific
  • Solution: Upload relevant documents first, or broaden query.

Issue: "Adapter not available"

  • Cause: Adapter training incomplete or not trained yet
  • Solution: Contact admin to train domain adapter.

Next Steps

On this page