File size: 23,976 Bytes
a4f0b42
 
a6ca97a
9ae4f35
a6ca97a
9ae4f35
a6ca97a
9ae4f35
 
 
 
 
a4f0b42
9ae4f35
 
 
 
 
 
 
 
 
 
 
 
9bf16db
 
 
 
53b4049
 
 
 
7f7303d
 
 
 
a2e36bc
 
 
 
0502282
 
 
 
0ecb4de
 
 
 
9ae4f35
 
 
 
 
 
 
 
a64708c
 
 
 
4dc6908
 
 
 
4c5c090
 
 
 
027ef49
 
 
 
7293021
 
 
 
c2dd3cc
 
 
 
9ae4f35
219a57a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4664e3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1cd68ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
747ef88
9ae4f35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
747ef88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9c2615e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8fdae60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
600be37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fdf38ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8acc1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6bf2c29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a042e75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182c198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f71cd41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dd078d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44680d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a4f0b42
a6ca97a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
---
license: apache-2.0
task_categories:
- text-generation
language:
- en
tags:
- long-context
- procedural-generation
- benchmark
- evaluation
pretty_name: 'LongProc: Long Procedural Generation Benchmark'
configs:
- config_name: countdown_0.5k
  data_files:
  - split: test
    path: countdown_0.5k/test-*
- config_name: countdown_2k
  data_files:
  - split: test
    path: countdown_2k/test-*
- config_name: countdown_8k
  data_files:
  - split: test
    path: countdown_8k/test-*
- config_name: html_to_tsv_0.5k
  data_files:
  - split: test
    path: html_to_tsv_0.5k/test-*
- config_name: html_to_tsv_2k
  data_files:
  - split: test
    path: html_to_tsv_2k/test-*
- config_name: html_to_tsv_8k
  data_files:
  - split: test
    path: html_to_tsv_8k/test-*
- config_name: path_traversal_0.5k
  data_files:
  - split: test
    path: path_traversal_0.5k/test-*
- config_name: path_traversal_2k
  data_files:
  - split: test
    path: path_traversal_2k/test-*
- config_name: path_traversal_8k
  data_files:
  - split: test
    path: path_traversal_8k/test-*
- config_name: pseudo_to_code_0.5k
  data_files:
  - split: test
    path: pseudo_to_code_0.5k/test-*
- config_name: pseudo_to_code_2k
  data_files:
  - split: test
    path: pseudo_to_code_2k/test-*
- config_name: tom_tracking_0.5k
  data_files:
  - split: test
    path: tom_tracking_0.5k/test-*
- config_name: tom_tracking_2k
  data_files:
  - split: test
    path: tom_tracking_2k/test-*
- config_name: tom_tracking_8k
  data_files:
  - split: test
    path: tom_tracking_8k/test-*
- config_name: travel_planning_2k
  data_files:
  - split: test
    path: travel_planning_2k/test-*
- config_name: travel_planning_8k
  data_files:
  - split: test
    path: travel_planning_8k/test-*
- config_name: travel_planning_icl_examples
  data_files:
  - split: test
    path: travel_planning_icl_examples/test-*
dataset_info:
- config_name: countdown_0.5k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 3548952
    num_examples: 200
  download_size: 408756
  dataset_size: 3548952
- config_name: countdown_2k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 4299610
    num_examples: 200
  download_size: 557786
  dataset_size: 4299610
- config_name: countdown_8k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 6816325
    num_examples: 200
  download_size: 1012154
  dataset_size: 6816325
- config_name: html_to_tsv_0.5k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 11123701
    num_examples: 100
  download_size: 2455321
  dataset_size: 11123701
- config_name: html_to_tsv_2k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 32637641
    num_examples: 189
  download_size: 7035053
  dataset_size: 32637641
- config_name: html_to_tsv_8k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 34465586
    num_examples: 120
  download_size: 7111617
  dataset_size: 34465586
- config_name: path_traversal_0.5k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 2430029
    num_examples: 200
  download_size: 498807
  dataset_size: 2430029
- config_name: path_traversal_2k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 7881106
    num_examples: 200
  download_size: 1868730
  dataset_size: 7881106
