Runtime

Architectural Design and Implementation Strategy for a Client-Side AI "Judgment" Machine

Report summary

As international legislative bodies enact increasingly complex and disparate regulations governing artificial intelligence, the operational and legal risks associated with deploying generative models have escalated significantly. Organizations, independent developers, and corporate compliance office

Status
Research archive item
Category
Runtime
Length
5,455 words
Reading time
25 minutes
Report type
evaluation

Key topics

  • Runtime
  • AI
  • Agentic Web
  • SQL
  • Python
  • Rust
  • Privacy
  • Semantic Systems

Research provenance

Archive status
Research archive item
Content identity
sha256:16b9205c4c7a07c9f5d843f29fc14e9257de88661c0c2dc7503e646141567982

For citation, use the report title and canonical URL. Archival presence does not establish authorship or promote report statements into portfolio evidence.

This page renders the archived Markdown as safe, formatted HTML. It is background research and does not become a portfolio claim without evidence review.

Full report

On this page

Introduction and Architectural Paradigm

As international legislative bodies enact increasingly complex and disparate regulations governing artificial intelligence, the operational and legal risks associated with deploying generative models have escalated significantly. Organizations, independent developers, and corporate compliance officers require immediate, accurate, and privacy-preserving mechanisms to evaluate whether their intended AI implementations comply with a fragmented web of global, federal, and state-level laws. The proposed solution to this escalating challenge is a localized, client-side AI "Judgment" machine. This system acts as an interactive, in-browser evaluation engine that processes a user’s proposed AI architecture or prompt, cross-references it against a comprehensive, vectorized database of global AI legislation, and outputs a structured judgment regarding the prompt’s legality, ethical alignment, and regulatory risk level. The foundational paradigm of this system relies on its execution entirely within the client environment. By running the complete technological stack—encompassing vector embeddings, semantic similarity search, and Large Language Model (LLM) inference—directly within the user’s web browser, the system ensures absolute data sovereignty and privacy. No user input, proprietary architectural data, or sensitive strategic planning is ever transmitted to a remote server. This localized approach eliminates the risk of data interception, minimizes network latency, and removes the recurring infrastructure costs associated with cloud-based API inference. This advanced architecture is made possible by recent, profound advancements in WebAssembly (WASM) and WebGPU. These technologies allow standard web browsers to bypass traditional JavaScript execution limitations and leverage local hardware acceleration to run sophisticated machine learning operations that previously required dedicated, enterprise-grade cloud infrastructure. The Judgment Machine leverages these browser-native technologies to create a localized Retrieval-Augmented Generation (RAG) pipeline, seamlessly integrating a rapid in-memory vector database with an optimized Small Language Model (SLM) to act as the ultimate legal evaluator. The machine determines "right" and "wrong" not through abstract philosophical reasoning, but by strictly mapping the user's intent onto the codified statutes of international regulatory frameworks.

The Ontology of Algorithmic Morality in Global Legislation

The effectiveness and trustworthiness of the Judgment Machine depend entirely on the robustness and structural integrity of its underlying knowledge base. This database contains the raw text, interpretations, and compliance mandates of current global AI legislation. The system evaluates user prompts against these legal frameworks to determine the nature of the proposed AI interaction and assign a corresponding risk level, utilizing the laws themselves as the ultimate arbiter of algorithmic morality.

The European Union AI Act and the Taxonomy of Risk

