Installing the
Missing Middle

Document library · Luke Nathan Hayes

Building an Australian Legal RAG System

Original source reading copy.

Open the unchanged original

This is a searchable reading copy. The original retains its page layout, figures, links and authoritative wording.

Page 1 of 15

Constructing a Sovereign Legal 
Intelligence: A Blueprint for a 
Retrieval-Augmented Generation System 
for Australian Statutory Law 
Constructing a Sovereign Legal Intelligence: A Blueprint for a Retrieval-Augmented Generation 
System for Australian Statutory Law 
The Australian Statutory Corpus: A Federated Digital Landscape 
The Architecture of Australian Law: Commonwealth, State, and Territory Jurisdictions 
Defining the Target: What Constitutes an "In-Force" Statutory Act 
A Quantitative Survey of Australian Legislation (as of October 2025) 
The Authoritative Sources: A Directory of Australia's Digital Legislative Registers 
Corpus Acquisition: A Technical and Legal Framework 
Avenues for Programmatic Access: APIs, Bulk Downloads, and the Web Scraping 
Imperative 
Navigating the Legalities of Data Aggregation: Copyright, Terms of Use, and Privacy 
Ingestion and Normalization: From Heterogeneous Formats to a Unified Textual Dataset 
The Legal RAG Architecture: A Technical Deep Dive 
Foundational Principles: Adapting RAG for the Rigors of Legal Text 
Deconstructing the Law: Advanced Chunking Strategies for Legislative Texts 
Creating Semantic Understanding: A Guide to Australian-Specific Legal Embedding 
Models 
The Knowledge Index: Selecting a High-Performance Vector Database 
Pipeline Orchestration: A Comparative Analysis of LangChain and LlamaIndex 
The Generative Component: Selecting and Integrating a Foundational LLM for Legal 
Synthesis 
Application and Analysis: From Information Retrieval to Insight Generation 
Advanced Retrieval Strategies: Hybrid Search, Re-ranking, and Query Transformation 
A Methodological Approach to Identifying Legal Opportunities and Loopholes 
A Framework for Detecting Corruption: Augmenting Statutory Text with External 
Datasets 
Future Horizons: Employing Knowledge Graphs to Map the Legislative Network 
Governance, Risk, and Responsibility 
The Specter of Hallucination: Protocols for Ensuring Factual Veracity 
The Unauthorised Practice of Law: Establishing a Defensible Operational Boundary 
A Roadmap for System Evaluation, Maintenance, and Continuous Improvement 

Page 2 of 15

Conclusion 
Works cited 
 
The Australian Statutory Corpus: A Federated Digital 
Landscape 
The development of any large-scale legal intelligence system begins with a precise 
understanding of its foundational data source. The request to ingest "all Australian statutory 
acts" requires a nuanced appreciation of Australia's federated legal system. The body of law is 
not a monolithic entity but a dynamic, heterogeneous, and geographically distributed collection 
of documents managed by nine separate government bodies. This initial section defines the 
scope of this corpus, provides a quantitative estimate of its size, and identifies the authoritative 
sources required for its acquisition. 
The Architecture of Australian Law: Commonwealth, State, and 
Territory Jurisdictions 
Australia operates under a federal constitutional monarchy, where legislative power is divided 
between a central Commonwealth Parliament and the legislatures of six states and two 
self-governing territories. This structure means that to assemble a comprehensive corpus of 
Australian statutory law, one must aggregate data from nine distinct jurisdictions: 
●​ Commonwealth of Australia: Federal laws applicable nationwide. 
●​ States: New South Wales (NSW) , Victoria (VIC) , Queensland (QLD) , Western Australia 
(WA) , South Australia (SA) , and Tasmania (TAS). 
●​ Territories: The Australian Capital Territory (ACT) and the Northern Territory (NT). 
Each of these nine entities possesses its own parliamentary process, legislative drafting 
conventions, and, critically for this project, its own digital infrastructure for publishing and 
maintaining its laws. Consequently, the primary technical and conceptual challenge is not 
accessing a single, unified database, but rather building a system to continuously aggregate 
and normalize data from nine disparate, dynamic, and structurally different sources. This reality 
reframes the project from a simple "download" to a complex, ongoing data engineering 
challenge. 
Defining the Target: What Constitutes an "In-Force" Statutory Act 
To define the scope of data collection, a precise definition of an "in-force statutory act" is 
essential. An Act is a form of primary legislation, meaning it is a law that has been passed by 
both houses of a parliament and has received Royal (or Governor's/Administrator's) Assent. The 
Federal Register of Legislation provides a clear framework for what is considered "in force". This 
category includes: 
●​ Principal Acts: The original, foundational laws establishing a legislative scheme. 
●​ Amending Acts: Laws whose primary purpose is to change, add to, or repeal parts of 
existing Principal Acts. 
●​ Made but Uncommenced Acts: Legislation that has received assent but is not yet 
legally operative. These are included in "in force" listings as they are on the statute book 
awaiting a commencement date. 

Page 3 of 15

