By Muhammad Umar. This is the engineering summary of an open reference architecture, a sovereign AI architecture for distribution loss and theft reduction, built so the sovereign AI that runs it stays on hardware the operator owns. The paper, its object model as JSON and the model register are free to reuse under CC BY 4.0: https://codeatoms.ai/distribution-loss-theft-pakistan/. DOI 10.5281/zenodo.24048559. The operator is described by class, never by name.
An electricity distribution company in Pakistan serves several million customers through hundreds of grid stations and thousands of feeders. When a transformer's monthly energy balance crosses its threshold, the subdivision engineer needs one answer: which cause, on which connections, and is it worth an inspection visit. The facts exist, but apart, across seven systems: billing, meter data, energy audit, the network map, outages and complaints, the field inspection app and the theft case register. The meters already report tampering and the registers already record cases, but no system can answer which transformer, which cause, which case in one question. This is a join failure, not a sensing failure.
1. Read everything, write one thing
The design is a projection over the systems of record, never a migration. All seven are read only and stay exactly what they are. The single write path out is the approved correction: reading and multiplier corrections land in the customer information and billing system, approved theft cases land in the theft case register, each through the adapter tier and traceable to the approval that authorized it. No inference call leaves the country and no third party model service is called, because the operator's own constraint is that customer and meter data never leave its network.
2. One adapter family, three transports
Seven sources enter through one integration adapter family, and the transport is split on purpose. The meter data management system is read through a Kafka subscription, because interval load and tamper events lose their value if they wait for a batch. Billing, energy audit, geographic and outage records arrive as scheduled batch extracts, because they change on their own cycles. The field app and the theft case register are reached through mapped connectors built for their interfaces, because no packaged connector set for a distribution operator's records exists. The design chose against live event streams on all seven systems: streaming billing and network records adds connector risk without improving a monthly transformer balance.
Every adapter maps the source's schema onto the object model, normalizes units and timestamps, and carries the meter multiplier through untouched, because a wrong multiplier is itself one of the ranked causes. Every extract is minimized to the agreed fields, stamped with the system it came from, and written idempotently, so a redelivered event collapses instead of duplicating. Every feed carries a freshness window with stale and flatline detection, and a stale feed holds its drafts.
Apache Kafka carries the meter stream on topics partitioned by meter number, so ordering holds per meter, at least once, buffered through the burst a head end produces after an outage and replicated inside the data center. Chrony keeps clocks aligned so an event joins the right billing period, and weights and images enter only as versioned artifacts through a Harbor registry. Nothing is installed in the field: cameras and edge nodes were rejected, because the sensing already exists at the meters and every added device widens the maintenance and export surface.
3. Fifteen objects, one walk
The object model holds fifteen objects with fourteen typed links on Hyper Ontology: grid station, feeder, transformer, service connection, meter, interval load, reading, billing account, tariff, inspection, tamper event, theft case, recovery, agent draft and approval. Each is anchored in exactly one system of record: the transformer's energy balance in the energy audit records, the meter's seal state in the meter data management system, the theft case in the theft case register. One traversal answers the question field teams ask: every transformer on a feeder whose monthly loss crossed its threshold, the tamper events its meters raised in the same window, what was billed to the connections it serves, and which inspections already visited. That walk crosses four systems of record. A document store answers it only if the words share one document, and they never do.
The human loop lives inside the model. An agent draft moves through drafted, approved, amended, rejected and expired; an approval carries the approver role, the officer grade, the timestamp, the artifact hash and a written reason, so it is tied to the exact draft text it settled.
4. One node, sized from the weights up
The frontier tier serves GLM 5.3, 753 billion parameters, at FP8: 753 GB of weights, 904 GB with the 1.2 planning factor for KV cache and activations. One node of eight 141 GB HBM GPUs gives 1,128 GB, which holds them. BF16 would be roughly 1.5 TB and a second node, doubling export licence exposure for an accuracy gain the ranking and drafting tasks have not been shown to need, which is why FP8 on one node was chosen. The node is a 4A090 class item for a D:3 and D:4 destination, so the export licence determination precedes any card commitment, with a non US accelerator class held open.
The second tier is one dual socket server with a 48 GB PCIe card. BGE-M3 (about 1.1 GB) serves cited retrieval over tariff codes, meter numbers, PPC sections and inspection findings; Chronos-2 (about 0.48 GB) forecasts each transformer's energy balance, so the residual is the anomaly signal. Both fit on the one card with two orders of magnitude of headroom. There is no edge tier and no hosted tier: both servers sit in an in country sovereign data center or colocation on the operator's own hardware.
The latency budget buys interaction, not reaction, since no control loop is touched: tamper events are drafted as case files within a working day, the loss boards refresh on the cadence of their feeds, and the command center answers with citations at reading pace. If a source link fails, Kafka buffers the meter stream and the batch extracts wait for their next schedule.
5. Better every cycle, without training
Loss, tamper and billing agents draft; people decide, by name. The subdivision engineer approves the ranked causes and the inspection visits, the inspection officer approves the case file, the revenue officer approves the correction, and the Grade 17 officer signs the complaint. Known answer probes in the normal queue police the approvers. Every confirmed cause and closed case becomes the record the next ranking reads. The design chose that over fine tuning the work surface model or training a theft classifier on historical labels, because the requirement rules out training on the fly and past labels are biased by where inspections happened to be sent. The licences (GLM-5.3 bespoke, MIT for BGE-M3, Apache 2.0 for Chronos-2) let the operator hold its own copies.
Appendix A prices owning the node and the inference server at about 641,000 US dollars over three years (615,000 to 667,000: servers, support and power at the regulator's uniform commercial tariff). Renting the same cards on the deepest three year commitment in AWS Asia Pacific (Mumbai) is about 773,000, so ownership costs about five sixths of it; on demand it is about 2.05 million, against which ownership costs a little under a third. Renting is a price reference only, because AWS lists no Pakistan region and every rented option would carry customer and meter data across the border.
The rollout is two phases and 16 scope items (15, then 1), closed by gates, never dates, and traced against 29 requirements. Phase one is one circle of feeders for one quarter against a measured baseline, with control feeders left unchanged so the comparison stays honest; its gate is the billing agent drafting corrections that land back through the recorded approval path. Phase two is the circle extension gate, read on four numbers: transformer level loss, inspections per confirmed theft, case files accepted at the Grade 17 gate, and days from tamper event to inspection.
Made with CodeNinja Praxis, the CodeNinja Atoms platform for designing physical AI systems. The object model imports into Hyper Ontology. Paper, ontology and register: https://codeatoms.ai/distribution-loss-theft-pakistan/
One of the CodeNinja Atoms worked examples of a self-improving AI system: systems of record read and never written, a governed ontology joined by typed links, open weights on hardware the operator owns, and memory that compounds from every confirmed outcome, the shape every physical AI design in the series is published in. More on self-improving systems and how they improve without training.
Top comments (0)