The European Union AI Act serves as the foundational taxonomy for the Judgment Machine, utilizing a strict, four-tiered risk classification system that defines the boundaries of permissible AI behavior globally. The client-side database must semantically map user prompts against these distinct tiers to provide an accurate judgment. The most critical tier involves Unacceptable Risk, encompassing AI systems that present a clear, inherent threat to human safety, livelihoods, and fundamental rights. The EU AI Act bans these practices outright, representing the definitive legal boundary of "wrong" in the AI space. The database must flag any prompt attempting to build or utilize AI for subliminal manipulation that distorts human behavior beyond conscious awareness, or systems that exploit the vulnerabilities of specific groups based on age, physical or mental disability, or socioeconomic status. The Act explicitly prohibits social scoring systems conducted by public authorities that evaluate individuals based on their social behavior or predicted personality traits, leading to detrimental or discriminatory treatment. Furthermore, the legislation outlaws the untargeted scraping of facial images from the internet or CCTV footage to expand facial recognition databases, the use of emotion recognition software in workplaces and educational institutions, and the deployment of real-time remote biometric identification in publicly accessible spaces for law enforcement. The machine's evaluation logic must recognize that exceptions to these prohibitions are exceedingly narrow, limited strictly to targeted searches for missing persons, victims of human trafficking, or the prevention of imminent terrorist threats. The second tier comprises High-Risk AI systems, which are permitted but subjected to severe, mandatory compliance obligations before they can be introduced to the market. The database includes comprehensive definitions for high-risk use cases, such as AI safety components in critical digital infrastructure, road traffic management, and the supply of water, gas, heating, or electricity. In the educational sector, systems used to determine admission, evaluate learning outcomes to steer the learning process, or monitor student behavior during assessments are flagged as high-risk. Employment applications are heavily scrutinized, capturing CV-sorting software, tools used to allocate tasks based on personality traits, and systems evaluating worker performance. Additionally, AI used to determine eligibility for essential public assistance, evaluate creditworthiness (excluding financial fraud detection), and establish pricing for life and health insurance falls into this category. The Judgment Machine evaluates prompts in this tier by enforcing requirements for adequate risk assessment, high-quality bias-free training datasets, detailed technical documentation, automatic logging for traceability, and mandatory human oversight. The final regulatory tiers involve Transparency Risk and Minimal Risk. Systems presenting a transparency risk, such as conversational chatbots or generative AI models producing synthetic content, are evaluated based on their disclosure mechanisms. The machine must verify that the proposed architecture includes provisions to inform users they are interacting with a machine and ensures that AI-generated content, particularly deepfakes, is clearly identifiable and labeled. Systems presenting minimal risk, such as standard spam filters, operate largely outside this strict regulatory purview, yielding a compliant judgment.

North American Frameworks and Regulatory Discord

The regulatory environment in North America requires the Judgment Machine's database to navigate a complex, often contradictory landscape characterized by shifting federal executive orders, stringent international interoperability efforts, and highly specific, preemptive state legislation. At the federal level in the United States, the system must account for volatile policy shifts. Executive Order 14110, signed in October 2023, initially established sweeping, whole-of-government guidelines for safe, secure, and trustworthy AI development. This order mandated safety testing, rigorous red-teaming, and reporting requirements for technology companies developing "dual-use foundation models" that exceeded specific computational thresholds, such as models trained using more than 10^26 integer operations or 10^23 operations for biological sequence data. It additionally required the creation of watermarking standards for synthetic content and mandated that federal agencies designate Chief AI Officers to oversee algorithmic impact assessments. However, subsequent political transitions in 2025 led to the revocation of EO 14110 and the introduction of EO 14365, representing a stark pivot in federal AI policy. The newer framework seeks to establish a minimally burdensome national standard, actively pushing against the proliferation of fifty discordant state regulatory regimes. This executive action established an AI Litigation Task Force specifically designed to challenge state laws deemed onerous or extraterritorial, relying on conflict preemption arguments to dismantle state-level disclosure and reporting requirements that deviate from the emerging federal baseline. The Judgment Machine must therefore weigh proposed AI systems against this shifting federal landscape, noting where state laws may face constitutional or preemptive challenges. Conversely, Canada’s Artificial Intelligence and Data Act (AIDA) focuses on a proactive, internationally aligned approach. AIDA categorizes AI systems based on their impact, mandating that high-impact systems maintain strict human oversight, transparency, fairness, and robust safety measures. The Canadian framework explicitly seeks interoperability with the EU AI Act and OECD principles, attempting to ensure that domestic AI development remains globally competitive without isolating Canadian firms through divergent, hyper-localized regulations. The Judgment Machine uses AIDA as a reference point for organizations seeking to deploy systems simultaneously across North American and European markets.

State-Level Specificity: The Illinois Exemplar

Because United States federal preemption remains actively contested in the courts, state-level laws remain highly relevant and enforceable, requiring the database to maintain granular, jurisdiction-specific indices. Illinois provides a rigorous, highly developed legislative model for evaluating AI in employment, privacy, and media contexts. The Illinois Artificial Intelligence Video Interview Act (AIVIA) establishes strict boundaries for employers utilizing AI to analyze applicant video interviews. The Judgment Machine will flag any recruitment architecture that fails to comply with AIVIA's notification and consent mandates. Employers must notify candidates at least five business days in advance of the interview, providing a reasonably specific explanation of the characteristics the AI will evaluate, such as facial expressions, word choice, or vocal tone. The law requires explicit, affirmative written consent; proceeding with the interview no longer constitutes implied consent. Candidates possess a statutory right to request human review, and this review must be conducted by an individual with actual hiring authority who watches the raw video, rather than relying on algorithmic scoring summaries. Furthermore, the system must verify data retention protocols, as Illinois mandates that all video recordings and algorithmic analyses be destroyed within 30 days unless the candidate is hired or explicitly consents to a longer retention period. Expanding upon AIVIA, Illinois House Bill 3773 amends the state's Human Rights Act to regulate predictive analytics and automated decision-making across all employment phases, effective January 1, 2026\. The legislation broadly prohibits employers from using AI that generates outputs resulting in a discriminatory effect on any protected class, encompassing recruitment, hiring, promotion, training selection, and termination. The law explicitly bans the use of proxy data, such as utilizing applicant zip codes to infer protected demographic characteristics. The Judgment Machine evaluates HR-related prompts against these requirements, ensuring that the proposed architecture includes mechanisms for annual bias audits, human oversight, and the delivery of conspicuous policy notices to both current employees and prospective applicants through physical premises, intranets, and job postings. Beyond employment, Illinois has enacted stringent legislation governing generative AI, deepfakes, and digital replicas, amending the Right of Publicity Act through HB 4875 and HB 4762\. These laws declare that contractual provisions allowing the creation and use of an individual's digital replica for personal or professional services are void and unenforceable against public policy unless specific conditions are met. The agreement must include a reasonably specific description of the intended uses of the digital replica, and the individual must be represented by legal counsel or a labor union during the negotiation of the licensing terms. The machine utilizes these statutes to evaluate prompts involving the synthesis of celebrity voices, historical figures, or employee likenesses for corporate training materials.