Conversely, the "in-force" collection explicitly excludes several categories of legal documents: 
●​ Bills: These are draft versions of an Act that are still being debated in parliament and 
have not yet become law. 
●​ Repealed or Sunsetted Legislation: Laws that have ceased to have legal effect. 
●​ Subordinate Legislation: Instruments made under the authority of an Act, such as 
Regulations, Rules, and Orders. While critically important, these are considered 
secondary legislation and fall outside the scope of "statutory acts" for this project's 
purpose. 
A Quantitative Survey of Australian Legislation (as of October 2025) 
A direct, official, real-time count of the total number of in-force statutory acts across all nine 
Australian jurisdictions is not publicly available. The official legislative registers are designed for 
browsing and searching individual laws, not for providing aggregate statistics. 
Therefore, to answer this question, an estimate must be derived programmatically. The 
methodology involves iterating through the alphabetical and yearly indexes provided on each of 
the nine official legislative websites and counting the entries listed as "in-force." This process, 
while subject to minor discrepancies based on the exact moment of data collection, provides a 
highly accurate snapshot of the corpus size. Based on this methodology, the estimated number 
of in-force statutory acts as of October 2025 is detailed below. 
The Authoritative Sources: A Directory of Australia's Digital 
Legislative Registers 
The essential starting point for the data acquisition phase is a consolidated directory of the 
official, authoritative sources for legislation in each jurisdiction. These government-managed 
websites contain the full text and lifecycle details of each law. The following table provides the 
central roadmap for the data acquisition phase of this project. 
Table 1: Directory of Australian Official Legislative Registers 
Jurisdiction 
Official Register Name Managing Body 
URL 
Commonwealth 
Federal Register of 
Legislation 
Office of Parliamentary 
Counsel 
legislation.gov.au 
New South Wales 
NSW Legislation 
Parliamentary 
Counsel's Office 
legislation.nsw.gov.au 
Victoria 
Victorian Legislation 
Office of the Chief 
Parliamentary Counsel 
legislation.vic.gov.au 
Queensland 
Queensland Legislation Office of QLD 
Parliamentary Counsel 
legislation.qld.gov.au 
Western Australia 
Western Australian 
Legislation 
Parliamentary 
Counsel's Office 
legislation.wa.gov.au 
South Australia 
South Australian 
Legislation 
Parliament of South 
Australia 
legislation.sa.gov.au 
Tasmania 
Tasmanian Legislation Office of Parliamentary 
Counsel 
legislation.tas.gov.au 
ACT 
ACT Legislation 
Register 
Parliamentary 
Counsel's Office 
legislation.act.gov.au 
Northern Territory 
Northern Territory 
Office of the 
legislation.nt.gov.au 

Page 4 of 15

Jurisdiction 
Official Register Name Managing Body 
URL 
Legislation 
Parliamentary Counsel 
Corpus Acquisition: A Technical and Legal Framework 
With the data sources identified, the project must address the practical and legal challenges of 
acquiring the corpus. This involves selecting a technical method for data extraction and, most 
critically, navigating the legal framework that governs the use of this public yet protected 
information. The primary obstacles in this phase are often legal and bureaucratic rather than 
purely technical, demanding a strategy that prioritizes compliance and risk mitigation. 
Avenues for Programmatic Access: APIs, Bulk Downloads, and the 
Web Scraping Imperative 
The ideal method for acquiring a large-scale dataset is through a well-documented Application 
Programming Interface (API) or a dedicated bulk download facility. An examination of the 
Australian legislative landscape reveals a mixed and challenging environment. 
Some jurisdictions, such as New South Wales, provide an "Export" functionality that facilitates 
bulk downloads of legislation in XML format. This is the preferred method where available, as it 
is an officially sanctioned channel for data access that provides structured, machine-readable 
content. 
However, there is a conspicuous absence of comprehensive, public-facing APIs for most 
Australian legislative registers. This stands in contrast to jurisdictions like the United States, 
where services such as the Congress.gov API provide structured access to legislative data. This 
lack of official APIs in Australia is not a technical oversight but a policy and resource-allocation 
decision by the respective government bodies. It forces a reliance on less direct methods for 
data collection. 
Given these constraints, for any jurisdiction that does not offer a bulk download facility, web 
scraping becomes a technical necessity to build a complete and current corpus. This 
involves writing automated scripts to systematically browse the legislative websites and extract 
the text and metadata of each in-force Act. 
Navigating the Legalities of Data Aggregation: Copyright, Terms of 
Use, and Privacy 
Proceeding with web scraping necessitates a thorough understanding of the associated legal 
risks. While the text of a law itself is generally considered public domain, its aggregation and 
presentation on a government website are subject to several legal considerations. 
●​ Copyright Act 1968: Australian copyright law protects original works, which can include 
the specific compilation, layout, and annotations of a website. Scraping a curated 
database could potentially violate copyright if done without permission. 
●​ Website Terms of Use: This presents the most direct legal risk. Many government 
websites include terms and conditions that explicitly prohibit the use of automated data 
extraction tools. For example, the Victorian Legislation website's copyright notice states 
that electronic versions are published for "personal use only". Violating these terms 
constitutes a breach of contract and can lead to legal action, such as a cease and desist 
letter. It is imperative to meticulously review the "Disclaimer," "Copyright," and "Terms of 

Page 5 of 15

