Wiki: Programming with Millions of Examples

For agents: Markdown version · Wiki index · Explore

Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.

Summary

This talk explores how analyzing millions of examples of existing code can revolutionize programming tasks such as code completion, search, and vulnerability detection. The speaker explains that while programs are data transformers with infinite potential behaviors, small code fragments share common patterns and invariants similar to features in images. By leveraging these vast codebases statically without running the code, developers can better navigate complex APIs and find semantic similarities. Ultimately, the audience learns how automated representation and probabilistic models can help harness big code for practical engineering tasks.

Key points

  • 1:24 The massive availability of open-source and binary code creates an opportunity to build exciting tools, though the data is currently unorganized.
  • 4:02 Comparing programs is much harder than comparing images because programs are data transformers with infinite potential run-time behaviors.
  • 5:11 Despite entire programs being unique, small fragments of code are not unique, mirroring how images share recurring semantic objects.
  • 8:18 To analyze code at scale, we must rely on static representations rather than executing millions of snippets at runtime.
  • 19:55 API usage patterns can be represented as control tracelets and finite state automata to capture client behavior.
  • 27:07 Aggregating automata from millions of code examples creates probabilistic models that represent common API usage trends.
  • 35:30 Semantic similarity can even bridge different programming languages by linking code snippets through natural language descriptions.

Takeaways

  • Utilize static code representations to analyze and search through large codebases without needing to execute them.
  • Leverage community-driven code patterns to understand correct API usage sequences and generate code completions.
  • Recognize that small code fragments often share common invariants, making them suitable for pattern matching and clustering.

Questions this talk answers

  • How can we compare the functional similarity of two programs without actually running them?
  • How do we extract reliable API usage patterns from millions of incomplete open-source code examples?
  • Can we find semantic similarities between code written in entirely different programming languages?

Technologies

GitHub, Stack Overflow, Android, Python, C, Java, X86 Assembly

Tags

api usage, big code, code completion, machine learning for code, program synthesis, semantic search, static analysis