The NIST Risk Assessment Framework Integration

To standardize the evaluation of these disparate, multi-jurisdictional laws into a cohesive, easily understandable judgment, the knowledge base integrates the National Institute of Standards and Technology (NIST) AI Risk Management Framework (AI RMF). The AI RMF provides a structured taxonomy for assessing and mitigating technical, sociotechnical, and societal risks associated with algorithmic systems. The framework operates on four iterative pillars: Map, Measure, Manage, and Govern. The Map function guides the initial system identification and context setting; the Measure function underpins the quantitative and qualitative risk scoring; the Manage function drives the implementation of technical treatments and monitoring protocols; and the Govern function embeds accountability and policy alignment across the entire lifecycle. When the Judgment Machine evaluates a prompt, it utilizes a risk matrix derived from these pillars, blending qualitative insights from the retrieved legal texts with structural risk scoring. This methodology translates complex legal threats into a clear, traffic-light output system. Red-light use cases represent prohibited activities involving unacceptable risks, such as biometric categorization or social scoring, demanding immediate cessation of the proposed architecture. Yellow-light use cases represent high-risk applications that require the implementation of continuous testing, human oversight, algorithmic bias auditing, and fail-safes before deployment. Green-light use cases involve low-risk applications, such as basic customer service chatbots, that operate safely within established regulatory boundaries.

Risk CategoryNIST RMF AlignmentLegal EquivalentRecommended ActionExample Use Case
Red Light (Unacceptable)Unmitigable societal harm; governance failure.EU AI Act Article 5 ProhibitionsImmediate cessation; architecture redesign required.Untargeted facial scraping; social scoring.
Yellow Light (High Risk)Requires active Management and Measurement protocols.EU AI Act Annex III; Illinois HB 3773Implement bias audits, transparency notices, and human oversight.AI-driven resume screening; biometric security.
Green Light (Low Risk)Routine Mapping and Governance required.EU AI Act Minimal/Transparency RiskProceed with standard operational controls and disclosures.Customer support chatbots; inventory prediction.

Architecting the Client-Side AI Infrastructure

To assess a user's prompt against this extensive legal knowledge base without contacting an external server, the Judgment Machine requires a highly optimized, fully localized client-side infrastructure. This paradigm shift from centralized cloud computing to decentralized edge processing relies on the convergence of WebAssembly, WebGPU, and advanced browser storage mechanisms.

In-Browser Vector Embeddings and Semantic Chunking

When a user submits a prompt detailing their intended AI architecture, the raw text must be mathematically transformed into a high-dimensional vector. This embedding process captures the semantic meaning of the text, allowing the system to locate conceptually similar legal statutes even if the exact keyword terminology differs. This complex mathematical transformation is accomplished utilizing Transformers.js, a specialized JavaScript library designed to execute pre-trained machine learning models directly in the browser environment. Transformers.js functions as a direct port of the Hugging Face Python library, executing ONNX-formatted models via WebAssembly for CPU processing or WebGPU for hardware-accelerated parallel processing. For the Judgment Machine, selecting an appropriate embedding model requires balancing semantic accuracy with stringent memory constraints. Massive server-side models are entirely unsuited for browser environments due to unmanageable download sizes and prohibitive memory overhead. Instead, the system relies on highly optimized, lightweight embedding models such as the BAAI General Embedding (bge-small) or all-MiniLM-L6-v2. The bge-small model is particularly well-suited for document retrieval tasks, producing 384-dimensional vectors while supporting up to 512 tokens per input. To further optimize performance, the model undergoes 8-bit quantization (q8), a mathematical compression technique that reduces the precision of the model's internal weights from 32-bit floating-point numbers to 8-bit integers. This process drastically reduces the model's file size to approximately 30 megabytes while maintaining near-parity in semantic retrieval quality. Upon the user's initial visit to the application, this quantized model is downloaded and permanently cached within the browser's IndexedDB, eliminating the need for subsequent network requests and enabling entirely offline functionality. The embedding process utilizes a dedicated feature-extraction pipeline within Transformers.js. The model ingests the user's prompt and processes it through its neural network layers. Because the raw transformer model outputs a distinct vector for every individual token, the pipeline applies a mathematical technique known as mean pooling. This technique averages all the token vectors together, heavily weighted by the model's attention mask to ensure that irrelevant padding tokens do not skew the mathematical representation. Finally, the system normalizes the resulting aggregated vector to a unit length, which vastly simplifies and accelerates the downstream cosine similarity calculations required during the search phase. The final output of this pipeline is a Float32Array containing exactly 384 numbers arranged in row-major order, representing the precise semantic coordinates of the user's proposed AI use case.