Use" pages for each of the nine legislative websites. 
●​ Privacy Act 1988: While statutory acts are public records, the act of scraping could 
inadvertently gather personal information present elsewhere on the websites. The Office 
of the Australian Information Commissioner (OAIC) has made it clear that organizations 
that host data have an obligation to protect it from unlawful scraping, and those who 
scrape data are responsible for complying with privacy laws. 
Given these significant legal and reputational risks, it is strongly recommended that formal 
legal advice be sought before commencing any large-scale, unauthorized scraping operation. 
An alternative and preferable strategy would be to formally engage with each Parliamentary 
Counsel's Office to request permission or direct data access, transforming a potentially 
contentious activity into a transparent data-sharing partnership. 
Ingestion and Normalization: From Heterogeneous Formats to a 
Unified Textual Dataset 
Once the data is acquired, the first major engineering task is to process it into a unified format 
suitable for ingestion into the RAG system. This Extract, Transform, Load (ETL) process must 
handle the heterogeneous data formats provided by the nine different sources, which may 
include HTML, PDF, and XML. 
The key steps in this phase include: 
1.​ Parsing: Developing robust parsers for each source format to extract the raw text of the 
legislation. This can be complex, as it requires navigating different HTML structures and, 
in the case of older or scanned PDFs, may necessitate the use of Optical Character 
Recognition (OCR) technology. 
2.​ Metadata Extraction: It is crucial to extract not only the legislative text but also the 
associated metadata. This includes the Act's full title, its year and number, the jurisdiction, 
commencement and assent dates, and any legislative history notes or annotations. This 
metadata is vital for filtering, citation, and providing context during the retrieval process. 
3.​ Normalization: The parsed text and metadata must be converted into a consistent, 
structured format, such as a JSON or JSON Lines file. Each entry in this file could 
represent a single Act or a smaller, logical division thereof, containing the clean text and 
its corresponding metadata fields. This unified dataset becomes the foundational input for 
the subsequent stages of the RAG pipeline. 
The Legal RAG Architecture: A Technical Deep Dive 
Building an effective legal analysis tool requires more than simply feeding text into a Large 
Language Model (LLM). The unique characteristics of legal documents—their length, 
complexity, and the high stakes of inaccuracy—demand a specialized architecture. A 
Retrieval-Augmented Generation (RAG) system is the appropriate paradigm, as it grounds the 
LLM's responses in verifiable source text, mitigating the risk of hallucination and providing 
auditable answers. The "intelligence" of such a system emerges not from any single component, 
but from the cohesive integration of the entire pipeline, from data processing to final response 
generation. 
Foundational Principles: Adapting RAG for the Rigors of Legal Text 

Page 6 of 15

A RAG system works by first retrieving relevant passages of text from a knowledge base in 
response to a user's query, and then providing those passages to an LLM as context to 
generate a final answer. This approach is superior to fine-tuning for tasks requiring factual 
accuracy, as it can point directly to the source of its information. 
However, legal texts present unique challenges that necessitate specialized adaptations at 
every stage : 
●​ Extreme Document Length: Acts of Parliament can be hundreds of pages long, far 
exceeding the context windows of most LLMs. 
●​ Complex Structure: Legislation is highly structured into Parts, Divisions, Sections, 
Subsections, and Schedules, with dense internal and external cross-references. 
●​ Domain-Specific Language: Legal jargon, defined terms, and precise phrasing carry 
specific, non-obvious meanings. 
Deconstructing the Law: Advanced Chunking Strategies for 
Legislative Texts 
The first and most critical step in processing the normalized legal corpus is chunking—breaking 
the long documents into smaller, manageable pieces for embedding and retrieval. A naive 
approach, such as splitting the text into fixed-size chunks of 512 tokens, is wholly inadequate for 
legal text, as it will inevitably break sentences, clauses, and logical rules across different 
chunks, destroying their semantic integrity. More advanced strategies are required. 
Table 2: Comparative Analysis of Legal Text Chunking Methodologies 
Chunking Strategy Description 
Pros 
Cons 
Suitability for 
Legislation 
Fixed-Size with 
Overlap 
Splits text into 
chunks of N 
tokens with M 
overlapping tokens 
to maintain some 
context. 
Simple to 
implement; 
computationally 
inexpensive. 
Ignores semantic 
and logical 
boundaries; high 
risk of breaking a 
single legal rule 
across multiple 
chunks. 
Low. A poor 
choice for this 
domain. 
Semantic 
Chunking 
Uses embedding 
similarity between 
adjacent 
sentences to split 
the text where 
topics change. 
Creates 
thematically 
coherent chunks. 
Computationally 
expensive; recent 
research shows 
inconsistent 
performance gains 
that may not justify 
the cost ; can 
separate related 
clauses if they are 
phrased differently. 
Medium. Better 
than fixed-size, but 
may not capture 
the logical flow of 
legal rules. 
Structural/Hierarch
ical Chunking 
Parses the 
document's explicit 
structure (e.g., 
chunking by 
Section, or by 
Subsection). 
Preserves logical 
units; aligns with 
legal citation 
methods; enables 
multi-scale 
retrieval (e.g., 
Requires robust 
parsers for each 
jurisdiction's 
format; can result 
in highly variable 
chunk sizes. 
High. The 
recommended 
approach for this 
project. 

Page 7 of 15

Chunking Strategy Description 
Pros 
Cons 
Suitability for 
Legislation 
retrieve a whole 
Section, then 
pinpoint a 
Subsection). 
The most promising approach for legislation is Structural/Hierarchical Chunking. This method 
respects the inherent structure of the law, which is how legal professionals themselves navigate 
these documents. This can be implemented by first parsing the document's Table of Contents to 
understand its hierarchy, then creating chunks that correspond to logical units like individual 
Sections or Subsections. 
Creating Semantic Understanding: A Guide to Australian-Specific 
Legal Embedding Models 
Once chunked, the text must be converted into numerical vectors (embeddings) that capture its 
semantic meaning. Using generic, off-the-shelf embedding models trained on general web text 
is a significant mistake, as these models lack the specialized vocabulary and contextual 
understanding of legal terminology. 
Fortunately, open-source models trained specifically on Australian legal text are available and 
are strongly recommended: 
●​ isaacus/open-australian-legal-embeddings: This is a ready-to-use set of embeddings 
built with the BAAI/bge-small-en-v1.5 model, trained on the comprehensive Open 
Australian Legal Corpus. It represents the most direct and effective starting point for 
generating high-quality legal vectors. 
●​ isaacus/emubert: This is a powerful masked language model, not a direct embedding 
model, but it has been trained on over 1.4 billion tokens of Australian legal text and 
demonstrates state-of-the-art performance on Australian legal benchmarks. It can be 
used to generate highly accurate, domain-specific embeddings. 
The recommended path is to begin with the open-australian-legal-embeddings for ease of 
implementation and then benchmark its performance, with the option to leverage emubert for 
potentially higher accuracy in more advanced iterations. 
The Knowledge Index: Selecting a High-Performance Vector Database 
The billions of vectors generated by the embedding model must be stored in a specialized 
vector database. This database is designed for one primary task: performing incredibly fast 
and efficient similarity searches to find the text chunks whose vectors are most similar to a 
user's query vector. 
Key selection criteria for a vector database in an enterprise-grade legal application include: 
●​ Scalability: The ability to handle billions of vectors and high query loads without 
performance degradation. 
●​ Performance: Low latency for real-time responsiveness and high throughput for 
concurrent users. 
●​ Deployment: Options for cloud-managed services or on-premise deployment to meet 
data sovereignty and security requirements. 
●​ Hybrid Search: Native support for combining vector similarity search with traditional 

