mlsanityData to 7 Oct 2026

Code4Struct: Code Generation for Few-Shot Event Structure Prediction

arXiv 2210.12810 ↗First posted 23 Oct 2022cs.CLcited by 70

Not on the map. Why?

Abstract (arXiv)

Large Language Model (LLM) trained on a mixture of text and code has demonstrated impressive capability in translating natural language (NL) into structured code. We observe that semantic structures can be conveniently translated into code and propose Code4Struct to leverage such text-to-structure translation capability to tackle structured prediction tasks. As a case study, we formulate Event Argument Extraction (EAE) as converting text into event-argument structures that can be represented as a class object using code. This alignment between structures and code enables us to take advantage of Programming Language (PL) features such as inheritance and type annotation to introduce external knowledge or add constraints. We show that, with sufficient in-context examples, formulating EAE as a code generation problem is advantageous over using variants of text-based prompts. Despite only using 20 training event instances for each event type, Code4Struct is comparable to supervised models trained on 4,202 instances and outperforms current state-of-the-art (SOTA) trained on 20-shot data by 29.5% absolute F1. Code4Struct can use 10-shot training data from a sibling event type to predict arguments for zero-resource event types and outperforms the zero-shot baseline by 12% absolute F1.

Key facts. Cited by 70 papers in the map (data through 7 Oct 2026). Builds on 19 of its 41 references that are in the map. First posted on arXiv 23 Oct 2022.

Builds on

19 of 41 references.

References · 19

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2022Training language models to follow instructions with human feedbackcited by 15,712
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  4. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
  5. 2022Training Compute-Optimal Large Language Modelscited by 2,927
  6. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
  7. 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,371
  8. 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
  9. 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,122
  10. 2022ProgPrompt: Generating Situated Robot Task Plans using Large Language Modelscited by 598
  11. 2019Entity, Relation, and Event Extraction with Contextualized Span Representationscited by 261
  12. 2021Structured Prediction as Translation between Augmented Natural Languagescited by 183
7 more
  1. 2020Event Extraction by Answering (Almost) Natural Questionscited by 177
  2. 2022Language Models of Code are Few-Shot Commonsense Learnerscited by 160
  3. 2021Document-Level Event Argument Extraction by Conditional Generationcited by 154
  4. 2021Text2Event: Controllable Sequence-to-Structure Generation for End-to-end Event Extractioncited by 129
  5. 2021DEGREE: A Data-Efficient Generation-Based Event Extraction Modelcited by 82
  6. 2016Joint Extraction of Events and Entities within a Document Contextcited by 48
  7. 2021Document-level Entity-based Extraction as Template Generationcited by 33

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2022: 1; 2023: 14; 2024: 30; 2025: 20; 2026: 5.

70 papers.

Sort:

By area:

  1. 2024Executable Code Actions Elicit Better LLM Agentscited by 537
  2. 2023Large Language Models for Generative Information Extraction: A Surveycited by 183
  3. 2023Large Language Model Is Not a Good Few-shot Information Extractor, but a Good Reranker for Hard Samples!cited by 119
  4. 2023GoLLIE: Annotation Guidelines improve Zero-Shot Information-Extractioncited by 116
  5. 2024If LLM Is the Wizard, Then Code Is the Wand: A Survey on How Code Empowers Large Language Models to Serve as Intelligent Agentscited by 77
  6. 2024Aligning LLMs with Individual Preferences via Interactioncited by 63
  7. 2023LaMPilot: An Open Benchmark Dataset for Autonomous Driving with Language Model Programscited by 45
  8. 2023Retrieval-Augmented Code Generation for Universal Information Extractioncited by 40
  9. 2024LLM-Ensemble: Optimal Large Language Model Ensemble Method for E-commerce Product Attribute Value Extractioncited by 39
  10. 2024Unveiling the Impact of Coding Data Instruction Fine-Tuning on Large Language Models Reasoningcited by 31
  11. 2023TextEE: Benchmark, Reevaluation, Reflections, and Future Challenges in Event Extractioncited by 27
  12. 2023LeTI: Learning to Generate from Textual Interactionscited by 25
