Legal Prompting - RAG and its risks in the legal domain
S01:E04

Legal Prompting - RAG and its risks in the legal domain

Episode description

In this episode, we talk about RAG — Retrieval-Augmented Generation — in the legal domain. What it is, how it works, and, most importantly, what risks it introduces for the legal professional.

RAG allows a model to work with documents provided by the user rather than relying solely on its training data. The idea is powerful, but the process conceals concrete pitfalls: retrieval based on linguistic rather than legal similarity, document fragmentation that breaks argumentative structure, outdated sources retrieved without validity checks, opacity in how fragments are used, and implications for professional secrecy.

Four practical safeguards: verify the sources, check the segmentation, choose the infrastructure carefully, and document every use.

Subscribe to the newsletter at nicfab.eu

Download transcript (.vtt)
0:09

Welcome back to the NicFab Podcast dedicated to legal prompting.

0:15

I am Nicola Fabiano and this is the second episode.

0:18

Last time we talked about privacy notices, how to check them,

0:25

simplify them and adapt them to different contexts.

0:28

At the end of that episode, I introduced a topic that shifts our perspective.

0:35

We are no longer talking about how to write a prompt,

0:40

but about how the model finds the information it works with.

0:44

We are talking about RAC, Retrieval Augmented Generation.

0:49

What is RAC?

0:50

RAC is an architecture. It works like this.

0:54

Instead of relying only on what the model learned during training,

0:59

the system retrieves documents from an external knowledge base

1:03

and inserts them into the context of your request.

1:07

The model then generates its response based on those documents.

1:12

In practice, you load a collection of materials, regulatory decisions,

1:17

contracts, legal opinions, legislation, and the system indexes them.

1:24

When you ask a question, the retrieval engine selects the most relevant fragments

1:29

and passes them to the model.

1:32

The model responds based on those fragments.

1:36

The idea is powerful.

1:38

You no longer depend on the model's memory, which can be inaccurate or outdated.

1:44

You work with your own documents, your own sources.

1:49

For a legal professional, this seems like the ideal solution.

1:53

It seems like it, but there are risks.

1:57

The risks are the following.

2:00

The first risk is retrieval quality.

2:03

The system does not search the way a lawyer would.

2:08

It uses semantic similarity.

2:10

It selects fragments that linguistically resemble the question, not legally.

2:18

If you ask about legitimate interest,

2:21

the system might return a fragment that mentions it

2:25

but in a completely different context.

2:28

The result is an answer that looks well-founded

2:31

but rests on an irrelevant fragment.

2:34

The second risk is fragmentation.

2:38

Documents are split into blocks, chunks, in technical terms, for indexing.

2:46

A supervisory authority decision is not a sequence of independent blocks.

2:52

It has an argumentative structure.

2:55

The premise shapes the conclusion.

2:58

If the system extracts only the conclusion without the premise,

3:03

the model works with an incomplete piece.

3:07

And it generates answers that lose the reasoning.

3:12

The third risk is outdated sources.

3:16

If your document base contains a repealed regulation or a superseded clause,

3:22

the system does not know.

3:24

It does not check validity.

3:26

It does not compare dates.

3:28

It retrieves the fragment most similar to the question,

3:32

even if it is no longer in force.

3:35

In the regulatory field, where amendments are frequent

3:39

and the differences between versions can be decisive,

3:43

this is particularly dangerous.

3:46

The fourth risk is opacity.

3:49

When the model responds using RUG,

3:52

it is not always clear which fragments it used.

3:56

Some systems show the sources, others do not.

4:00

But even when sources are shown,

4:03

you do not know how the model combined them,

4:07

which ones it prioritized, which ones it ignored.

4:11

This lack of transparency is a real problem.

4:15

A lawyer must be able to reconstruct the reasoning

4:18

with RUG that is often not possible.

4:22

The fifth risk concerns professional secrecy.

4:27

If you load confidential materials into a RUG platform,

4:32

where does that data go?

4:33

Who processes it? Where is it stored?

4:36

The infrastructure behind RUG is not just a technical issue.

4:41

It is a professional ethics issue.

4:44

And in many cases, it is a matter of GDPR and AI Act compliance.

4:51

The safeguards.

4:53

This does not mean RUG is useless.

4:57

Far from it, it means it must be used with awareness.

5:01

First safeguard.

5:04

Always verify the sources.

5:06

Do not trust the answer.

5:09

Read the fragments the system retrieved.

5:12

Check that they are relevant, complete and current.

5:16

Second safeguard.

5:17

Check the segmentation.

5:19

How are documents being split?

5:22

Do the chunks respect the logical structure of the text,

5:26

or do they cut it arbitrarily?

5:30

Poorer segmentation produces poorer retrieval.

5:34

Third safeguard.

5:36

Choose the infrastructure carefully.

5:39

Where does the data reside?

5:41

Who has access?

5:42

Are there contractual guarantees?

5:45

RUG, more than any other use of AI in law,

5:49

requires a serious infrastructure assessment.

5:54

Fourth safeguard.

5:56

Document everything.

5:57

If you use a RUG system to prepare an opinion or analyze a contract,

6:03

record the sources retrieved, the question asked and the answer received.

6:08

This is a matter of professional responsibility.

6:13

My closing remarks.

6:15

RUG promises to solve the root cause of the problem.

6:19

In part, it does.

6:21

But it introduces new risks.

6:24

Imprecise retrieval, fragmentation, outdated sources,

6:29

opacity and exposure of confidential data.

6:33

Legal prompting applied to RUG is not just about writing the right prompt.

6:38

It is about understanding what happens before the model generates its response

6:44

and taking professional responsibility for the result.

6:50

Next time, we will talk about advanced prompting techniques,

6:54

chain of thought and few-shot applied to legal reasoning.

6:59

Subscribe to the newsletter at nickfab.eu.

7:04

Thank you for listening.

7:05

Until the next episode.