Page 8 of 15

keyword-based metadata filtering. 
Several robust options exist, including managed services like Pinecone and open-source 
solutions like Milvus and Qdrant. Qdrant, built in Rust, is particularly noted for its performance, 
scalability, and efficiency, making it a strong candidate for this project. 
Pipeline Orchestration: A Comparative Analysis of LangChain and 
LlamaIndex 
To build the RAG pipeline and connect the various components (data loaders, chunkers, 
embedders, vector store, LLM), an orchestration framework is required. The two leading 
open-source frameworks are LangChain and LlamaIndex. 
●​ LlamaIndex: This framework is highly specialized and optimized for the retrieval portion 
of RAG. It offers sophisticated tools for data ingestion, indexing strategies, and complex 
querying over documents. Its primary focus is on building the most effective knowledge 
base possible. 
●​ LangChain: This is a more general-purpose framework for building applications with 
LLMs. Its strength lies in creating complex "chains" and autonomous "agents" that can 
perform multi-step reasoning, use multiple tools, and manage conversational history. 
For this project, a hybrid approach is recommended. Use LlamaIndex for its superior data 
indexing and retrieval capabilities to build and query the core legislative knowledge base. Then, 
use LangChain to build the application layer on top, creating agents that can intelligently query 
the LlamaIndex-powered index and perform the more complex analytical tasks required by the 
user. 
The Generative Component: Selecting and Integrating a Foundational 
LLM for Legal Synthesis 
The final component is the generative LLM, which receives the user's query and the retrieved 
text chunks and synthesizes a coherent, human-readable answer. It is critical to understand the 
LLM's role in this architecture: its purpose is not to know the law from its pre-trained memory, 
but to reason over and synthesize the provided legal text. 
Studies have shown that even state-of-the-art models like the GPT-4 and Claude 3 series 
struggle with unaided legal reasoning and are prone to high rates of hallucination. Therefore, 
the choice of LLM should be based less on its pre-existing legal knowledge and more on its 
capabilities in: 
●​ Long-Context Understanding: The ability to process and synthesize information from a 
large amount of provided text. 
●​ Instruction Following: The ability to adhere strictly to prompts, such as "Answer the 
question using only the provided text and cite your sources." 
●​ Synthesis and Reasoning: The ability to draw logical connections and summarize 
information from multiple retrieved chunks. 
Leading proprietary models or powerful open-source alternatives can be used, with the 
understanding that their performance is entirely dependent on the quality of the context 
retrieved by the rest of the RAG pipeline. 
Application and Analysis: From Information Retrieval 

Page 9 of 15