38 more
  1. 2024ADELIE: Aligning Large Language Models on Information Extractioncited by 24
  2. 2024Unlocking Reasoning Potential in Large Langauge Models by Scaling Code-form Planningcited by 24
  3. 2024C-ICL: Contrastive In-context Learning for Information Extractioncited by 22
  4. 2023The Magic of IF: Investigating Causal Reasoning Abilities in Large Language Models of Codecited by 21
  5. 2023ExtractGPT: Exploring the Potential of Large Language Models for Product Attribute Value Extractioncited by 20
  6. 2024Using LLMs for the Extraction and Normalization of Product Attribute Valuescited by 20
  7. 2025Instruction-Tuning LLMs for Event Extraction with Annotation Guidelinescited by 18
  8. 2023Why Can Large Language Models Generate Correct Chain-of-Thoughts?cited by 16
  9. 2024Towards Truly Zero-shot Compositional Visual Reasoning with LLMs as Programmerscited by 14
  10. 2023ViStruct: Visual Structural Knowledge Extraction via Curriculum Guided Code-Vision Representationcited by 13
  11. 2023Unit Test Generation using Generative AI : A Comparative Performance Analysis of Autogeneration Toolscited by 13
  12. 2025a1: Steep Test-time Scaling Law via Environment Augmented Generationcited by 13
  13. 2024Swarm Intelligence in Geo-Localization: A Multi-Agent Large Vision-Language Model Collaborative Frameworkcited by 11
  14. 2024CodeTaxo: Enhancing Taxonomy Expansion with Limited Examples via Code Language Promptscited by 10
  15. 2024On-the-fly Definition Augmentation of LLMs for Biomedical NERcited by 9
  16. 2024CHECKWHY: Causal Fact Verification via Argument Structurecited by 9
  17. 2024Explicit, Implicit, and Scattered: Revisiting Event Extraction to Capture Complex Argumentscited by 9
  18. 2024Improving Event Definition Following For Zero-Shot Event Detectioncited by 7
  19. 2024MAVEN-Fact: A Large-scale Event Factuality Detection Datasetcited by 6
  20. 2024CodeGraph: Enhancing Graph Reasoning of LLMs with Codecited by 6
  21. 2024Towards Better Multi-task Learning: A Framework for Optimizing Dataset Combinations in Large Language Modelscited by 6
  22. 2025Revisiting Prompt Optimization with Large Reasoning Models-A Case Study on Event Extractioncited by 6
  23. 2025Rank, Chunk and Expand: Lineage-Oriented Reasoning for Taxonomy Expansioncited by 5
  24. 2025Event Extraction in Large Language Modelcited by 5
  25. 2023Defining a New NLP Playgroundcited by 4
  26. 2024Promptly Predicting Structures: The Return of Inferencecited by 4
  27. 2024Transforming Scholarly Landscapes: Influence of Large Language Models on Academic Fields beyond Computer Sciencecited by 4
  28. 2024Explainable Behavior Cloning: Teaching Large Language Model Agents through Learning by Demonstrationcited by 4
  29. 2022A Survey on Natural Language Processing for Programmingcited by 3
  30. 2024Cascading Large Language Models for Salient Event Graph Generationcited by 3
  31. 2024RUIE: Retrieval-based Unified Information Extraction using Large Language Modelcited by 3
  32. 2024Exploring Large Language Models for Product Attribute Value Identificationcited by 3
  33. 2024KnowCoder-X: Boosting Multilingual Information Extraction via Codecited by 3
  34. 2026PaperX: A Unified Framework for Multimodal Academic Presentation Generation with Scholar DAGcited by 3
  35. 2024Formulation Comparison for Timeline Construction using LLMscited by 2
  36. 2025Self-Refinement Strategies for LLM-based Product Attribute Value Extractioncited by 2
  37. 2025Boost, Disentangle, and Customize: A Robust System2-to-System1 Pipeline for Code Generationcited by 2
  38. 2025SNaRe: Domain-aware Data Generation for Low-Resource Event Detectioncited by 2

50 most cited of 70 All 70 (JSON)