The Client-Side Vector Database: Search and Retrieval

Once the user's prompt is vectorized, the Judgment Machine must rapidly compare this mathematical representation against the vectorized chunks of global legislation stored within its knowledge base. The system requires a database capable of executing highly efficient nearest-neighbor searches directly within the browser's memory sandbox. Several technologies have recently emerged to handle client-side vector workloads, each with distinct architectural approaches. DuckDB WASM provides an in-process analytical SQL database tailored for the browser, augmented by an experimental Vector Similarity Search (VSS) extension. This extension adds indexing support via Hierarchical Navigable Small World (HNSW) graphs, accelerating queries that utilize array distance functions to calculate exact L2-norm squared or cosine similarities. While DuckDB excels at complex, relational analytical workloads, its SQL-heavy architecture introduces unnecessary overhead for a system primarily focused on rapid semantic retrieval. Voy presents an alternative approach, utilizing a vector similarity search engine written entirely in Rust and compiled to WASM. Voy achieves an exceptionally small footprint by utilizing k-d trees for indexing rather than HNSW graphs, making it highly suitable for resource-constrained edge deployments. However, Voy relies exclusively on vector similarity, lacking the capability to process traditional lexical searches effectively. For the Judgment Machine, Orama JS represents the optimal database architecture. Originally launched as an open-source project for full-text lexical search, Orama has evolved to support native hybrid search capabilities directly within the browser. Hybrid search concurrently executes a semantic vector search utilizing cosine similarity alongside a traditional full-text search utilizing BM25 or similar lexical algorithms. This dual-pronged approach is absolutely critical for legal analysis. While vector search excels at identifying conceptual similarities, legal compliance often hinges on the exact presence of highly specific terminology, such as "AIVIA" or "Article 5". Orama aggregates the results from both search methodologies, utilizing configurable hybrid weights to determine the final relevance score. The Orama database initializes rapidly, loading the indexed legal texts into memory within 70 to 100 milliseconds. Because high-dimensional vectors consume significant browser memory, the legal texts undergo rigorous pre-processing before they are distributed to the client. The legislative documents are fragmented using a semantic chunking library, breaking the texts into discrete segments that fit comfortably within the embedding model's 512-token limit. Furthermore, the pre-computed embeddings undergo an additional layer of quantization specific to the Orama schema, converting the raw Float32Array values into bounded integers, which minimizes the overall database size and accelerates the initial download process.

Database EngineCore ArchitectureIndexing MethodologyHybrid Search CapabilityOptimal Deployment Scenario
Orama JSIn-Memory / IndexedDBCustom Hybrid ScoringNative (Concurrent)Rapid client-side RAG pipelines requiring both lexical precision and semantic understanding.
DuckDB WASMRelational SQL / Virtual FSHNSW (VSS Extension)Manual via complex queriesData-intensive analytical workloads requiring relational joins alongside vector comparisons.
VoyRust / WASMk-d treeNoneUltra-lightweight environments relying exclusively on pure semantic similarity.

Because Orama does not natively support deeply nested arrays of custom objects within its schema definitions, the database structure is flattened. The schema incorporates denormalized metadata to facilitate rapid filtering, allowing the user to restrict the legal judgment to specific jurisdictions or regulatory domains prior to executing the vector search.

Local Inference via Small Language Models (SLMs)