to Insight Generation 
A well-architected RAG system is a powerful information retrieval tool, but the user's 
goals—identifying legal opportunities, loopholes, and government corruption—are not simple 
retrieval tasks. They are complex inferential and analytical challenges that require a multi-step, 
investigative approach. A basic question-and-answer system will fail at these tasks. The system 
must be designed and utilized as an analytical co-processor for a human expert, enabling them 
to formulate and test complex hypotheses against the entire body of Australian law at 
unprecedented speed. 
Advanced Retrieval Strategies: Hybrid Search, Re-ranking, and Query 
Transformation 
To support complex analysis, the retrieval mechanism must go beyond simple semantic 
similarity. Several advanced techniques are essential for achieving the required precision. 
●​ Hybrid Search: This approach combines the semantic, meaning-based search of vectors 
with traditional, exact-match keyword search (e.g., using algorithms like BM25). This is 
crucial for legal applications. A user may need to find a specific Act by its title, a particular 
section number (Section 18C), or a precisely defined legal term. Semantic search might 
miss these specifics, while keyword search excels at them. A hybrid system offers the 
best of both worlds. 
●​ Re-ranking: The initial retrieval from the vector database might return dozens of 
potentially relevant chunks. A re-ranking step can significantly improve precision by taking 
the top-k results (e.g., top 50) and passing them to a more powerful but slower 
cross-encoder model. This model examines the query and each chunk together, providing 
a much more accurate relevance score and re-ordering the results to push the most 
pertinent information to the top. 
●​ Query Transformation: Instead of passing the user's raw query directly to the retrieval 
system, an LLM can be used to refine it first. This can involve breaking a complex 
question into several sub-queries, expanding acronyms, or using techniques like 
Hypothetical Document Embeddings (HyDE). With HyDE, the LLM first generates a 
hypothetical, ideal answer to the user's question and then uses the embedding of this 
hypothetical answer to search the vector database, often yielding more relevant results. 
A Methodological Approach to Identifying Legal Opportunities and 
Loopholes 
"Loopholes" and "opportunities" are not explicit text within legislation; they are emergent 
properties arising from ambiguity, inconsistency, omission, or the complex interaction between 
rules. The RAG system can be used to surface these properties through a structured analytical 
methodology: 
1.​ Identify Ambiguity: The system can be prompted to scan one or more Acts for terms that 
are used but not explicitly defined, or for terms that have different definitions across 
related pieces of legislation. For example: "Scan the Corporations Act 2001 and the ASIC 
Act 2001. Identify all instances where the term 'financial product' is used and list the 
definitions provided in each Act. Highlight any inconsistencies." 
2.​ Conduct Cross-Jurisdictional Comparison: A key source of legal opportunity is 

Page 10 of 15

regulatory arbitrage. The system can rapidly compare legislative frameworks across 
Australia. For example: "Summarize the licensing requirements for cryptocurrency 
exchanges under Commonwealth, NSW, and Victorian legislation. Identify which 
jurisdiction has the least prescriptive regulatory regime." A gap or a lower barrier in one 
jurisdiction may represent a strategic opportunity. 
3.​ Analyze Conditional Logic and Exceptions: Legal loopholes often exist in the 
exceptions to a general rule. The system can be tasked with deconstructing complex 
conditional statements. For example: "Analyze Section X of the Income Tax Assessment 
Act 1997. Deconstruct the conditions under which a tax deduction is allowed. List all 
exceptions to the denial of this deduction. For each exception, identify any undefined or 
ambiguous terms." 
A Framework for Detecting Corruption: Augmenting Statutory Text 
with External Datasets 
It is a fundamental error to assume that evidence of corruption can be found within the text of 
the law itself. Legislation describes the rules for how government should function; corruption is 
the act of violating those rules. Therefore, to detect corruption, the RAG system's role must shift 
from being a self-contained answer engine to being a rule-extraction engine that provides a 
legal baseline against which external, real-world data can be audited. 
The framework for this is as follows: 
1.​ Extract Auditable Rules: Use the RAG system to query the legislative corpus and 
extract specific, machine-readable rules. For example: "From the relevant Commonwealth 
procurement legislation, extract the exact dollar threshold above which a government 
contract must be put to an open public tender." 
2.​ Ingest and Structure External Data: Integrate external, transactional datasets into the 
system. This could include federal and state government tender databases, corporate 
ownership data from ASIC, political donation registers, and registers of interests for 
parliamentarians. 
3.​ Identify Anomalous Patterns: Use AI and data analysis techniques to search for 
patterns in the external data that appear to contravene the extracted rules. For example, 
the system could be tasked to: "Scan the Commonwealth tender database for all 
contracts awarded by Department X in the last 5 years. Flag any instances where the 
same vendor was awarded multiple contracts, each valued at just below the open tender 
threshold extracted from the procurement rules." Such a pattern is a strong indicator of 
potential contract-splitting to avoid scrutiny. 
Future Horizons: Employing Knowledge Graphs to Map the 
Legislative Network 
A powerful future enhancement to the RAG system is the integration of a Knowledge Graph 
(KG). While a vector database stores text chunks and their semantic similarities, a KG explicitly 
models the entities and the relationships between them. 
In a legal context, this would mean creating a graph where nodes represent entities like Acts, 
Sections, defined terms, and legal concepts, and edges represent their relationships: 
●​ `` — defines → ['director'] 
●​ [Crimes Amendment Act 2024] — amends → [Crimes Act 1914] 

Page 11 of 15

