You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/case_studies/llm-powered-merging-at-scale/notebook.ipynb
+56-18Lines changed: 56 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -4,27 +4,47 @@
4
4
"cell_type": "markdown",
5
5
"id": "bb0b6427",
6
6
"metadata": {},
7
-
"source": "# LLM-powered Merging at Scale\n\nThe `merge()` function joins two tables using LLM intelligence to match rows that belong together. When table data alone is insufficient, it automatically falls back to web search. This notebook demonstrates merging 2,246 rows where each match may require different levels of investigation."
7
+
"source": [
8
+
"# LLM-powered Merging at Scale\n",
9
+
"\n",
10
+
"The everyrow `merge()` function joins two tables using LLMs, and LLM research agents, to identify matching rows at high accuracy. This notebook demonstrates how this scales to two tables of 2,246 rows. So each row gets LLM-level intelligence and research to find which of the 2,246 rows in the other table is the most likely match.\n",
11
+
"\n",
12
+
"Cost grows super linearly with the number of rows. At small scale (100 to 400 rows) the cost is negligible; at 2,246 x 2,246 rows, this cost $26.80."
13
+
]
8
14
},
9
15
{
10
16
"cell_type": "markdown",
11
17
"id": "mkoy1995el",
12
-
"source": "## Example: Matching 2,246 People to Personal Websites\n\nThis example takes two tables: one with people's names and professional information (position, university, email), and another with a shuffled list of personal website URLs. The task is to determine which website belongs to which person.\n\nMost matches can be resolved by comparing names and emails against URL patterns. But some require web search to confirm ownership when the connection is not obvious from the data alone.",
13
-
"metadata": {}
18
+
"metadata": {},
19
+
"source": [
20
+
"## Example: Matching 2,246 People to Personal Websites\n",
21
+
"\n",
22
+
"This example takes two tables: one with people's names and professional information (position, university, email), and another with a shuffled list of personal website URLs. The task is to determine which website belongs to which person.\n",
23
+
"\n",
24
+
"Most matches can be resolved by comparing names and emails against URL patterns. But some require web search to confirm ownership when the connection is not obvious from the data alone."
25
+
]
14
26
},
15
27
{
16
28
"cell_type": "markdown",
17
29
"id": "03955b64",
18
30
"metadata": {},
19
-
"source": "## Load Data"
31
+
"source": [
32
+
"## Load Data"
33
+
]
20
34
},
21
35
{
22
36
"cell_type": "code",
37
+
"execution_count": null,
23
38
"id": "my38zwvuk2n",
24
-
"source": "import numpy as np\nimport pandas as pd\nfrom everyrow.ops import merge\n\npd.set_option(\"display.max_colwidth\", None)",
25
39
"metadata": {},
26
-
"execution_count": null,
27
-
"outputs": []
40
+
"outputs": [],
41
+
"source": [
42
+
"import numpy as np\n",
43
+
"import pandas as pd\n",
44
+
"from everyrow.ops import merge\n",
45
+
"\n",
46
+
"pd.set_option(\"display.max_colwidth\", None)"
47
+
]
28
48
},
29
49
{
30
50
"cell_type": "code",
@@ -163,7 +183,11 @@
163
183
"cell_type": "markdown",
164
184
"id": "d506d52e",
165
185
"metadata": {},
166
-
"source": "## Run Merge\n\nRun the merge at increasing scales to see how it behaves."
186
+
"source": [
187
+
"## Run Merge\n",
188
+
"\n",
189
+
"Run the merge at increasing scales to see how it behaves."
190
+
]
167
191
},
168
192
{
169
193
"cell_type": "code",
@@ -229,7 +253,9 @@
229
253
"cell_type": "markdown",
230
254
"id": "774d421c",
231
255
"metadata": {},
232
-
"source": "## Cost"
256
+
"source": [
257
+
"## Cost"
258
+
]
233
259
},
234
260
{
235
261
"cell_type": "code",
@@ -260,13 +286,19 @@
260
286
"cell_type": "markdown",
261
287
"id": "3fb4297b",
262
288
"metadata": {},
263
-
"source": "Cost grows super linearly with the number of rows. As the number of rows increases, each match becomes harder because the LLM has more candidates to consider, and more rows require web search to resolve ambiguity. At small scale (100 to 400 rows) the cost is negligible; at 2,246 rows it is $26.80."
289
+
"source": [
290
+
"Cost grows super linearly with the number of rows. As the number of rows increases, each match becomes harder because the LLM has more candidates to consider, and more rows require web search to resolve ambiguity. At small scale (100 to 400 rows) the cost is negligible; at 2,246 rows it is $26.80."
291
+
]
264
292
},
265
293
{
266
294
"cell_type": "markdown",
267
295
"id": "e1f2a3b4",
268
296
"metadata": {},
269
-
"source": "## Inspecting Results\n\nSample matches from the n=800 run."
297
+
"source": [
298
+
"## Inspecting Results\n",
299
+
"\n",
300
+
"Sample matches from the n=800 run."
301
+
]
270
302
},
271
303
{
272
304
"cell_type": "code",
@@ -282,7 +314,9 @@
282
314
"cell_type": "markdown",
283
315
"id": "c1d2e3f4",
284
316
"metadata": {},
285
-
"source": "Most matches are resolved by the LLM alone. It can often match a person to their website by comparing names, emails, and URL patterns without any web search."
317
+
"source": [
318
+
"Most matches are resolved by the LLM alone. It can often match a person to their website by comparing names, emails, and URL patterns without any web search."
319
+
]
286
320
},
287
321
{
288
322
"cell_type": "code",
@@ -342,7 +376,9 @@
342
376
"cell_type": "markdown",
343
377
"id": "g1h2i3j4",
344
378
"metadata": {},
345
-
"source": "For harder cases where the LLM cannot confidently match from the table data alone, everyrow automatically falls back to web search."
379
+
"source": [
380
+
"For harder cases where the LLM cannot confidently match from the table data alone, everyrow automatically falls back to web search."
381
+
]
346
382
},
347
383
{
348
384
"cell_type": "code",
@@ -394,10 +430,15 @@
394
430
"cell_type": "markdown",
395
431
"id": "k1l2m3n4",
396
432
"metadata": {},
397
-
"source": "In this case, there is no obvious connection between \"Charles London\" and `le-big-mac.github.io` from the table data alone. everyrow searched the web, found his Oxford profile and GitHub username, and confirmed the match."
433
+
"source": [
434
+
"In this case, there is no obvious connection between \"Charles London\" and `le-big-mac.github.io` from the table data alone. everyrow searched the web, found his Oxford profile and GitHub username, and confirmed the match."
435
+
]
398
436
}
399
437
],
400
438
"metadata": {
439
+
"everyrow": {
440
+
"description": "Python notebook using LLM-powered merge to match 2,246 people to personal websites. Demonstrates semantic joining at scale with web search fallback."
441
+
},
401
442
"kernelspec": {
402
443
"display_name": ".venv",
403
444
"language": "python",
@@ -414,11 +455,8 @@
414
455
"nbconvert_exporter": "python",
415
456
"pygments_lexer": "ipython3",
416
457
"version": "3.12.6"
417
-
},
418
-
"everyrow": {
419
-
"description": "Python notebook using LLM-powered merge to match 2,246 people to personal websites. Demonstrates semantic joining at scale with web search fallback."
Copy file name to clipboardExpand all lines: docs/case_studies/llm-powered-screening-at-scale/notebook.ipynb
+44-14Lines changed: 44 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -4,27 +4,47 @@
4
4
"cell_type": "markdown",
5
5
"id": "bb0b6427",
6
6
"metadata": {},
7
-
"source": "# LLM-powered Screening at Scale\n\nThe `screen()` function filters a dataframe by applying LLM judgment to every row. Each row is evaluated against natural language criteria, with the LLM determining relevance. This notebook demonstrates screening 10,000 rows where some are trivially relevant or irrelevant while others require deeper analysis."
7
+
"source": [
8
+
"# LLM-powered Screening at Scale\n",
9
+
"\n",
10
+
"The everyrow `screen()` function filters a dataframe by applying LLMs, and LLM research agents, to every row to determine if the criteria are met. This notebook demonstrates how this scales to screening 10,000 rows. Since tricky rows get LLM agents that themselves make dozens of LLM calls, this results in running vastly more LLM calls than is generally feasible without dedicated orchestration or infrastructure. The total cost is ~$0.001 per row."
11
+
]
8
12
},
9
13
{
10
14
"cell_type": "markdown",
11
15
"id": "09zeehb0muql",
12
-
"source": "## Example: Filtering 10,000 FDA Recalls\n\nThis example takes a dataset of FDA product recalls and filters it to find recalls relevant to a specific personal situation: products that might have been used for a child born on a particular date. The screening task requires understanding product types, typical use cases, and timing to determine which recalls matter.",
13
-
"metadata": {}
16
+
"metadata": {},
17
+
"source": [
18
+
"## Example: Filtering 10,000 FDA Recalls\n",
19
+
"\n",
20
+
"This example takes a dataset of FDA product recalls and filters it to find recalls relevant to a specific personal situation: products that might have been used for a child born on a particular date. The screening task requires understanding product types, typical use cases, and timing to determine which recalls matter."
"source": "## Define Screen Task\n\nThe screening criteria specify finding recalls of products that might have been used for a child born on 2021-08-01."
234
+
"source": [
235
+
"## Define Screen Task\n",
236
+
"\n",
237
+
"The screening criteria specify finding recalls of products that might have been used for a child born on 2021-08-01."
"source": "### Cost\n\nThis run cost $12.10, averaging around $0.001 per row."
293
+
"source": [
294
+
"### Cost\n",
295
+
"\n",
296
+
"This run cost $12.10, averaging around $0.001 per row."
297
+
]
268
298
},
269
299
{
270
300
"cell_type": "markdown",
@@ -635,6 +665,9 @@
635
665
}
636
666
],
637
667
"metadata": {
668
+
"everyrow": {
669
+
"description": "Python notebook using LLM agents to screen 10,000 FDA product recalls for personal relevance. Demonstrates intelligent filtering at scale."
670
+
},
638
671
"kernelspec": {
639
672
"display_name": ".venv",
640
673
"language": "python",
@@ -651,11 +684,8 @@
651
684
"nbconvert_exporter": "python",
652
685
"pygments_lexer": "ipython3",
653
686
"version": "3.12.6"
654
-
},
655
-
"everyrow": {
656
-
"description": "Python notebook using LLM agents to screen 10,000 FDA product recalls for personal relevance. Demonstrates intelligent filtering at scale."
0 commit comments