- config_name: path_traversal_8k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 22492022
    num_examples: 200
  download_size: 5715549
  dataset_size: 22492022
- config_name: pseudo_to_code_0.5k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 1127287
    num_examples: 199
  download_size: 410927
  dataset_size: 1127287
- config_name: pseudo_to_code_2k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 2315410
    num_examples: 200
  download_size: 471798
  dataset_size: 2315410
- config_name: tom_tracking_0.5k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 2425744
    num_examples: 200
  download_size: 311014
  dataset_size: 2425744
- config_name: tom_tracking_2k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 4333995
    num_examples: 200
  download_size: 561712
  dataset_size: 4333995
- config_name: tom_tracking_8k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 11996935
    num_examples: 200
  download_size: 1479326
  dataset_size: 11996935
- config_name: travel_planning_2k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 23775247
    num_examples: 769
  download_size: 3407254
  dataset_size: 23775247
- config_name: travel_planning_8k
  features:
  - name: id
    dtype: string
  - name: input_prompt
    dtype: string
  - name: reference_output
    dtype: string
  - name: metadata
    dtype: string
  splits:
  - name: test
    num_bytes: 11798420
    num_examples: 239
  download_size: 1833210
  dataset_size: 11798420
---

# LongProc: Benchmarking Long-Context Language Models on Long Procedural Generation

<p align="center">
  <a href="https://arxiv.org/abs/2501.05414"><img src="https://img.shields.io/badge/Paper-arXiv:2501.05414-B31B1B.svg" alt="Paper"></a>
  <a href="https://github.com/princeton-nlp/LongProc"><img src="https://img.shields.io/badge/GitHub-Code-black?logo=github" alt="GitHub"></a>
  <a href="https://princeton-pli.github.io/LongProc/"><img src="https://img.shields.io/badge/Project-Page-blue" alt="Project Page"></a>
</p>

