WaguyMZ commited on
Commit
f03ba44
·
verified ·
1 Parent(s): 1a9c498

ForensicBench unlabelled ledgers, loader, submission validator and card

Browse files
README.md ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: ForensicBench Ledgers
3
+ language:
4
+ - en
5
+ tags:
6
+ - fraud-detection
7
+ - accounting
8
+ - journal-entries
9
+ - agents
10
+ - benchmark
11
+ - synthetic
12
+ size_categories:
13
+ - 1M<n<10M
14
+ configs:
15
+ - config_name: je_header
16
+ data_files:
17
+ - split: energy
18
+ path: data/energy/je_header.parquet
19
+ - split: healthcare
20
+ path: data/healthcare/je_header.parquet
21
+ - split: luxurygoods
22
+ path: data/luxurygoods/je_header.parquet
23
+ - split: manufacturing
24
+ path: data/manufacturing/je_header.parquet
25
+ - split: transport
26
+ path: data/transport/je_header.parquet
27
+ - config_name: je_line
28
+ data_files:
29
+ - split: energy
30
+ path: data/energy/je_line.parquet
31
+ - split: healthcare
32
+ path: data/healthcare/je_line.parquet
33
+ - split: luxurygoods
34
+ path: data/luxurygoods/je_line.parquet
35
+ - split: manufacturing
36
+ path: data/manufacturing/je_line.parquet
37
+ - split: transport
38
+ path: data/transport/je_line.parquet
39
+ - config_name: chart_of_accounts
40
+ data_files:
41
+ - split: energy
42
+ path: data/energy/chart_of_accounts.parquet
43
+ - split: healthcare
44
+ path: data/healthcare/chart_of_accounts.parquet
45
+ - split: luxurygoods
46
+ path: data/luxurygoods/chart_of_accounts.parquet
47
+ - split: manufacturing
48
+ path: data/manufacturing/chart_of_accounts.parquet
49
+ - split: transport
50
+ path: data/transport/chart_of_accounts.parquet
51
+ - config_name: vendors
52
+ data_files:
53
+ - split: energy
54
+ path: data/energy/vendors.parquet
55
+ - split: healthcare
56
+ path: data/healthcare/vendors.parquet
57
+ - split: luxurygoods
58
+ path: data/luxurygoods/vendors.parquet
59
+ - split: manufacturing
60
+ path: data/manufacturing/vendors.parquet
61
+ - split: transport
62
+ path: data/transport/vendors.parquet
63
+ - config_name: customers
64
+ data_files:
65
+ - split: energy
66
+ path: data/energy/customers.parquet
67
+ - split: healthcare
68
+ path: data/healthcare/customers.parquet
69
+ - split: luxurygoods
70
+ path: data/luxurygoods/customers.parquet
71
+ - split: manufacturing
72
+ path: data/manufacturing/customers.parquet
73
+ - split: transport
74
+ path: data/transport/customers.parquet
75
+ - config_name: employees
76
+ data_files:
77
+ - split: energy
78
+ path: data/energy/employees.parquet
79
+ - split: healthcare
80
+ path: data/healthcare/employees.parquet
81
+ - split: luxurygoods
82
+ path: data/luxurygoods/employees.parquet
83
+ - split: manufacturing
84
+ path: data/manufacturing/employees.parquet
85
+ - split: transport
86
+ path: data/transport/employees.parquet
87
+ ---
88
+
89
+ # ForensicBench Ledgers
90
+
91
+ Unlabelled synthetic general ledgers for **ForensicBench**, a benchmark that evaluates whether
92
+ agentic LLMs can discover and type coordinated journal-entry fraud schemes over a live ledger
93
+ (EMNLP 2026 Industry Track).
94
+
95
+ Five sector ledgers (Energy, Healthcare, Luxury Goods, Manufacturing, Transport), about 300K
96
+ journal entries each (1.51M in total) over three years, in EUR under the French Plan Comptable General (PCG).
97
+ Five multi-entry fraud scheme types are injected into each ledger. **No fraud label is distributed here**:
98
+ labels live in a private store and are used only by the automatic scorer.
99
+
100
+ ## Content
101
+
102
+ `data/<sector>/<table>.parquet`, with the tables below (one split per sector in the dataset viewer):
103
+
104
+ | Table | Description |
105
+ |---|---|
106
+ | `je_header` | one row per journal entry (document id, dates, type, business process, creator) |
107
+ | `je_line` | entry lines (GL account, debit, credit, auxiliary account, lettrage) |
108
+ | `chart_of_accounts` | PCG account tree |
109
+ | `vendors`, `customers`, `employees` | master data |
110
+
111
+ The HR payroll table used in the paper (`hr_employees`) is documented in the schema of the reference
112
+ harness but is access-controlled there; it is not distributed.
113
+
114
+ ## Use with PostgreSQL
115
+
116
+ The reference agent queries a read-only PostgreSQL database. To rebuild one sector:
117
+
118
+ ```bash
119
+ pip install pandas pyarrow psycopg2-binary
120
+ python tools/load_postgres.py --sector energy --dsn "dbname=forensicbench_energy user=postgres"
121
+ ```
122
+
123
+ ## Task and submission
124
+
125
+ An agent investigates each ledger and flags fraudulent journal entries with a scheme type from:
126
+ `fictitious_ap_disbursements`, `revenue_manipulation`, `vendor_collusion`, `shadow_payroll`, `inventory_manipulation`.
127
+
128
+ Each model is run on the 5 sectors with 5 replicates (25 runs). A submission is a CSV with one row per flag (`replicate` is only needed for the multi run format):
129
+
130
+ | Column | Meaning |
131
+ |---|---|
132
+ | `sector` | one of the five sectors |
133
+ | `replicate` | replicate index of the run |
134
+ | `document_id` | `je_header.document_id` of the flagged entry |
135
+ | `scheme_type` | one of the five scheme types, or `unknown` (counts for Entry-F1 only) |
136
+ | `rationale` | optional free text |
137
+
138
+ Check a file before submitting: `python tools/validate_submission.py my_flags.csv`.
139
+
140
+ ## Metrics
141
+
142
+ - **Entry-F1** (primary): F1 over flagged journal entries.
143
+ - **Type-F1**: an entry counts only if its scheme type is also correct (at most Entry-F1).
144
+ - **Coverage**: share of each fraud family recovered, averaged over families.
145
+ - **Consistency**: stability of Entry-F1 across the 5 replicates (0 to 100).
146
+
147
+ Entries are ranked by Entry-F1, then Type-F1, Recall, Precision, Coverage and Consistency (no composite score).
148
+ Per-sector scores are averaged over replicates, then macro-averaged over sectors.
149
+
150
+ ## Leaderboard and submissions
151
+
152
+ Leaderboard, submission form and scoring: https://waguy02.github.io/PHD-Research-Website/forensicbench/leaderboard/
153
+
154
+ Two formats are accepted: a **single run** (one run per sector, no standard deviation) or a **multi run**
155
+ (same replicates in every sector, reported as mean, standard deviation and Consistency). Each submission must come
156
+ with the code of its harness (repository URL and commit hash, or an archive); entries are unverified until a
157
+ maintainer has reviewed it.
158
+
159
+ ## Citation
160
+
161
+ ```bibtex
162
+ @inproceedings{waffo2026forensicbench,
163
+ title={ForensicBench: Evaluating Agentic LLMs on Journal-Entry Fraud Detection},
164
+ author={Waffo Dzuyo, Guy Stephane and Guibon, Ga{\"e}l and Cerisara, Christophe and Belmar-Letelier, Luis},
165
+ booktitle={EMNLP 2026, Industry Track},
166
+ year={2026}
167
+ }
168
+ ```
data/energy/chart_of_accounts.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4144d0636142d07fd3a45c3617a16f16763a298dfbda7a7b61ee507a177e17cb
3
+ size 20948
data/energy/customers.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b117fbda1c30951ce28bb9309df5ce279e8aaf435def5ea581439588d4e1e0f7
3
+ size 10348
data/energy/employees.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:611242c99ce87bf32f8e06df19ae40fcf233bf238f48f6b80d5a73881393608e
3
+ size 16727
data/energy/je_header.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74129bd4aba8fe8bfc372cec2ba1104c06cb38834df6c6b47bb804130a4db1df
3
+ size 7526689
data/energy/je_line.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f43c429226975ca2ea6b5aec84f70fbfc1be57023996387a51592fe2bc26916
3
+ size 14503157
data/energy/vendors.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c80ac46281c2c39f732f1a34c8f49a68c9ab83454ea137e7725a51b8c5b1a0e
3
+ size 11176
data/healthcare/chart_of_accounts.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4144d0636142d07fd3a45c3617a16f16763a298dfbda7a7b61ee507a177e17cb
3
+ size 20948
data/healthcare/customers.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b76c4f02fd95745e7a82fb60e84b758ec3051be1cb100308b16e819f2290ee0
3
+ size 10304
data/healthcare/employees.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4cc9ebf77a2ceef4e7111429db83c17df52e8f287c8e1f77b320965ac5277eb
3
+ size 16633
data/healthcare/je_header.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:869ddeb345e54669cf062168d3895eba4704540a618f7a55d92e672288e8adbd
3
+ size 7518193
data/healthcare/je_line.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ae88fdb1867ef5752743f8d4e9e8361cf980f456a19f216be6734bcbbe0eadf
3
+ size 14363031
data/healthcare/vendors.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f2d198f3d856eeeebd5f00c4ef0609f47ecdea44eb3f1199f535a82c865af41
3
+ size 11168
data/luxurygoods/chart_of_accounts.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4144d0636142d07fd3a45c3617a16f16763a298dfbda7a7b61ee507a177e17cb
3
+ size 20948
data/luxurygoods/customers.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:67a0f1c3d2b0d2716d4c5e6b77677f4f6f34134686c45fc4491f6fd1a09e84ce
3
+ size 10330
data/luxurygoods/employees.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac29231aebddd44a414f81b11269ff91247f3081250d5c8a57409366cff14f86
3
+ size 16524
data/luxurygoods/je_header.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b56c5c1ca1b586b9549957a11ccfbe50781ae253f445d40108c5f6d76df4783
3
+ size 7505500
data/luxurygoods/je_line.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d2ce394af75f3aeb9eb03e188e4b880d99a350a9cdcac893474635fc0bf3092
3
+ size 14552273
data/luxurygoods/vendors.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:51cad95e32f1ddc02c441ec7c93c1e9c2957aa8057aad0285b89255058868625
3
+ size 11194
data/manufacturing/chart_of_accounts.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4144d0636142d07fd3a45c3617a16f16763a298dfbda7a7b61ee507a177e17cb
3
+ size 20948
data/manufacturing/customers.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c598624c33b17deaa3ebad0f4eb82e0d0eaeaaf3bfb00d2d05ae9339ffa7e5f4
3
+ size 10346
data/manufacturing/employees.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6eae47e5a855e0c94483631f7f246f8ba9b1c728553178860d4fa06f816553ac
3
+ size 16693
data/manufacturing/je_header.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15642d8ce3c7b5774ec0d21948a4a07f61f4115017d6645faeccaec1fbacc9b2
3
+ size 7616504
data/manufacturing/je_line.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c254c24c44f599ea83c729376470be962fb407f399bb0a21d33a6c4a08566d5e
3
+ size 14102434
data/manufacturing/vendors.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:167a8630f36e72c96a394d1e5d20aab624a5fe7ab92b81b77261ac2c4e43b1e8
3
+ size 11197
data/transport/chart_of_accounts.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4144d0636142d07fd3a45c3617a16f16763a298dfbda7a7b61ee507a177e17cb
3
+ size 20948
data/transport/customers.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18448bea170e0d0218b1b619443cdd0fec4faacc713f9a8dcee0aaa07efd23a5
3
+ size 10342
data/transport/employees.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:66e4a5677f152e68f3f35eb627050f3a00d122366378804377ed00f88483c80b
3
+ size 16662
data/transport/je_header.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:59cc57d503ea1df86e56f9eb5b3b1ff5275b012af0647387737ef68507f25179
3
+ size 7535552
data/transport/je_line.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3de9596e06fdad71188b2c93eda8d61fa9155b9a46125f553530ead4c4e7f4d7
3
+ size 13910810
data/transport/vendors.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4a337e12b286b67942119c340b661ca3fcc432ca03d86ed7ee7800d586e5660
3
+ size 11143
tools/load_postgres.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Load one ForensicBench sector into a PostgreSQL database.
2
+
3
+ Usage:
4
+ python tools/load_postgres.py --sector energy --dsn "dbname=forensicbench_energy user=postgres"
5
+
6
+ The database must already exist. Tables are created from the parquet schemas.
7
+ Requires: pandas, pyarrow, psycopg2-binary.
8
+ """
9
+ import argparse, io
10
+ import pandas as pd
11
+ import pyarrow.parquet as pq
12
+ import psycopg2
13
+
14
+ PG_TYPES = {"string": "text", "large_string": "text", "int64": "bigint", "int32": "integer",
15
+ "double": "double precision", "float": "real", "bool": "boolean",
16
+ "date32[day]": "date"}
17
+ TABLES = ["je_header", "je_line", "chart_of_accounts", "vendors", "customers", "employees"]
18
+
19
+ def pg_type(arrow_type) -> str:
20
+ s = str(arrow_type)
21
+ if s.startswith("timestamp"):
22
+ return "timestamp"
23
+ return PG_TYPES.get(s, "text")
24
+
25
+ def main():
26
+ ap = argparse.ArgumentParser()
27
+ ap.add_argument("--sector", required=True, choices=["energy", "healthcare", "luxurygoods", "manufacturing", "transport"])
28
+ ap.add_argument("--dsn", required=True)
29
+ ap.add_argument("--data-dir", default="data")
30
+ args = ap.parse_args()
31
+ conn = psycopg2.connect(args.dsn)
32
+ cur = conn.cursor()
33
+ for t in TABLES:
34
+ path = f"{args.data_dir}/{args.sector}/{t}.parquet"
35
+ schema = pq.read_schema(path)
36
+ cols = ", ".join(f'"{f.name}" {pg_type(f.type)}' for f in schema)
37
+ cur.execute(f'DROP TABLE IF EXISTS {t} CASCADE')
38
+ cur.execute(f'CREATE TABLE {t} ({cols})')
39
+ df = pd.read_parquet(path)
40
+ buf = io.StringIO()
41
+ df.to_csv(buf, index=False, header=False, na_rep="\\N")
42
+ buf.seek(0)
43
+ cur.copy_expert(f"COPY {t} FROM STDIN WITH (FORMAT csv, NULL '\\N')", buf)
44
+ print(f"{t}: {len(df)} rows")
45
+ cur.execute("CREATE INDEX IF NOT EXISTS je_line_doc ON je_line (document_id)")
46
+ cur.execute("CREATE INDEX IF NOT EXISTS je_header_doc ON je_header (document_id)")
47
+ conn.commit()
48
+ conn.close()
49
+
50
+ if __name__ == "__main__":
51
+ main()
tools/validate_submission.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Check a ForensicBench submission file before uploading it.
2
+
3
+ Usage:
4
+ python tools/validate_submission.py my_flags.csv --data-dir data
5
+
6
+ Expected columns: sector, document_id, scheme_type, plus replicate for the multi run format
7
+ (`rationale` is optional). Sectors: energy, healthcare, luxurygoods, manufacturing, transport.
8
+ Scheme types: fictitious_ap_disbursements, revenue_manipulation, vendor_collusion,
9
+ shadow_payroll, inventory_manipulation.
10
+ """
11
+ import argparse, sys
12
+ import pandas as pd
13
+
14
+ SECTORS = ["energy", "healthcare", "luxurygoods", "manufacturing", "transport"]
15
+ TYPES = {"fictitious_ap_disbursements", "revenue_manipulation", "vendor_collusion", "shadow_payroll", "inventory_manipulation", "unknown"}
16
+
17
+ def main():
18
+ ap = argparse.ArgumentParser()
19
+ ap.add_argument("file")
20
+ ap.add_argument("--data-dir", default="data")
21
+ a = ap.parse_args()
22
+ df = pd.read_csv(a.file, dtype=str) if a.file.endswith(".csv") else pd.read_json(a.file, lines=True, dtype=str)
23
+ errors = []
24
+ for c in ["sector", "document_id", "scheme_type"]:
25
+ if c not in df.columns:
26
+ errors.append(f"missing column: {c}")
27
+ if errors:
28
+ print("\n".join(errors)); sys.exit(1)
29
+ bad = set(df["sector"]) - set(SECTORS)
30
+ if bad: errors.append(f"unknown sectors: {sorted(bad)}")
31
+ bad = set(df["scheme_type"]) - TYPES
32
+ if bad: errors.append(f"unknown scheme types: {sorted(bad)}")
33
+ for s in sorted(set(df["sector"]) & set(SECTORS)):
34
+ ids = set(pd.read_parquet(f"{a.data_dir}/{s}/je_header.parquet", columns=["document_id"])["document_id"].str.lower())
35
+ sub = df[df["sector"] == s]["document_id"].str.lower()
36
+ unknown = set(sub) - ids
37
+ if unknown:
38
+ print(f"warning: {s}: {len(unknown)} document_id values are not in the ledger (they count as false positives)")
39
+ if len(set(df["sector"]) & set(SECTORS)) < 5:
40
+ errors.append("a submission must cover all 5 sectors")
41
+ if "replicate" in df.columns:
42
+ reps = df.groupby("sector")["replicate"].nunique().to_dict()
43
+ print("replicates per sector:", reps)
44
+ if any(v < 5 for v in reps.values()):
45
+ print("note: the full protocol uses 5 replicates per sector (25 runs)")
46
+ else:
47
+ print("single run format (no replicate column)")
48
+ if errors:
49
+ print("\n".join(errors)); sys.exit(1)
50
+ print("OK")
51
+
52
+ if __name__ == "__main__":
53
+ main()