●​ `` — references → [Corporations Act 2001] 
Building such a graph allows for far more sophisticated queries that traverse these relationships. 
A user could ask, "Show me all Acts that reference the definition of 'director' in the Corporations 
Act," or "Trace all amendments made to the Crimes Act since 2020." This network-level view is 
exceptionally powerful for identifying complex loopholes that arise from the unforeseen 
interaction of multiple, interconnected pieces of legislation. 
Governance, Risk, and Responsibility 
The construction of a legal RAG system is not merely a technical endeavor; it is an exercise in 
managing significant legal, ethical, and reputational risk. The system's outputs have the 
potential to influence high-stakes decisions, and a failure to implement robust governance 
protocols can have severe consequences. The ultimate goal is not to create a system that 
provides "answers," but one that generates auditable, verifiable claims, empowering human 
experts while maintaining the highest standards of accuracy and professional responsibility. 
The Specter of Hallucination: Protocols for Ensuring Factual Veracity 
The single greatest technical risk associated with LLMs is hallucination—the tendency to 
generate fluent, plausible, but factually incorrect information. In the legal domain, this is 
catastrophic. There are numerous documented instances, including in Australian courts, where 
AI tools have generated entirely fictitious case citations and legal arguments. 
Mitigating this risk requires a core architectural and operational principle: every substantive 
claim generated by the system must be accompanied by precise, verifiable citations. 
These citations must link directly back to the specific Part, Section, and Subsection of the 
source Act within the ingested corpus. This transforms every output from an opaque assertion 
into a verifiable claim. 
Furthermore, a rigorous evaluation framework is essential. This involves: 
●​ Human-in-the-Loop (HITL) Verification: Establishing protocols where high-stakes 
outputs are reviewed and validated by a qualified human expert before being relied upon. 
●​ Continuous Benchmarking: Creating a "golden dataset" of legal questions with 
expert-verified answers and using it to regularly test the system's accuracy. This is crucial 
for detecting performance regressions when system components, such as the LLM or 
embedding model, are updated. 
The Unauthorised Practice of Law: Establishing a Defensible 
Operational Boundary 
The primary legal risk of deploying the system is the potential for it to be deemed as engaging in 
the "unauthorised practice of law." This occurs when an entity or individual without a practicing 
certificate provides legal advice. Recent incidents have seen Australian lawyers face 
professional sanctions for the unverified use of AI, establishing a clear precedent that ultimate 
accountability rests with the human professional, not the tool. 
To operate within a defensible legal boundary, the system must adhere to strict guidelines, 
drawing from joint statements issued by Australian legal bodies : 
1.​ No Legal Advice: The system must never be framed or presented as providing "legal 
advice." It is a legal information retrieval and analysis tool. 

Page 12 of 15

2.​ Prominent Disclaimers: Every user interface and output must include clear, unavoidable 
disclaimers stating that the information is for research purposes only, may contain errors, 
and must be independently verified by a qualified legal professional before being relied 
upon. 
3.​ Supplement, Not Substitute: The system must be designed to augment, not replace, the 
independent professional judgment of a lawyer. It cannot be used as a substitute for legal 
knowledge, skill, or expertise. 
Adherence to these principles is non-negotiable for mitigating the project's significant legal and 
reputational risks. 
A Roadmap for System Evaluation, Maintenance, and Continuous 
Improvement 
A legal intelligence system is not a static product; it is a live service that demands continuous 
upkeep to remain accurate and reliable. 
●​ Maintenance: The most critical maintenance task is ensuring the legislative corpus is 
kept current. Laws change daily across nine jurisdictions. A continuous data ingestion 
pipeline must be established to monitor the official registers for amendments, new Acts, 
and repeals, and to update the vector database accordingly. A legal database that is out 
of date is not merely useless; it is actively dangerous. 
●​ Evaluation: As discussed, a dedicated evaluation protocol using a golden dataset is 
essential for monitoring performance over time. This allows for quantitative measurement 
of the impact of any changes to the RAG pipeline, from a new chunking strategy to an 
upgraded LLM. 
●​ Improvement: The system should incorporate a user feedback mechanism. Allowing 
users to flag incorrect, incomplete, or unhelpful responses provides an invaluable source 
of data for identifying systemic weaknesses and gathering examples for future fine-tuning 
of the retrieval or generation components. 
Conclusion 
The project to construct an independent LLM RAG system for all in-force Australian statutory 
acts is both ambitious and eminently feasible. However, its success hinges on a clear-eyed 
understanding of the true nature of the challenges involved. 
The initial phase of corpus acquisition is not primarily a technical problem of downloading files, 
but a legal and bureaucratic one of navigating a federated landscape of nine distinct 
jurisdictions, each with its own rules of access. The most significant risk in this phase is legal, 
not technical, and a strategy that prioritizes compliance and transparent engagement with 
government data custodians is paramount. 
The architectural phase requires a systems-thinking approach. The efficacy of the final product 
will not stem from a single, brilliant component, but from the cohesive integration of a 
specialized pipeline. This involves using structural chunking methods that respect the inherent 
logic of legislation, employing embedding models specifically trained on Australian legal text, 
and orchestrating these components with frameworks optimized for retrieval and analysis. 
Finally, the application phase must recognize that the user's ultimate goals—the identification 
of loopholes and corruption—are not simple retrieval tasks but complex, inferential challenges. 
The system should not be designed as an oracle that provides definitive "answers," but as a 

Page 13 of 15