**LongProc** (**Long Proc**edural Generation) is a benchmark for evaluating long-context LLMs through long procedural generation tasks that require models to follow specified procedures and produce structured outputs. LongProc was accepted at [COLM 2025](https://colmweb.org/).

<p align="center">
  <img width="60%" alt="LongProc task examples" src="https://princeton-pli.github.io/LongProc/static/images/data_example.png">
</p>

## Dataset Overview

LongProc consists of **6 tasks**, each at up to 3 difficulty levels based on the expected output length (~0.5K, ~2K, ~8K tokens). The dataset is organized into **17 subsets** (configs), each containing a single `test` split.

| Task | Description | Configs | Total Examples |
|------|-------------|---------|---------------|
| **HTML to TSV** | Extract information from HTML pages into structured TSV tables | `html_to_tsv_0.5k`, `html_to_tsv_2k`, `html_to_tsv_8k` | 100 + 189 + 120 = 409 |
| **Pseudocode to Code** | Translate line-by-line pseudocode into C++ code | `pseudo_to_code_0.5k`, `pseudo_to_code_2k` | 199 + 200 = 399 |
| **Path Traversal** | Trace a route between cities in a directed graph where each city has one outgoing edge | `path_traversal_0.5k`, `path_traversal_2k`, `path_traversal_8k` | 200 + 200 + 200 = 600 |
| **Theory-of-Mind Tracking** | Track object locations and agent beliefs through multi-step stories | `tom_tracking_0.5k`, `tom_tracking_2k`, `tom_tracking_8k` | 200 + 200 + 200 = 600 |
| **Countdown** | Search to combine numbers with arithmetic operations to reach a target | `countdown_0.5k`, `countdown_2k`, `countdown_8k` | 200 + 200 + 200 = 600 |
| **Travel Planning** | Search to construct a trip plan satisfying duration and flight constraints | `travel_planning_2k`, `travel_planning_8k`, `travel_planning_icl_examples` | 769 + 239 + 4 = 1012 |

## Loading the Dataset

```python
from datasets import load_dataset

# Load a specific task + difficulty
ds = load_dataset("PrincetonPli/LongProc", "countdown_0.5k", split="test")
print(ds)
# Dataset({
#     features: ['nums', 'target', 'solution', 'search_steps', 'demonstration', 'solution_text', 'num_search_tokens'],
#     num_rows: 200
# })

# Load another config
ds = load_dataset("PrincetonPli/LongProc", "html_to_tsv_2k", split="test")
print(ds[0].keys())
# dict_keys(['task_id', 'website_id', 'task_topic', 'task_description', 'gt', 'tsv_header', 'filtering_instruction', 'html_content'])
```

## Data Fields

### html_to_tsv

| Field | Type | Description |
|-------|------|-------------|
| `task_id` | string | Unique identifier for the task instance |
| `website_id` | string | Identifier for the source website |
| `task_topic` | string | Topic of the webpage (e.g., "electronics", "books") |
| `task_description` | string | Description of what properties to extract |
| `gt` | string | Ground truth TSV output |
| `tsv_header` | string | Header row for the TSV output |
| `filtering_instruction` | string | Additional instructions for filtering rows |
| `html_content` | string | Full HTML content of the webpage (inlined) |

### pseudo_to_code

| Field | Type | Description |
|-------|------|-------------|
| `problem_id` | string | Unique problem identifier |
| `pseudocode_lines` | list[string] | Pseudocode description, line by line |
| `code_lines` | list[string] | Ground truth C++ code lines |
| `testcases` | list | Test cases for validation |

### path_traversal

| Field | Type | Description |
|-------|------|-------------|
| `context_nl` | string | Natural language description of the city graph |
| `question_repr` | list[string] | Source and destination cities |
| `answer_nl` | string | Ground truth route in natural language |

### tom_tracking

| Field | Type | Description |
|-------|------|-------------|
| `story_components` | string | Components of the story (agents, objects, rooms, containers) |
| `story` | string | The multi-step story |
| `question` | string | Question about an agent's belief about an object's ___location |
| `solution` | string | Step-by-step solution trace |
| `answer` | list[string] | Final answer(s) |

### countdown

| Field | Type | Description |
|-------|------|-------------|
| `nums` | list[int] | Four input numbers |
| `target` | int | Target number to reach |
| `solution` | list[string] | Sequence of equations forming the solution |
| `search_steps` | float | Number of search steps in the ground truth trace |
| `demonstration` | string | In-context demonstration of the search procedure |
| `solution_text` | string | Full solution text including the search procedure |
| `num_search_tokens` | int | Number of tokens in the search procedure |

### travel_planning

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | Unique problem identifier |
| `ground_truth_cities` | string | Ordered list of cities in the ground truth plan |
| `ground_truth_durations` | string | Duration of stay for each city |
| `num_cities` | int | Number of cities to visit |
| `total_days` | int | Total number of trip days |
| `constraints` | list[object] | Constraints with city, type, start/end days, num_days |
| `connected_cities` | list[list[string]] | Direct flight connections between cities |
| `original_question_text` | string | Original problem statement |
| `disambig_question_text` | string | Disambiguated problem statement |
| `ground_truth_plan` | string | Complete ground truth trip plan |
| `estimated_output_tokens` | int | Estimated output length in tokens (not present in ICL examples) |

The `travel_planning_icl_examples` config contains 4 in-context learning examples that share the same schema but without `estimated_output_tokens`.

## Prompt Templates

The prompt templates below are used to construct the input prompts for each task. Placeholders in `{braces}` are filled from the corresponding data fields.

<details>
<summary><b>HTML to TSV</b></summary>

```
[TASK]
Your task is to extract specific information from an HTML webpage and output the extracted
information in a tsv file. You will be first given an HTML webpage. Then, you should follow
the specific instruction provided later and output the tsv file following the format provided
in the instruction.

[INPUT WEBPAGE]
```html
{html_content}
```

[TARGET INFORMATION]
Based on the HTML webpage above about {task_topic}, extract the following properties from
the items listed on the webpage: {task_description}{filtering_instruction}

[OUTPUT FORMAT]
Structure your output in TSV format such that each row of your output corresponds to the
aforementioned properties of an item and each property is separated from each other by a
tab "\t". Your output should be in the following format:
```tsv
{tsv_header}
{Your TSV output}
```

[IMPORTANT NOTES]
- Make sure that you have read through all items listed on the webpage and followed the
  same order as they appear on the webpage.
- If you are asked to only extract some rows that satisfy specific conditions, ONLY extract
  those rows that satisfy the conditions and do NOT include other irrelevant rows in your output.
- If a property of an item is blank, not applicable, or not parseable, please set the property
  to "N/A" for the item.
- If a property spans multiple lines, please extract all the lines and replace the newline
  character with a space character.
- If a property consists of a list of items, please replace the newline character with a space
  character and separate the items with a comma ",".
- If there are any special characters, numerical values of a specific format, or any unusual
  formatting in the property, please keep them as they are. If the property comes with a unit,
  please keep the unit as well in the property.
- Do not include html tags in the extracted information. Only include the text.
- Do not provide any additional information in your output other than the tsv.

Now, extract the information from the HTML webpage above and follow the output format above
in your answer.
```
</details>

<details>
<summary><b>Pseudocode to Code</b></summary>

```
[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code.
The pseudocode will provide detailed description of the c++ code line by line. The pseudocode
is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers.
Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
{pseudocode}

[CODE]:
```

Where `{pseudocode}` is constructed by joining `pseudocode_lines` with newlines.
</details>

<details>
<summary><b>Path Traversal</b></summary>

```
[TASK]
In a completely hypothetical world, there are a number of cities. Each city has a one-way
connection to only one other city via a specific transit method (bus, train, plane, or ferry).
Your task is to provide a route from a city to another city. You should follow the specific
instruction provided later and output the route following the format provided in the instruction.

[IMPORTANT NOTES]
- All connections are one-way. If city A is connected to city B, you can travel from A to B,
  but not the other way around.
- Because each city is connected to only one other city, so there's only one possible route.
  To find the route, you can simply start from the starting city, identify the next city it's
  connected to, and repeat the process until you reach the destination city.
- Please follow the exact format specified below when outputting the route.

[OUTPUT FORMAT]
Please mark the route with <Route> and </Route> tags. The route should be in the following
format, where one line is one step of the route:
<Route>
From <CITY_NAME>, take a <TRANSIT_METHOD> to <CITY_NAME>.
...
From <CITY_NAME>, take a <TRANSIT_METHOD> to <CITY_NAME>.
</Route>

[EXAMPLE]
...

[PROBLEM]
{context_nl}

Now find the route from {src_city} to {dst_city} based on the information above.
```

Where `{src_city}` and `{dst_city}` come from the `question_repr` field.
</details>

<details>
<summary><b>Theory-of-Mind Tracking</b></summary>

```
[TASK]
You'll see a story about object placement. Each story involves four components: Agents,
Objects, Rooms, and Containers. Given a question about an (agent, object) pair, your task
is to track the locations and beliefs in stories about object placement asked in the question.

[APPROACH]
You will solve the problem by tracking the ___location of the agent, ___location of the object,
and the agent's belief of the object.
1. Initial Setup: set up agent's starting ___location, object's starting ___location, agent's
   initial belief on the object's ___location. Note that if an agent does not see an object
   at the start, their belief on the object is None.
2. Then, track step-by-step:
   - If a step involves that the agent moves to another room, leaves a room, or enters a
     room, you should update the agent's ___location.
   - If a step involves the object of interest moving, you should update the object's ___location.
   - To keep track of the agent's belief on the object: If the agent and the object are in
     the same room, the agent can see the object, so the agent's belief will reflect the
     true ___location of the object. If the agent cannot see the object, the agent's belief
     will remain unchanged until the agent sees the object again.
3. Format your output exactly as shown in example answers below.

[EXAMPLE STORY / QUESTION / ANSWER]
...

[PROBLEM]
Read the following story and answer the question.

[STORY]
{story}

[QUESTION]
{question}

[YOUR ANSWER]
```
</details>

<details>
<summary><b>Countdown</b></summary>

```
[TASK]
You will be given four numbers and a target number, your task is to find a way to use all
four numbers exactly once, along with the basic operations (+, -, *, /), to reach the
target number.

[RULES]
- You can use each number exactly once.
- You can use the four basic operations (+, -, *, /).
- The intermediate results must be integers (no decimals allowed).
- The intermediate results must be positive.
- The intermediate results will not exceed 2000.

[APPROACH]
We will solve the problem by searching. Starting from a given set of four numbers, we will
follow this search process...

[EXAMPLES]
{demonstration}

[Problem]
Numbers: {nums}
Target: {target}
```

The `{demonstration}` field is provided per-example and contains worked examples of the search procedure. `{nums}` comes from joining the `nums` list.
</details>

<details>
<summary><b>Travel Planning</b></summary>

```
TASK:
Your task is to create a trip plan based on given constraints regarding cities to visit,
duration of stays for each city, and available direct flight connections.

REQUIREMENTS AND NOTES:
- You will arrange a trip plan for visiting several cities for a specified total number of days.
- You will be informed about how long we will stay in each city. Some cities have fixed
  schedules because of pre-planned events. You have to follow the fixed schedules for those
  cities. Cities without fixed schedules need to be arranged according to the constraints.
- Only direct flights may be used to travel between cities.
- When calculating the duration of a stay in a city, count both arrival and departure days
  as full days.

APPROACH:
We will solve the problem by searching...

EXAMPLES:
{demonstration}

YOUR TASK:
{problem}
```

The `{demonstration}` is constructed from the `travel_planning_icl_examples` config. `{problem}` comes from `disambig_question_text` (or `original_question_text`).
</details>

## Running Evaluation

We recommend using the [LongProc GitHub repository](https://github.com/princeton-nlp/LongProc) for data loading and evaluation:

```python
from longproc.longproc_data import load_longproc_data

data, eval_fn = load_longproc_data("countdown_0.5k")
# data: list of dicts with 'input_prompt', 'reference_output', 'item'
# eval_fn: task-specific evaluation function
```

For large-scale evaluation, we recommend the [HELMET](https://github.com/princeton-nlp/HELMET) framework with the [LongProc Addon](https://github.com/princeton-nlp/HELMET/blob/longproc/longproc_addon/README.md).

## Citation

```bibtex
@inproceedings{ye25longproc,
    title={LongProc: Benchmarking Long-Context Language Models on Long Procedural Generation},
    author={Ye, Xi and Yin, Fangcong and He, Yinghui and Zhang, Joie and Yen, Howard and Gao, Tianyu and Durrett, Greg and Chen, Danqi},
    journal={Conference on Language Modeling},
    year={2025}
}
```

<details>
<summary><b>LongProc adapts several existing datasets. Please also cite the original sources:</b></summary>

```bibtex
@article{arborist,
    author = {Li, Xiang and Zhou, Xiangyu and Dong, Rui and Zhang, Yihong and Wang, Xinyu},
    title = {Efficient Bottom-Up Synthesis for Programs with Local Variables},
    year = {2024},
    journal = {Proc. ACM Program. Lang.},
    volume = {8},
    number = {POPL},
}

@inproceedings{spoc,
    author = {Kulal, Sumith and Pasupat, Panupong and Chandra, Kartik and Lee, Mina and Padon, Oded and Aiken, Alex and Liang, Percy S},
    booktitle = {Proceedings of the Conference on Advances in Neural Information Processing Systems (NeurIPS)},
    title = {{SPoC: Search-based Pseudocode to Code}},
}

@inproceedings{gandhi2024stream,
    title={{Stream of Search (SoS): Learning to Search in Language}},
    author={Kanishk Gandhi and Denise H J Lee and Gabriel Grand and Muxin Liu and Winson Cheng and Archit Sharma and Noah Goodman},
    booktitle={First Conference on Language Modeling},
    year={2024},
}

@article{natplan,
    title={{NATURAL PLAN: Benchmarking LLMs on Natural Language Planning}},
    author={Zheng, Huaixiu Steven and Mishra, Swaroop and Zhang, Hugh and Chen, Xinyun and Chen, Minmin and Nova, Azade and Hou, Le and Cheng, Heng-Tze and Le, Quoc V and Chi, Ed H and others},
    journal={arXiv preprint arXiv:2406.04520},
    year={2024}
}
```
</details>

## Contact

For questions, feel free to open issues on the [GitHub repository](https://github.com/princeton-nlp/LongProc) or email `xi.ye@princeton.edu`.