With the most legally relevant context retrieved from the Orama database, the Judgment Machine requires an intelligent reasoning engine to synthesize the legal text, analyze the user's prompt, and output a structured legal evaluation. Instead of transmitting this sensitive payload to a centralized cloud provider via an API, the application utilizes WebLLM to execute a highly optimized Small Language Model (SLM) directly within the user's browser. WebLLM represents a breakthrough in decentralized AI execution, developed by the Machine Learning Compilation (MLC) initiative. The framework compiles standard LLM operations into highly efficient WebGPU kernels, allowing the browser to interface directly with the local machine's dedicated or integrated graphics processing unit. This hardware acceleration functions across varying vendor ecosystems, including Apple's Metal API, NVIDIA, and AMD architectures, entirely bypassing the CPU bottlenecks that historically crippled browser-based machine learning. WebLLM utilizes Web Workers to process the intense inference calculations in a background thread, ensuring that the primary user interface remains responsive and unblocked. Once the model weights are downloaded and cached within IndexedDB, the system operates entirely offline, achieving inference speeds that rival native desktop applications. Deploying models within a browser environment imposes severe physical constraints on Video RAM (VRAM) consumption and context window management. Massive foundation models boasting hundreds of billions of parameters are fundamentally incompatible with this architecture. As of the 2026 model landscape, organizations deploying client-side web applications target SLMs falling within the 2-billion to 4-billion parameter range. These models strike the optimal balance between logical reasoning capabilities, memory footprint, and inference speed. The selected model for the Judgment Machine must possess exceptional text comprehension and logical deduction capabilities to navigate the dense, highly structured terminology retrieved from the legal database.

Language ModelParameter CountVRAM Usage (4-bit Q4)Context WindowArchitectural Strengths and Focus Areas
Gemma 4 E2B2.3 Billion\~5 GB128,000 TokensEdge-optimized, robust multimodal inputs, highly permissive Apache 2.0 licensing.
Qwen 3.5 Small0.8B to 4B1 GB to 3 GB256,000 TokensExceptional multilingual support (201 languages), high MMLU scores, dual thinking modes.
Llama 3.23.0 Billion\~2 GB128,000 TokensStrong generalist instruction-following capabilities, extremely low memory footprint.
Phi-4-mini3.8 Billion\~3 GB128,000 TokensExceptional performance in logic, reasoning, and complex text evaluation relative to scale.

For the specific task of legal evaluation, Microsoft's Phi-4-mini serves as the optimal reasoning engine. The Phi-series architecture diverges from traditional scaling laws by focusing intensely on data quality rather than raw parameter volume, utilizing highly curated, "textbook quality" training sets. This approach results in a model that exhibits disproportionately high capabilities in logic, reasoning, and coding tasks relative to its diminutive size. In rigorous comparative benchmarks, Phi-4-mini consistently excels in TruthfulQA metrics and advanced chain-of-thought processing. This logical rigor is absolutely essential for determining whether the specific nuances of a user's proposed architecture violate the granular clauses of the EU AI Act or the technical requirements of Illinois HB 3773\. Utilizing 4-bit quantization, Phi-4-mini consumes approximately 3 gigabytes of VRAM, ensuring compatibility with the vast majority of modern laptops, tablets, and consumer-grade hardware.

The integration of WebLLM provides a seamless, OpenAI-compatible API structure, allowing the application to interface with the local model using familiar programmatic constructs. However, the success of the Judgment Machine relies heavily on advanced prompt engineering. The system prompt must enforce strict behavioral constraints, forcing the SLM to rely exclusively on the retrieved legal context rather than its internal, pre-trained knowledge base, thereby preventing legal confabulations. The execution workflow initiates when the user inputs their proposed AI architecture. The text is vectorized by Transformers.js, and Orama retrieves the most conceptually relevant legislative statutes. This combined payload is then injected into the WebLLM prompt matrix. The system prompt explicitly defines the persona and the structural requirements of the output. The model is instructed to act as a strict, impartial AI Regulatory Judge. It is commanded to evaluate the user's prompt based exclusively on the provided legal contexts. The model must synthesize this information and output a strictly formatted JSON object containing three specific fields: the risk tier (classifying the prompt as Unacceptable, High, Limited, or Minimal based on the EU AI Act and NIST RMF), the status color (Red, Yellow, or Green for immediate visual feedback), and a detailed verdict explaining the precise legal reasoning behind the classification. For example, if a user submits a prompt proposing an AI system that analyzes municipal surveillance cameras to assign a trustworthiness score to citizens based on their loitering habits, the RAG pipeline will retrieve Article 5 of the EU AI Act. The WebLLM engine will process this context and output a Red Light status, classifying the system as an Unacceptable Risk. The verdict will explicitly state that the proposed architecture violates the strict prohibitions against social scoring by public authorities and the untargeted scraping of facial images from CCTV footage, noting that the system does not meet the narrow exemptions for targeted searches for missing persons. The judgment matrix presented to the user clearly delineates the prohibited nature of the request, preventing the deployment of non-compliant, illegal technology. Alternatively, if the user proposes deploying a generative AI chatbot for customer service, the system retrieves the Transparency Risk guidelines from the EU AI Act and the NIST RMF governance protocols. The machine outputs a Green Light status, noting that the system presents minimal risk provided the developer implements clear disclosure mechanisms ensuring the human user is aware they are interacting with a synthetic entity.

