Skip to content

Commit 6026659

Browse files
authored
Intro changes to scaling articles (#113)
1 parent 21d2b40 commit 6026659

File tree

3 files changed

+156
-47
lines changed

3 files changed

+156
-47
lines changed

docs/case_studies/llm-powered-merging-at-scale/notebook.ipynb

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,47 @@
44
"cell_type": "markdown",
55
"id": "bb0b6427",
66
"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+
]
814
},
915
{
1016
"cell_type": "markdown",
1117
"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+
]
1426
},
1527
{
1628
"cell_type": "markdown",
1729
"id": "03955b64",
1830
"metadata": {},
19-
"source": "## Load Data"
31+
"source": [
32+
"## Load Data"
33+
]
2034
},
2135
{
2236
"cell_type": "code",
37+
"execution_count": null,
2338
"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)",
2539
"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+
]
2848
},
2949
{
3050
"cell_type": "code",
@@ -163,7 +183,11 @@
163183
"cell_type": "markdown",
164184
"id": "d506d52e",
165185
"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+
]
167191
},
168192
{
169193
"cell_type": "code",
@@ -229,7 +253,9 @@
229253
"cell_type": "markdown",
230254
"id": "774d421c",
231255
"metadata": {},
232-
"source": "## Cost"
256+
"source": [
257+
"## Cost"
258+
]
233259
},
234260
{
235261
"cell_type": "code",
@@ -260,13 +286,19 @@
260286
"cell_type": "markdown",
261287
"id": "3fb4297b",
262288
"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+
]
264292
},
265293
{
266294
"cell_type": "markdown",
267295
"id": "e1f2a3b4",
268296
"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+
]
270302
},
271303
{
272304
"cell_type": "code",
@@ -282,7 +314,9 @@
282314
"cell_type": "markdown",
283315
"id": "c1d2e3f4",
284316
"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+
]
286320
},
287321
{
288322
"cell_type": "code",
@@ -342,7 +376,9 @@
342376
"cell_type": "markdown",
343377
"id": "g1h2i3j4",
344378
"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+
]
346382
},
347383
{
348384
"cell_type": "code",
@@ -394,10 +430,15 @@
394430
"cell_type": "markdown",
395431
"id": "k1l2m3n4",
396432
"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+
]
398436
}
399437
],
400438
"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+
},
401442
"kernelspec": {
402443
"display_name": ".venv",
403444
"language": "python",
@@ -414,11 +455,8 @@
414455
"nbconvert_exporter": "python",
415456
"pygments_lexer": "ipython3",
416457
"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."
420458
}
421459
},
422460
"nbformat": 4,
423461
"nbformat_minor": 5
424-
}
462+
}

docs/case_studies/llm-powered-screening-at-scale/notebook.ipynb

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,47 @@
44
"cell_type": "markdown",
55
"id": "bb0b6427",
66
"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+
]
812
},
913
{
1014
"cell_type": "markdown",
1115
"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."
21+
]
1422
},
1523
{
1624
"cell_type": "markdown",
1725
"id": "03955b64",
1826
"metadata": {},
19-
"source": "## Load Data"
27+
"source": [
28+
"## Load Data"
29+
]
2030
},
2131
{
2232
"cell_type": "code",
33+
"execution_count": null,
2334
"id": "2ac7mwmcy7h",
24-
"source": "from dotenv import load_dotenv\nimport pandas as pd\nfrom everyrow import create_session\nfrom everyrow.ops import screen\n\npd.set_option(\"display.max_colwidth\", None)\n\n\nload_dotenv()",
2535
"metadata": {},
26-
"execution_count": null,
27-
"outputs": []
36+
"outputs": [],
37+
"source": [
38+
"from dotenv import load_dotenv\n",
39+
"import pandas as pd\n",
40+
"from everyrow import create_session\n",
41+
"from everyrow.ops import screen\n",
42+
"\n",
43+
"pd.set_option(\"display.max_colwidth\", None)\n",
44+
"\n",
45+
"\n",
46+
"load_dotenv()"
47+
]
2848
},
2949
{
3050
"cell_type": "code",
@@ -211,7 +231,11 @@
211231
"cell_type": "markdown",
212232
"id": "009cd66c",
213233
"metadata": {},
214-
"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."
238+
]
215239
},
216240
{
217241
"cell_type": "code",
@@ -258,13 +282,19 @@
258282
"cell_type": "markdown",
259283
"id": "9882d4b5",
260284
"metadata": {},
261-
"source": "Session URL: https://everyrow.io/sessions/df145a50-2dfd-48c6-97ed-6f82a82bca66"
285+
"source": [
286+
"Session URL: https://everyrow.io/sessions/df145a50-2dfd-48c6-97ed-6f82a82bca66"
287+
]
262288
},
263289
{
264290
"cell_type": "markdown",
265291
"id": "3fb4297b",
266292
"metadata": {},
267-
"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+
]
268298
},
269299
{
270300
"cell_type": "markdown",
@@ -635,6 +665,9 @@
635665
}
636666
],
637667
"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+
},
638671
"kernelspec": {
639672
"display_name": ".venv",
640673
"language": "python",
@@ -651,11 +684,8 @@
651684
"nbconvert_exporter": "python",
652685
"pygments_lexer": "ipython3",
653686
"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."
657687
}
658688
},
659689
"nbformat": 4,
660690
"nbformat_minor": 5
661-
}
691+
}

0 commit comments

Comments
 (0)