Code-Survey is the first step in using LLMs to gain meaningful insights into large-scale software systems. Unlike Retrieval-Augmented Generation (RAG) or fine-tuning, Code-Survey offers a unique approach.
Imagine if every entry-level kernel developer or a graduate student studying the kernel, could participate in a survey about every commit. What valuable information could we uncover from the results?
Code-Survey helps you explore and analyze some of the world's largest and most complex codebases, such as the Linux kernel. By carefully designing a survey and transforming unstructured data like commits and emails into organized, structured, and easy-to-analyze formats, you can perform quantitative analysis with ease. Code-Survey simplifies the process of uncovering valuable insights in modern complex software systems.
See our arxiv for details: https://arxiv.org/abs/2410.01837
Here is an example of analysis for the eBPF subsystem: docs/report_ebpf.md. (Not yet complete...more is adding)
Code-survey is a prototype and a on going poject now. We are working on the next step: Can we automatically mine meaningful pattern from everying we produced in the software developement? Just tell AI what you need, and ask AI to give you a compresenive report.
As far as we know, Code-Survey is the first method and tool that leverages LLMs to systematically explore and analyze large-scale codebases, providing quantitative results. By transforming unstructured data like git messages and emails into structured data, you can perform detailed analyses on software evolution, uncovering insights related to design, implementation, maintenance, reliability, and security.
Software development is also a social activity, allowing the application of established social science techniques. By treating LLMs as human participants in a survey, Code-Survey bridges the gap between high-level design decisions and the intricate details of implementation. This enables the analysis of large-scale codebases like the Linux kernel in ways that were previously impossible.
Let's do Code-Survey!
Join us in revolutionizing the way we understand and analyze complex software systems.
The core idea of Code-survey is to treat LLMs like human participants in a survey:

Our approach follows a well-defined workflow:
A key aspect of Code-Survey is designing effective surveys to generate accurate data. Surveys can be designed by humans or LLM agents. We identify three key steps to guide LLM agents in designing surveys. The following prompts serve as a framework or LLM input for survey creation:
This workflow ensures that the LLM-driven survey design process leads to structured data that offers deeper insights into complex software systems, such as the Linux kernel. By guiding LLM agents through these steps, we can systematically extract valuable information from unstructured data sources.
The Linux-bpf dataset focuses on the eBPF subsystem and is continuously updated via CI. The dataset includes:
TODO).To see more details abot what we find, check the analysis in report_ebpf.md.
A simplest approach to see how these data works is just Upload the CSV to ChatGPT(**Or other platforms) and Ask questions to let it Analysis for you!
Note this is just a very simple demo now --- there are hundreds of ways to improve the survey accuracy:
You can find this example in survey/commit_survey.yml, which analysis all the 10000+ bpf commits in the Linux kernel eBPF subsystem.
title: "Commit Classification Survey"
description: "A survey about the commit in Linux eBPF, to help better understand the design and evolution of bpf subsystem. For choice, try to be as specific as possible based on the commit message and code changes. If the commit message is not clear or does not provide enough information, you can choose the 'I'm not sure' option."
hint: "For example, when seems not related to eBPF, confirm it's a rare cases really has nothing to do with eBPF in all it's contents, such as btrfs or misspelled commit message. Do not tag subsystem changes related to eBPF as not."
questions:
- id: summary
type: fill_in
question: "Please provide a summary of It in one short sentence not longer than 30 words. Only output one sentence."
required: true
- id: keywords
type: fill_in
question: "Please extract no more than 3 keywords from the commit. Only output 3 keywords without any special characters."
required: true
- id: commit_classification
type: single_choice
question: "What may be the main type of the commit?"
choices:
- value: A bug fix. It primarily resolves a bug or issue in the code.
- value: A new feature. It adds a new capability or feature that was not previously present.
- value: A performance optimization. It improves the performance of existing code such as reducing latency or improving throughput.
- value: A cleanup or refactoring in the code. It involves changes to improve code readability maintainability or structure without changing its functionality.
- value: A documentation change or typo fix. It only involves changes to documentation files or fixes a typographical error.
- value: A test case or test infrastructure change. It adds or modifies test cases test scripts or testing infrastructure.
- value: A build system or CI/CD change. It affects the build process continuous integration or deployment pipelines.
- value: A security fix. It resolves a security vulnerability or strengthens security measures.
- value: It's like a merge commit. It merges changes from another branch or repository.
- value: It's other type of commit. It does not fit into any of the categories listed above.
- value: I'm not sure about the type of the commit. The nature of It is unclear or uncertain.
- id: major_related_implementation_component
type: single_choice
question: "What major implementation component is modified by the commit? It's typically where the code changes happened."
choices:
- value: The eBPF verifier. This component ensures that eBPF programs are safe to run within the kernel.
- value: The eBPF JIT compiler for different architectures. It changes how eBPF bytecode is translated into machine code for different hardware architectures.
- value: The helper and kfuncs. It modifies or adds helpers and kernel functions that eBPF programs can call.
- value: The syscall interface. It changes the system calls through which user-space programs interact with eBPF.
- value: The eBPF maps. It changes how data structures shared between user-space and kernel-space (maps) are created or managed.
- value: The libbpf library. It affects the library that simplifies interaction with eBPF from user-space applications.
- value: The bpftool utility. It modifies the bpftool utility used for introspecting and interacting with eBPF programs and maps.
- value: The test cases and makefiles. It adds or modifies test cases or makefile scripts used for testing or building eBPF programs.
- value: The implementation happens in other subsystem and is related to eBPF events. e.g. probes perf events tracepoints network scheduler HID LSM etc. Note it's still related to how eBPF programs interact with these events.
- value: It's like a merge commit. It includes significant changes across multiple components of the system.
- value: It's not related to any above. It affects an implementation component not listed but does related to the BPF subsystem.
- value: It's not related to any above. It affects an implementation component is totally unrelated to the BPF subsystem. It's not related to any above because it totally not related to the BPF subsystem. It's a rare case wrong data and need removed.
- value: I'm not sure about the implementation component of the commit. The component affected by It is unclear.
......
There are two examples to run the survey:
They are just simple scripts, you can set the OPENAI_API_KEY in the .env file to run it.
LLMs have been proven effective in survey, summarization, and analysis tasks in fields like market research and chemistry. With LLMs, we can analyze unstructured data, which traditional methods struggle to handle efficiently.
$ claude mcp add code-survey \
-- python -m otcore.mcp_server <graph>