When evaluating complex legal compliance and assigning risk, factual accuracy is not merely preferred; it is absolutely paramount. Large language models, regardless of their architectural sophistication, are fundamentally probabilistic engines designed to predict the next most statistically likely token based on their training data. They are not inherently designed to verify truth or cross-reference facts, which inevitably leads to phenomena known as hallucinations or confabulations, where the model generates plausible-sounding but entirely fictitious information. While the implementation of a RAG architecture grounds the model in factual legal text, retrieval failures, inadequate context chunking, or conflicting jurisdictional laws can still trigger severe inaccuracies. To ensure the Judgment Machine remains a trustworthy and reliable compliance tool, multi-layered hallucination mitigation strategies are engineered directly into the evaluation pipeline. The primary defense mechanism is uncertainty-based abstention. Empirical research indicates that forcing an LLM to generate an answer when the provided context is insufficient or conflicting drastically increases the rate of hallucination. To combat this, the system prompt explicitly grants the model permission to admit uncertainty. The prompt instructs the SLM that if the retrieved legal contexts do not contain enough specific information to make a definitive ruling, or if the laws are fundamentally contradictory, it must output a predetermined refusal phrase, such as "I do not know" or "Insufficient Legal Context." By treating uncertainty recognition as a learnable, prompt-enforced skill, the system reduces factual errors by 30% to 50% in high-stakes domains, prioritizing safety and reliability over unverified helpfulness. A secondary layer of defense involves post-hoc consistency checking. After the primary Phi-4-mini model generates its initial JSON verdict, the system architecture can invoke a secondary, background evaluation prompt. This process utilizes the same model to review the initially generated verdict against the raw retrieved legal text. The goal of this secondary pass is to evaluate semantic alignment, ensuring the model genuinely grounded its response in the provided documents rather than relying on the latent space of its pre-trained weights. If the secondary evaluation detects that the primary verdict contains claims unsupported by the retrieved legislation, the system flags the output, alerting the user to potential inaccuracies and recommending human legal review. Finally, the system ensures maximum transparency through rigorous traceability. The user interface of the Judgment Machine is designed to explicitly link the LLM's generated verdict to the specific source documents utilized in the generation process. By presenting the exact clauses of the EU AI Act, Canada's AIDA, or the Illinois Artificial Intelligence Video Interview Act directly alongside the model's explanation, the user can independently verify the output. This design choice shatters the opaque, "black box" nature of algorithmic decision-making, allowing compliance officers and developers to audit the machine's logic and trace every assertion back to its foundational legal statute.

Conclusion

The intersection of rapidly accelerating artificial intelligence capabilities and the equally rapid expansion of global, federal, and state-level legislation presents a profound operational challenge. Organizations, developers, and compliance officers must relentlessly innovate while simultaneously navigating an increasingly complex labyrinth of prohibited uses, high-risk classifications, strict transparency mandates, and discordant jurisdictional laws. The failure to accurately assess the legal viability of an AI architecture prior to deployment invites severe financial penalties, reputational destruction, and immediate operational cessation. The client-side AI Judgment Machine offers a robust, highly technical, and profoundly secure solution to this escalating challenge. By abandoning the traditional, privacy-invasive reliance on centralized cloud APIs, the system pioneers a decentralized approach to legal analysis. It synthesizes local vector embedding generation via Transformers.js, rapid in-memory hybrid retrieval via Orama JS, and hardware-accelerated logical evaluation utilizing WebLLM and sophisticated reasoning models like Phi-4-mini. Operating entirely within the isolated memory sandbox of the user's browser, the architecture delivers real-time, privacy-preserving legal compliance checks with zero data leakage. Through structured outputs meticulously aligned with the NIST AI RMF, the strict taxonomy of the EU AI Act, and nuanced state legislation, the system successfully translates complex, heterogeneous global regulations into actionable, transparent, and immediate guidance for the next generation of AI development.

Works cited

