Skip to main content

One post tagged with "anomaly-detection"

View All Tags

Public Budget AI #9: 23,825 Budget Anomaly Automated Audit Engine

· 8 min read
Jaybee
AI & Robotics Engineer

Public Budget AI #9 Cover

💡 Executive Summary (TL;DR)

  • The Target: Scaling automated fiscal surveillance to all 23,825 anomaly sub-items detected across the 677.4 trillion KRW South Korean national budget, executing standardized decisions via a 5-Option Matrix (full cut, mediation adjustment, 48-hour minister summons, criminal prosecution, legitimate exception pass).
  • Real Engineering Pitfalls Encountered:
    1. sqlite3.OperationalError: database is locked and I/O starvation under rapid multi-record ingestion.
    2. Double-dipping risk cascades where multi-category violations produced aggregate cut recommendations exceeding 100% of the allocated budget.
    3. Markdown table rendering corruption and Jinja2 syntax crashes during minister summons dossier generation due to unescaped pipes and quotes in procurement titles.
  • Clean Production Fixes:
    1. Switched SQLite to WAL mode with PRAGMA synchronous = NORMAL, batching commits into 1,000-case transaction chunks, boosting throughput to 95,000 inferences/sec (total playback in 0.25 seconds).
    2. Built a deterministic PriorityDecisionArbiter with criminal law priority overrides and hard invariant clamping (clamp(cut, 0, budget * 0.70)).
    3. Implemented a robust legal-clause cross-referencing normalizer and safe markdown serializer for the permanent ledger (CUMULATIVE_SURVEILLANCE_AUDIT_LEDGER.md), locking in 121.72 trillion KRW in provisional savings across 23,911 verified cases.