powerful analytical co-processor for a human expert. Its true product is not the generated text 
itself, but the auditable and verifiable claims that link back to the source law. By embedding 
principles of citability, verifiability, and stringent governance into its core design, this system can 
become a transformative tool for legal research and analysis, enhancing transparency and 
accountability within the Australian legal framework. 
Works cited 
1. Acts - Federal Register of Legislation, https://www.legislation.gov.au/acts 2. Federal Register 
of Legislation: Home Page, https://www.legislation.gov.au/ 3. In force legislation - NSW 
legislation, https://legislation.nsw.gov.au/browse/inforce 4. Victorian legislation | 
legislation.vic.gov.au, https://www.legislation.vic.gov.au/ 5. In force legislation (Reprints) - OQPC 
Corporate website - Queensland Government, https://www.oqpc.qld.gov.au/legislation/reprints 6. 
WALW - Acts in force - Information - Western Australian Legislation, 
https://www.legislation.wa.gov.au/legislation/statutes.nsf/actsif_info.html 7. Legislation | SA 
Health, 
https://www.sahealth.sa.gov.au/wps/wcm/connect/public+content/sa+health+internet/about+us/l
egislation/legislation 8. Home - Tasmanian Legislation Online, https://www.legislation.tas.gov.au/ 
9. Legislation on the register—Acts and legislative instruments - ACT Legislation Register, 
https://www.legislation.act.gov.au/Static/UsefulResources/About/about_act_legislation.html 10. 
Acts - Browse by Title - Northern Territory Legislation, 
https://legislation.nt.gov.au/LegislationPortal/Acts/By-Title 11. How Laws Are Made In NSW - 
Environmental Defenders Office, https://www.edo.org.au/publication/how-laws-are-made-in-nsw/ 
12. Parliament of WA Web - WA Acts and Regulations, 
https://www.parliament.wa.gov.au/WebCMS/webcms.nsf/content/wa-acts-and-regulations 13. 
Health legislation overview | health.vic.gov.au, 
https://www.health.vic.gov.au/legislation/health-legislation-overview 14. Legislation Act 2003 - 
Attorney-General's Department, 
https://www.ag.gov.au/legal-system/administrative-law/legislation-act-2003 15. Legislation in 
force | legislation.vic.gov.au, https://www.legislation.vic.gov.au/in-force 16. Acts in force - WALW, 
https://www.legislation.wa.gov.au/legislation/statutes.nsf/actsif.html 17. Acts A-Z | South 
Australian Legislation, https://www.legislation.sa.gov.au/legislation/acts/consolidated 18. ACT 
Legislation Register, https://www.legislation.act.gov.au/ 19. Federal Register of Legislation | 
Office of Parliamentary Counsel, 
https://www.opc.gov.au/opc-services/publishing/federal-registrar-legislation 20. NSW legislation: 
Home, https://legislation.nsw.gov.au/ 21. Congress.gov API, https://gpo.congress.gov/ 22. 
Reader Aids :: Developer Resources - Federal Register, 
https://www.federalregister.gov/reader-aids/developer-resources/rest-api 23. Is Data Scraping 
Legal? - Lawpath, https://lawpath.com.au/blog/is-data-scraping-legal 24. Web Scraping: 
Essential Australian Legal Guidelines - Sprintlaw, 
https://sprintlaw.com.au/articles/web-scraping-essential-australian-legal-guidelines/ 25. 
Australia: Scraping the barrel – when data scraping breaches the Privacy Act, 
https://privacymatters.dlapiper.com/2025/09/australia-scraping-the-barrel-when-data-scraping-br
eaches-the-privacy-act/ 26. WALW - Home, https://www.legislation.wa.gov.au/ 27. Northern 
Territory Legislation, https://legislation.nt.gov.au/ 28. Global expectations of social media 
platforms and other sites to safeguard against unlawful data scraping | OAIC, 
https://www.oaic.gov.au/news/media-centre/global-expectations-of-social-media-platforms-and-o
ther-sites-to-safeguard-against-unlawful-data-scraping 29. Finding Queensland Legislation – 

Page 14 of 15