1\. From Cloud to Device: How WebLLM Makes AI Personal and Private \- Medium, https://medium.com/@orion.extensions/from-cloud-to-device-how-webllm-makes-ai-personal-and-private-055a9c00a145 2\. WebLLM Guide: Run AI Models in Your Browser (2026) \- Local AI Master, https://localaimaster.com/blog/webllm-browser-ai-guide 3\. DuckDB-Wasm: Efficient Analytical SQL in the Browser, https://duckdb.org/2021/10/29/duckdb-wasm 4\. The client-side AI stack | web.dev, https://web.dev/learn/ai/client-side 5\. AI Act | Shaping Europe's digital future \- European Union, https://digital-strategy.ec.europa.eu/en/policies/regulatory-framework-ai 6\. AI Regulations in 2025: US, EU, UK, Japan, China & More \- Anecdotes.ai, https://www.anecdotes.ai/learn/ai-regulations-in-2025-us-eu-uk-japan-china-and-more 7\. Article 5: Prohibited AI Practices | EU Artificial Intelligence Act, https://artificialintelligenceact.eu/article/5/ 8\. EU AI Act Prohibited Use Cases | Harvard University Information Technology, https://www.huit.harvard.edu/eu-ai-act 9\. AI Act Service Desk \- Article 5: Prohibited AI practices \- European Union, https://ai-act-service-desk.ec.europa.eu/en/ai-act/article-5 10\. Annex III: High-Risk AI Systems Referred to in Article 6(2) | EU Artificial Intelligence Act, https://artificialintelligenceact.eu/annex/3/ 11\. What Are High-Risk AI Systems Within the Meaning of the EU's AI Act, and What Requirements Apply to Them? \- WilmerHale, https://www.wilmerhale.com/en/insights/blogs/wilmerhale-privacy-and-cybersecurity-law/20240717-what-are-highrisk-ai-systems-within-the-meaning-of-the-eus-ai-act-and-what-requirements-apply-to-them 12\. Executive Order 14110 \- Wikipedia, https://en.wikipedia.org/wiki/Executive\_Order\_14110 13\. US EO on AI, Requirements & Compliance Checklist \- Aona AI, https://aona.ai/compliance/regulations/us-executive-order-ai/ 14\. Promoting Advanced Artificial Intelligence Innovation and Security \- The White House, https://www.whitehouse.gov/presidential-actions/2026/06/promoting-advanced-artificial-intelligence-innovation-and-security/ 15\. Revocation of Executive Order 14110—Safe, Secure, and Trustworthy Development and Use of Artificial Intelligence: Relevance to Design Professional Practice, https://www.mgmlaw.com/news-insights/revocation-of-executive-order-14110safe-secure-and-trustworthy-development-and-use-of-artificial-intelligence-relevance-to-design-professional-practice 16\. Where AI Regulation Stands Today | Benesch Law, https://www.beneschlaw.com/insight/where-ai-regulation-stands-today/ 17\. The Artificial Intelligence and Data Act (AIDA) – Companion document \- Innovation, Science and Economic Development Canada, https://ised-isde.canada.ca/site/innovation-better-canada/en/artificial-intelligence-and-data-act-aida-companion-document 18\. Canada Cannot Compete on AI Regulation, but It Can Coordinate It, https://www.cigionline.org/articles/canada-cannot-compete-on-ai-regulation-but-it-can-coordinate-it/ 19\. Illinois Adopts New AI-in-Employment Regulations: What Employers Need to Know for 2026, https://www.hinshawlaw.com/en/insights/blogs/employment-law-observer/illinois-adopts-new-ai-in-employment-regulations-what-employers-need-to-know-for-2026 20\. Illinois AI Video Interview Law Takes Effect: What Employers Must Know in 2026 \- Introl, https://introl.com/blog/illinois-ai-video-interview-law-employer-notification-2026 21\. AI Employment Laws \- JobSync, https://www.jobsync.com/ai-employment-laws/ 22\. Illinois Steps Up AI Regulation in Employment: Key Takeaways for Employers \- Ogletree, https://ogletree.com/insights-resources/blog-posts/illinois-steps-up-ai-regulation-in-employment-key-takeaways-for-employers/ 23\. Artificial Intelligence in Employment Update: Illinois Requires Notice and Prohibits Discriminatory Impact in Use of AI | Crowell & Moring LLP, https://www.crowell.com/en/insights/client-alerts/artificial-intelligence-in-employment-update-illinois-requires-notice-and-prohibits-discriminatory-impact-in-use-of-ai 24\. AI deepfake policy in Illinois \- Ballotpedia, https://ballotpedia.org/AI\_deepfake\_policy\_in\_Illinois 25\. Intellectual Property​ – Publicity \- WashU Law, https://law.washu.edu/ai-policy-and-regulation-resources/intellectual-property-publicity/ 26\. BUSINESS TRANSACTIONS (815 ILCS 550/) Digital Voice and Likeness Protection Act. \- Illinois General Assembly \- \-, https://www.ilga.gov/Legislation/ILCS/Articles?ActID=4531\&ChapterID=67 27\. AI Library Illinois | Morrison Foerster, https://www.mofo.com/artificial-intelligence/illinois 28\. AI Risk Management Framework | NIST \- National Institute of Standards and Technology, https://www.nist.gov/itl/ai-risk-management-framework 29\. AI Risk Management Framework \- Palo Alto Networks, https://www.paloaltonetworks.com/cyberpedia/ai-risk-management-framework 30\. AI Risk Assessment Framework: A Step-by-Step Guide \- SentinelOne, https://www.sentinelone.com/cybersecurity-101/data-and-ai/ai-risk-assessment-framework/ 31\. Conducting an AI Risk Assessment \- Mayer Brown, https://www.mayerbrown.com/-/media/files/perspectives-events/publications/2024/01/conducting-an-ai-risk-assessment\_kourinian.pdf%3Frev=5ac14ff56a40494aa8f2cc406afd32f6 32\. A framework for assessing AI risk \- MIT Sloan, https://mitsloan.mit.edu/ideas-made-to-matter/a-framework-assessing-ai-risk 33\. Local JavaScript Vector Database that works offline \- RxDB, https://rxdb.info/articles/javascript-vector-database.html 34\. I Built a Browser-Native AI App With No Backend — Here's What I Learned | by Vinesh EG, https://medium.com/@vinesheg/i-built-a-browser-native-ai-app-with-no-backend-heres-what-i-learned-8dd6a5383a53 35\. Practical NLP in the Browser with Transformers.js \- KDnuggets, https://www.kdnuggets.com/practical-nlp-in-the-browser-with-transformers-js 36\. Llamas on the Web: Memory-Efficient, Performance-Portable, and Multi-Precision LLM Inference with WebGPU \- arXiv, https://arxiv.org/html/2605.20706v1 37\. Client Side Semantic Search with BGE Embeddings in JavaScript \- Zen van Riel, https://zenvanriel.com/ai-engineer-blog/client-side-semantic-search-bge-embeddings-javascript/ 38\. README.md \- VectorSearch.js \- GitHub, https://github.com/jasonmayes/VectorSearch.js/blob/main/README.md 39\. Browser-based vector search: fast, private, and no backend required | Nearform, https://nearform.com/digital-community/browser-based-vector-search-fast-private-and-no-backend-required/ 40\. Building Semantic Search with Transformers.js and Sentence Embeddings \- MachineLearningMastery.com, https://machinelearningmastery.com/building-semantic-search-with-transformers-js-and-sentence-embeddings/ 41\. Vector Similarity Search Extension \- DuckDB, https://duckdb.org/docs/current/core\_extensions/vss 42\. Vector Similarity Search in DuckDB, https://duckdb.org/2024/05/03/vector-similarity-search-vss 43\. graphrag\_core \- Rust \- Docs.rs, https://docs.rs/graphrag-core 44\. GitHub \- tantaraio/voy: 🕸️ A WASM vector similarity search written in Rust, https://github.com/tantaraio/voy 45\. GitHub \- oramasearch/orama: A complete search engine and RAG pipeline in your browser, server or edge network with support for full-text, vector, and hybrid search in less than 2kb., https://github.com/oramasearch/orama 46\. Hybrid Search \- Orama, https://docs.orama.com/docs/orama-js/search/hybrid-search 47\. WebLLM | Home, https://webllm.mlc.ai/ 48\. Small Language Models Business Guide: Gemma, Phi, Qwen \- Digital Applied, https://www.digitalapplied.com/blog/small-language-models-business-guide-gemma-phi-qwen 49\. \[LLM 101\] How to Choose an AI Model: Gemma vs Llama vs Qwen vs Mistral (2026), https://ai-muninn.com/en/blog/llm-101-how-to-choose-a-model 50\. Best Small Language Models 2026: 12 SLMs for 8GB RAM | Local AI Master, https://localaimaster.com/blog/small-language-models-guide-2026 51\. Gemma 4, Phi-4, and Qwen3: Accuracy–Efficiency Tradeoffs in Dense and MoE Reasoning Language Models \- arXiv, https://arxiv.org/html/2604.07035v1 52\. Can we reduce Hallucinations in LLMs through prompt engineering? | by Prashant Lakhera, https://devopslearning.medium.com/can-we-reduce-hallucinations-in-llms-through-prompt-engineering-df7d275d9cfa 53\. Hallucination Mitigation for Retrieval-Augmented Large Language Models: A Review \- MDPI, https://www.mdpi.com/2227-7390/13/5/856 54\. 5 Practical Techniques to Detect and Mitigate LLM Hallucinations Beyond Prompt Engineering \- MachineLearningMastery.com, https://machinelearningmastery.com/5-practical-techniques-to-detect-and-mitigate-llm-hallucinations-beyond-prompt-engineering/ 55\. Mitigating Hallucination in Large Language Models (LLMs): An Application-Oriented Survey on RAG, Reasoning, and Agentic Systems \- arXiv, https://arxiv.org/html/2510.24476v1