To extract PII instances and their relationships to data owners from textual data, we implemented an NLP-based pipeline called
PrivGrapher. Owing to the computational complexity and resource limitations associated with concurrently processing entire large-scale datasets, we adopted a segmentation approach that leverages inherent data attributes and semantic boundaries. For example, Twitter data (
https://x.com) can be segmented into individual posts, i.e., tweets, whereas novels or textbooks can be split into paragraphs or chapters. After PrivGraphs are constructed from each data segment, those representing the same individual are subsequently merged.
Figure 3 presents an overview of the
PrivGrapher pipeline. First,
PrivGrapher extracts the target PII instances from the dataset and categorizes them according to their PII data type. Next, PII data types are classified as either direct or indirect identifiers. Based on this classification, the Individual Recognition module is applied to identify distinct individuals within the dataset. As shown in
Figure 3, the individuals
Harry and
Ron are identified from the provided data. Following this, the relationship annotation module assigns the remaining indirect PII to their corresponding owners. As mentioned at the beginning of this section, PrivGraphs representing the same individual are then merged. Finally, these merged PrivGraphs are enriched with parent PII concepts to facilitate the hierarchical demographic abstraction of private information. The remainder of this section describes the implementation of each step in
PrivGrapher in detail.
5.1. NLP-Based Named Entity Recognition
In the first stage,
PrivGrapher identifies the target PII instances following the established PII data type categorization specified in
Section 4.2. To mitigate the data availability problem, we first classified the identified PII into structured, unstructured, and semi-structured types based on their typical data formats and intrinsic properties.
Structured PII. Structured PII exhibits a fixed language pattern. For example, an email would follow the “username@domain.com” format, while a telephone number would typically follow the structure “XXX-XXXX-XXXX”.
Unstructured PII. Identifying PII is particularly challenging in unstructured text, where the absence of a fixed schema forces detection models to rely heavily on complex contextual cues. For example, names, addresses, or nationalities can appear in numerous, varied, and unexpected ways when embedded within large blocks of unstructured text.
Semi-structured PII. Semi-structured PII is characterized by its adherence to certain linguistic patterns. However, accurate identification requires an understanding of context. For example, while age is commonly expressed using one or two digits, a standalone numerical figure is not definitively a person’s age without further contextual clues.
Next,
PrivGrapher identifies the target PII using both regular expressions [
24] and NER [
12]. Specifically, regular expressions are chosen for certain tasks because of their processing speed and lack of training requirements. However, because they only match superficial patterns and overlook contextual or semantic information, their application is directed towards extracting PII that is structured and context-independent, i.e., structured PII. For unstructured PII that do not follow any predefined formats, or PII that require surrounding information for identification (i.e., semi-structured PII),
PrivGrapher utilizes an NER model to understand and detect contextual information. The system’s NER component is specifically built using the spaCy library [
41] with its RoBERTa-based NLP pipeline [
41].
As discussed in the previous section, training an NER model requires a large quantity of labeled training data, which is a resource-intensive task. To avoid creating a dataset from scratch, we employed a programmatically generated synthetic corpus for training the NER model. To generate training data, we first created templates for each type of unstructured and semi-structured PII. For example, for
NAME, we first created a list of templates such as “%NAME%, (born|born in|born on) %DATE_OF_BIRTH%, {SUBJECT_PRONOUN} is a …” After generating permutations of these templates, we obtained 13,644 template instances. Next, we extracted PII instances from existing sources to fill the placeholders in these expanded templates. For unstructured PII, we retrieved the corresponding PII instances from publicly available sources on the Internet to replace placeholders within the expanded templates. For example, for
NAMES, we collected human names from the NAMES corpus dataset (
https://www.kaggle.com/); for
NATIONALITIES, we sourced country names from Wikipedia (
https://www.wikipedia.org/). For the semi-structured PII, placeholders were populated by programmatically generated data. This procedure resulted in a dataset comprising 1,001,954 training records, 134,600 testing records, and 134,600 validation records. The programmatic creation of our synthetic data allowed the automatic assignment of labels to every named entity.
5.3. Individual Recognition
Because it is common for real-world datasets to contain information on several individuals within a single data segment, we analyzed the presence of individuals in each data segment based on direct and indirect identifiers to determine the number of unique individuals.
For direct identifiers, PrivGrapher first queries existing PrivGraphs to determine if the encountered PII instance is already associated with an individual. If a matching record is located, an additional entry is appended to that PrivGraph to continue tracking the position of the record. If no such record exists in the current PrivGraphs, a new PrivGraph is initiated. In this case, an owns edge is created to link the direct identifier instance to the relevant individual node. If ownership cannot be clearly determined through these steps, the Relationship Annotator is utilized to identify the correct owner.
For indirect identifiers, we used the Relationship Annotator to determine their corresponding owner, i.e., the corresponding PrivGraph.
5.4. Relationship Annotation
The goal of relationship annotation is to associate PII instances with their corresponding owners, i.e., PrivGraphs. This includes analyzing the presence and interrelationships of identifiers within a data segment to determine the presence of additional individuals. Similar to the NER model in
PrivGrapher, relationship annotation primarily employs two methodologies: rule-based matching and deep learning-based methods. The relationship annotator in
PrivGrapher combines the strengths of two distinct methods: the accuracy and efficiency of rule-based systems and the flexibility and adaptability of deep learning-based models. Specifically, relationship annotation leverages Part-Of-Speech (POS) tags and syntactic dependencies [
41] to analyze the relationships between identified PII instances and their associated individuals. When rule-based methods fail to extract relationships from the text, a classification model is trained to predict the corresponding owner.
We initiated the relationship annotation process by resolving textual references, i.e., identifying the antecedents of pronouns like “he” and “her”. This task is known as coreference resolution in NLP. For this purpose, we utilized the NLP-based F-coref model [
42], which provides an effective balance between accuracy and computational speed. One advantage of the F-coref model is that it is trained on a broad dataset, allowing its immediate application to coreference resolution tasks without requiring additional fine-tuning.
Next, we assign the corresponding owner to each PII instance. This task is different from traditional relation extraction in NLP, because the objective of relationship annotation is to ascertain whether an identified PII can be accurately linked to an individual [
43], regardless of the specific nature of their connection. For example, a person can “live at", “maintain", or even “not reside at” a home address. Since all such relationships can potentially disclose personal information, we normalized their representation by constructing an
owns edge between the PII and individual within the PrivGraph.
We treat PII instances that have already been assigned an owner as annotation targets. Once we determine that a candidate PII instance and target PII instance belong to the same individual, we link the candidate to the matching target. For example, if a PII instance [NAME] has already been associated with an individual, and a subsequent PII instance [EMAIL ADDRESS] is identified as belonging to the same individual, we append the new PII instance to the existing PrivGraph.
PrivGrapher’s rule-based matching strategy utilizes both dependency parsing and Part-of-Speech tagging [
41] to systematically analyze sentence structures and pinpoint entities acting as subjects. As outlined in Algorithm 1, the procedure requires four primary inputs: the initial entity
, the set of candidate target entities
, and syntactic dependency tags
(subject relations) and
(modifiers or attributes). The algorithm identifies the target entity
through an iterative traversal of the dependency tree, starting from
and moving upward toward the root. In each iteration, the algorithm checks if
belongs to the target entity set
and possesses a dependency tag within
or
. If both conditions are met,
is returned as the target entity
. Second, if the current token is identified as a functional head, specifically a
or an auxiliary
, the algorithm performs a downward search among its children. If no match is found at the current level, the algorithm assigns
to its parent (
) and continues the search. The process terminates when the target entity is found or when the traversal reaches the
of the dependency tree without a match. By evaluating the starting entity before climbing and unifying the handling of verbal and auxiliary heads, this hierarchical approach effectively captures subject-object relationships across various sentence types, including copula constructions and interrogative forms.
| Algorithm 1: Rule-based Relationship Annotation |
Input: Initial entity , Entity set , Dependency sets . Output: Target Entity or . while True do /* 1. Check if current token is a subject or modifier */ if and then return end if /* 2. If token is a verb or auxiliary, search children for subject */ if or then for each do if and then return end if end for end if /* 3. Exit if ROOT is reached, otherwise move up the tree */ if or then BREAK LOOP end if end while return
|
However, owing to the complexity of natural language and the diversity of expression, rule-based techniques are restricted to analyzing general, predefined sentence patterns. PrivGrapher employs a deep learning methodology to overcome this limitation when examining relationships in complex sentences that do not adhere to these fixed rules. Specifically, the deep learning-based Relationship Annotator operates by attaching a binary classification head to a RoBERTa transformer model [
41]. This allows the system to ascertain if a relationship exists between two entities by analyzing their surrounding contextual data. The data produced during NER training primarily details specific individuals. This information is then organized and merged to create extended sentences featuring multiple individuals, which are used to train the relationship annotator. If the model identifies a PII instance with a pre-existing record in a PrivGraph, this new instance is integrated into that same graph. However, if none of the PII within the current data segment are linked to any existing PrivGraph, a new graph is initiated, and an
owns edge is created from the relevant identifier.