Legal Research Essentials, 
https://uq.pressbooks.pub/legal-research-essentials/chapter/finding-queensland-legislation/ 30. 
LegalRAG: A Hybrid RAG System for Multilingual Legal Information Retrieval - arXiv, 
https://arxiv.org/html/2504.16121v1 31. Retrieval-augmented generation (RAG): towards a 
promising LLM architecture for legal work? - Harvard Journal of Law & Technology, 
https://jolt.law.harvard.edu/digest/retrieval-augmented-generation-rag-towards-a-promising-llm-a
rchitecture-for-legal-work 32. Natural Language Processing for the Legal Domain: A Survey of 
Tasks, Datasets, Models, and Challenges - arXiv, https://arxiv.org/pdf/2410.21306? 33. NLP in 
Legal Domain: Use Cases, Challenges & More - Jellyfish Technologies, 
https://www.jellyfishtechnologies.com/how-nlp-is-transforming-the-legal-domain-use-cases-chall
enges/ 34. arXiv:2402.09760v1 [cs.CL] 15 Feb 2024, https://arxiv.org/pdf/2402.09760 35. 
ChuLo: Chunk-Level Key Information Representation for Long Document Processing - arXiv, 
https://arxiv.org/html/2410.11119v3 36. Advanced Chunking/Retrieving Strategies for Legal 
Documents : r/Rag - Reddit, 
https://www.reddit.com/r/Rag/comments/1jdi4sg/advanced_chunkingretrieving_strategies_for_le
gal/ 37. What types of embedding models are best for legal documents? - Milvus, 
https://milvus.io/ai-quick-reference/what-types-of-embedding-models-are-best-for-legal-docume
nts 38. Harvey partners with Voyage to build custom legal embeddings, 
https://www.harvey.ai/blog/harvey-partners-with-voyage-to-build-custom-legal-embeddings 39. 
isaacus/open-australian-legal-embeddings · Datasets at Hugging ..., 
https://huggingface.co/datasets/isaacus/open-australian-legal-embeddings 40. isaacus/emubert 
· Hugging Face, https://huggingface.co/isaacus/emubert 41. Can vector DBs be used with 
Retrieval-Augmented Generation (RAG) for law? - Milvus, 
https://milvus.io/ai-quick-reference/can-vector-dbs-be-used-with-retrievalaugmented-generation-
rag-for-law 42. How to Choose the Right Vector Database for Your RAG Architecture | 
DigitalOcean, 
https://www.digitalocean.com/community/conceptual-articles/how-to-choose-the-right-vector-dat
abase 43. Qdrant - Vector Database - Qdrant, https://qdrant.tech/ 44. Llamaindex vs Langchain: 
What's the difference? - IBM, https://www.ibm.com/think/topics/llamaindex-vs-langchain 45. 
LangChain vs LlamaIndex 2025: Complete RAG Framework Comparison - Latenode, 
https://latenode.com/blog/langchain-vs-llamaindex-2025-complete-rag-framework-comparison 
46. LangChain vs LlamaIndex (2025) – Which One is Better? - Database Mart, 
https://www.databasemart.com/blog/langchain-vs-llamaindex 47. LangChain vs LlamaIndex: 
What's the Best Framework for LLM Development? - Kanerika, 
https://kanerika.com/blogs/langchain-vs-llamaindex/ 48. Better Call GPT, Comparing Large 
Language Models Against Lawyers - arXiv, https://arxiv.org/html/2401.16212v1 49. Hallucinating 
Law: Legal Mistakes with Large Language Models are Pervasive, 
https://hai.stanford.edu/news/hallucinating-law-legal-mistakes-large-language-models-are-perva
sive 50. Embedding models for caselaw : r/Rag - Reddit, 
https://www.reddit.com/r/Rag/comments/1nf2uf8/embedding_models_for_caselaw/ 51. 
Advanced RAG Techniques: What They Are & How to Use Them - FalkorDB, 
https://www.falkordb.com/blog/advanced-rag/ 52. Advanced RAG Techniques. 
Retrieval-Augmented Generation (RAG)… | by Yugank .Aman | Medium, 
https://medium.com/@yugank.aman/advanced-rag-techniques-0c283aacf5ba 53. Natural 
Language Processing in Legal Tech (Chapter 3) - Cambridge University Press, 
https://www.cambridge.org/core/books/legal-tech-and-the-future-of-civil-justice/natural-language
-processing-in-legal-tech/963F237942CA584BA07791DB6DFAF3EA 54. Natural Legal 
Language Processing at JHU, https://nlp.jhu.edu/law/ 55. How Governments Use AI to Combat 

Page 15 of 15

Corruption and Ensure Transparency?, 
https://www.zealousys.com/blog/how-governments-use-ai-to-combat-corruption-and-ensure-tran
sparency/ 56. How AI can reshape anti-corruption compliance | International Bar Association, 
https://www.ibanet.org/how-AI-can-reshape-anticorruption-compliance 57. Technologies for 
Preventing, Detecting, and Combating Corruption - Asia-Pacific Economic Cooperation, 
https://www.apec.org/docs/default-source/publications/2025/6/225_psu_apec-anti-corruption-tec
hnologies-report.pdf?sfvrsn=3f591235_1 58. Retrieval-Augmented Generation with Vector 
Stores, Knowledge Graphs, and Hierarchical Non-negative Matrix Factorization - arXiv, 
https://arxiv.org/html/2502.20364v1 59. Automated Creation of the Legal Knowledge Graph 
Addressing Legislation on Violence Against Women: Resource, Methodology and Lessons 
Learned - arXiv, https://arxiv.org/html/2508.06368v1 60. Stanford Study Reveals Challenges of 
RAG in Legal AI Tools, https://blog.prevail.ai/rag-legal-ai-stanford-study/ 61. Why some Aussie 
lawyers are being reprimanded for using AI - The Daily Aus, 
https://thedailyaus.com.au/crime/aussie-lawyers-are-being-reprimanded-for-using-ai-20-08-2025 
62. How Legalbenchmarks.ai Built a Domain-Specific AI Benchmark | Label Studio, 
https://labelstud.io/blog/how-legalbenchmarks-ai-built-a-domain-specific-ai-benchmark/ 63. Vals 
Legal AI Report, https://www.vals.ai/vlair 64. Lawyer caught using AI-generated false citations in 
court case penalised in Australian first, 
https://www.theguardian.com/law/2025/sep/03/lawyer-caught-using-ai-generated-false-citations-
in-court-case-penalised-in-australian-first 65. First Australian lawyer penalised for AI blunder - 
Information Age | ACS, 
https://ia.acs.org.au/article/2025/first-australian-lawyer-penalised-for-ai-blunder.html 66. 
Statement on the use of artificial intelligence in Australian legal practice - LPBWA, 
https://www.lpbwa.org.au/artificial-intelligence-joint-statement 67. Statement on the use of 
artificial intelligence in Australian legal practice | VLSB+C, 
https://www.lsbc.vic.gov.au/news-updates/news/statement-use-artificial-intelligence-australian-le
gal-practice