cs.CRNov 27, 2026

Exact Embedding Verification on an Edge NPU: Measurements and Deployment Constraints

Authors: Georgios Feretzakis, Alexandros Papaspyridis

Organizations: securagen.ai Athens, Greece

Abstract

Offline retrieval-augmented generation (RAG) on edge devices receives knowledge as signed packs of text and precomputed embedding vectors. Prior work showed that a signature does not bind the vectors to the text, that any verifier which accepts recomputed vectors within a cosine tolerance concedes a predictable share of queries, and that on a Raspberry Pi 5 the recomputation needed for exact checks costs a concurrently running language model 23-31% of its decoding speed on the CPU. Here we ask whether a neural processing unit (NPU) makes exact verification practical. On a Raspberry Pi 5 with a Hailo-8L accelerator, verifying 8 text-vector pairs per second costs the language model 1.3% of its decoding speed instead of 23-31%, and re-embedding a 1,745-window corpus takes 3.4 s instead of 72.9 s in FP32 on the CPU. The NPU's INT8 embeddings deviate from floating point (median cosine 0.917), so a tolerance set at the empirical 0.1% quantile of honest NPU-FP32 cosine similarities (0.784, about 38 degrees) would let an attacker who controls the vectors displace the correct document for essentially all evaluated queries; with that tolerance applied as an angular budget in a separate BGE-M3 experiment, an end-to-end attack lowers correct answers from 0.75 to 0.35. The same chip, however, returns bit-identical embeddings across repetitions, batch sizes and processes, which makes exact comparison against a reference generated on the same tested device and configuration possible. We also describe how to deploy exact verification: the device recomputes every chunk, retrieves only with its own vectors and, where the reference comes from a computation shown to reproduce its output, compares shipped reference vectors bit for bit; a mismatch is treated as an integrity event to be investigated rather than resolved by a tolerance; and a signed manifest binds every element that determines the bits.

Figures & tables

Explore similar work

Nov 4, 2026

Signed but Steerable: Measuring and Closing the Text-Vector Integrity Gap in Offline Retrieval-Augmented Generation

Offline retrieval-augmented generation (RAG) on edge devices is updated through signed knowledge packs that carry text and precomputed embedding vectors. A signature proves who published a pack, not that its vectors encode its text. We study this text-vector integrity gap. A verifier that recomputes vectors and accepts them within a cosine tolerance concedes a predictable share of queries to an attacker who controls the vectors: the hijack rate equals the distribution of angular retrieval margins at the tolerance (the margin law). Margins are small in five corpora and two embedding models, so an idealised tolerance at the level of floating-point noise leaves up to 5.5% of queries exposed (at most 1.2% in any corpus once exact duplicate documents are excluded), and a threshold calibrated from our CPU INT8-FP32 comparison of a small embedding model (at the empirical 0.1% quantile of honest cosines) leaves 98-100% exposed; on a Raspberry Pi 5 running a local language model, such an attack lowers correct answers from 0.75 to 0.39. Integrity audits of compressed vector stores fare no better: on a FAISS product-quantisation index over 57,638 documents, tampered vectors that all pass the audit put the attacker's document first for 25% of targets. Verifying quantisation codes instead, with ambiguity decided by the verifier, a calibrated guard band and canonicalisation, accepted every honest vector in our samples on three platforms and left the publisher no choice. We also show that common floating-point and dynamic-INT8 inference pipelines are not bit-reproducible across batch sizes or architectures, and report pre-registered negative results on abstention, context pruning and semantic screening. We release code and data.
Jun 9, 2026

Energy-Efficient On-Device RAG on a Mobile NPU: System Design and Benchmark on Snapdragon X Elite

Retrieval-Augmented Generation (RAG) pipelines are compute-intensive, combining embedding, retrieval, reranking, and large language model (LLM) generation. Running them entirely on-device benefits privacy, latency, and offline use, but the energy cost of CPU inference is a major barrier. We present what is, to our knowledge, the first end-to-end RAG pipeline that runs all neural stages -- embedding, reranking, and LLM generation -- on the Qualcomm Hexagon NPU of the Snapdragon X Elite. Profiling on a Dell XPS 13 laptop, we compare NPU-accelerated RAG against CPU and OpenCL/Adreno GPU baselines on indexing and query workloads. On indexing, the NPU achieves 9.1x higher embedding throughput and 12.3x less system energy. On a 120-query Wikipedia-passage benchmark, it delivers 18.1x faster LLM prefilling, 4.0x lower end-to-end query latency, and 4.0x less system energy than the CPU baseline; the same workload on the integrated GPU is 1.7x slower than CPU and uses 6.5x more energy than the NPU. A GPT-4.1 LLM-as-judge evaluation finds NPU answer quality on par with CPU and GPU within evaluator noise (mean 9.32 vs. 8.95 vs. 9.03 on a 1-10 rubric), with 86.7% of queries scoring identically across all three backends. On the Snapdragon X Elite / Hexagon class of laptop SoC, the NPU thus enables practical, energy-efficient on-device RAG without quality regression -- a sustainable path toward green edge intelligence that we expect to generalize to comparable mobile NPUs (Apple Neural Engine, Intel NPU, MediaTek APU) as their software stacks mature.
Mar 4, 2026

Fast and Faithful: Real-Time Verification for Long-Document Retrieval-Augmented Generation Systems

Retrieval-augmented generation (RAG) is increasingly deployed in enterprise search and document-centric assistants, where responses must be grounded in long and complex source materials. In practice, verifying that generated answers faithfully reflect retrieved documents is difficult: large language models can check long contexts but are too slow and costly for interactive services, while lightweight classifiers operate within strict context limits and frequently miss evidence outside truncated passages. We present the design of a real-time verification component integrated into a production RAG pipeline that enables full-document grounding under latency constraints. The system processes documents up to 32K tokens and employs adaptive inference strategies to balance response time and verification coverage across workloads. We describe the architectural decisions, operational trade-offs, and evaluation methodology used to deploy the verifier, and show that full-context verification substantially improves detection of unsupported responses compared with truncated validation. Our experience highlights when long-context verification is necessary, why chunk-based checking often fails in real documents, and how latency budgets shape model design. These findings provide practical guidance for practitioners building reliable large-scale retrieval-augmented applications. (Model, benchmark, and code: https://huggingface.co/llm-semantic-router)