SlideShare a Scribd company logo
Even Li hter Than Li htwei ht
Augmenting Type Inference
with Primitive Heuristics and AI-support
Larisa Safina, Jan Blizničenko
IWST 25 – Gdańsk, 2025
Type In erence? In Dynamic Lan ua es? Why?
Improves correctness, maintainability, performance
Hard in dynamic languages like Smalltalk
- Polymorphism
- Trade-off: precision vs. speed
- Computational resources
2
And no one did it be ore?
3
A bit o history…
4
Impressive timeline (from 1981 by Suzuki)
From less to more formal
Compiler-oriented vs IDE-oriented
Pluggable Types
Gradual Typing
Heuristics
…
What about the present
5
- IDE: RoelTyper
- IDE: JInferer
- TypeInfoTools
- VM-level type feedback
- …
However, IDE-integrated type inference is not widely used by Pharo
developers on a daily basis
Why this insufficient adoption?
- Problems of early solutions
- Human factor
- end of funding
- lost of interest
- phd/postdoc ends
- Not user-friendly
6
So what do we want ?
And how ?
- Balance precision and speed
- Make inference interactive and IDE-friendly
Step 1: Lightweight heuristics to pre-calculate types and speed up stronger tools
Simple, fast, surprisingly effective
7
Goin back to heuristics
Heuristics on method titles (127k methods)
- Implicit self returns (~57k methods)
- Type by name (~7,8k methods)
- Single return methods (~10k methods)
- Collection-specific methods
- Test methods (~22,5k methods)
8
Goin back to heuristics
Heuristics on method titles
- Type by name (~7,8k methods)
- Boolean (isEmpty, hasElements, includes, ..)
- String (asString, …)
- Numerical (size, …)
9
Goin back to heuristics
Heuristics on method titles
- Single return methods (~10k methods)
- AST LiteralNode as String, Number (8745 methods)
- class reference (982 methods)
- class new (394 methods)
- self
- self new (34 methods)
- nil (278 methods)
10
Goin back to heuristics
Heuristics on method titles
- Collection-specific methods
- Numeric e.g indexOf
- String e.g. concatenation
- Boolean e.g. anySatisfy:
- Transformation e.g asCollection
- Collection-preserving e.g addAll:, copy
11
Goin back to heuristics
Heuristics on method titles (127k methods)
- Implicit self returns (~57k methods)
- Type by name (~7,8k methods)
- Single return methods (~10k methods)
- Collection-specific methods
- Test methods (~22,5k methods)
12
Evaluation
Inference takes ~1 minute on Mac M2 with 24 GB of RAM
In Pharo 13 image heuristics cover 97,3k methods of 127k
Validation
- Sanity Check
- Comparison with TypeInfoTools
13
AI-Assisted In erence (Experimental)
- Queries to OpenAI/Mistral for type prediction
- Promising, but slow and sometimes wrong
- Can complement heuristics
- Need to learn lessons from Python
14
IDE Inte ration
- Type results shown on demand
- CSV-based or loaded into Pharo (negligible overhead)
- AI-specific settings
15
Type results shown on demand
16
What's Next?
Combine everything! (Heuristics, other TI tools, AI, CI, ADHD, …)
- Interactive Type Refinement
- Create a Smalltalk “typeshed”
- Allow devs to refine suggestions
- Improve AI part
- …
17
Thanks / Q&A
ithub.com/lsafina/typeMe
18

More Related Content

PDF
Can We Automatically Generate Class Comments in Pharo?
PDF
[CIbSE2023] Cross-language clone detection for Mobile Apps
PDF
Can We Automatically Generate Class Comments in Pharo?
PDF
Deep learning Type Inference for Dynamic Programming Languages
PDF
Programming Languages: some news for the last N years
KEY
Talking to your IDE
PPT
ppt
PPTX
Putting the science in computer science
Can We Automatically Generate Class Comments in Pharo?
[CIbSE2023] Cross-language clone detection for Mobile Apps
Can We Automatically Generate Class Comments in Pharo?
Deep learning Type Inference for Dynamic Programming Languages
Programming Languages: some news for the last N years
Talking to your IDE
ppt
Putting the science in computer science

Similar to Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuristics and AI-support (20)

PDF
What do we really know about the differences between static and dynamic types?
PDF
Types For Frontend Developers
PDF
PDF
Parameterizing and Assembling IR-based Solutions for SE Tasks using Genetic A...
PDF
Generating UML Models with Inferred Types from Pharo Code
PDF
COSC3054 Lec 05 - Semantic Analysis and Type checking B.pdf
PDF
DTS s03e04 Typing
PPT
Artificial Intelligence: Knowledge Acquisition
PDF
Type Classes
PDF
型ヒントについて考えよう!
PPTX
Trends in programming languages
PPT
Life & Work of Robin Milner | Turing100@Persistent
PDF
Suggesting Descriptive Method Names: An Exploratory Study of Two Machine Lear...
PDF
DEVCON1 - BooJs
PDF
Hybrid use of machine learning and ontology
PDF
2016-11-12 02 Николай Линкер. Чему Java может поучиться у Haskell и наоборот
PPTX
what is Type Systems and Type Inference.pptx
PDF
Of Harmony and Stinginess: Applicative, Monad, and iterative library design
PDF
Runtime Type Collection and its usage in Code Transpiling
PDF
IRJET- A Novel Approch Automatically Categorizing Software Technologies
What do we really know about the differences between static and dynamic types?
Types For Frontend Developers
Parameterizing and Assembling IR-based Solutions for SE Tasks using Genetic A...
Generating UML Models with Inferred Types from Pharo Code
COSC3054 Lec 05 - Semantic Analysis and Type checking B.pdf
DTS s03e04 Typing
Artificial Intelligence: Knowledge Acquisition
Type Classes
型ヒントについて考えよう!
Trends in programming languages
Life & Work of Robin Milner | Turing100@Persistent
Suggesting Descriptive Method Names: An Exploratory Study of Two Machine Lear...
DEVCON1 - BooJs
Hybrid use of machine learning and ontology
2016-11-12 02 Николай Линкер. Чему Java может поучиться у Haskell и наоборот
what is Type Systems and Type Inference.pptx
Of Harmony and Stinginess: Applicative, Monad, and iterative library design
Runtime Type Collection and its usage in Code Transpiling
IRJET- A Novel Approch Automatically Categorizing Software Technologies
Ad

More from ESUG (20)

PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
PDF
Directing Generative AI for Pharo Documentation
PDF
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
PDF
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
PDF
Analysing Python Machine Learning Notebooks with Moose
PDF
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
PDF
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
PDF
Package-Aware Approach for Repository-Level Code Completion in Pharo
PDF
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
PDF
An Analysis of Inline Method Refactoring
PDF
Identification of unnecessary object allocations using static escape analysis
PDF
Control flow-sensitive optimizations In the Druid Meta-Compiler
PDF
Clean Blocks (IWST 2025, Gdansk, Poland)
PDF
Encoding for Objects Matters (IWST 2025)
PDF
Challenges of Transpiling Smalltalk to JavaScript
PDF
Immersive experiences: what Pharo users do!
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
PDF
Cavrois - an Organic Window Management (ESUG 2025)
PDF
Fluid Class Definitions in Pharo (ESUG 2025)
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
Micromaid: A simple Mermaid-like chart generator for Pharo
Directing Generative AI for Pharo Documentation
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
Analysing Python Machine Learning Notebooks with Moose
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
Package-Aware Approach for Repository-Level Code Completion in Pharo
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
An Analysis of Inline Method Refactoring
Identification of unnecessary object allocations using static escape analysis
Control flow-sensitive optimizations In the Druid Meta-Compiler
Clean Blocks (IWST 2025, Gdansk, Poland)
Encoding for Objects Matters (IWST 2025)
Challenges of Transpiling Smalltalk to JavaScript
Immersive experiences: what Pharo users do!
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
Cavrois - an Organic Window Management (ESUG 2025)
Fluid Class Definitions in Pharo (ESUG 2025)
Ad

Recently uploaded (20)

PDF
AlphaEarth Foundations and the Satellite Embedding dataset
PDF
ELS_Q1_Module-11_Formation-of-Rock-Layers_v2.pdf
PPTX
G5Q1W8 PPT SCIENCE.pptx 2025-2026 GRADE 5
PDF
Phytochemical Investigation of Miliusa longipes.pdf
PDF
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf
PDF
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
PPTX
famous lake in india and its disturibution and importance
PDF
An interstellar mission to test astrophysical black holes
PDF
Sciences of Europe No 170 (2025)
PPTX
Derivatives of integument scales, beaks, horns,.pptx
PPTX
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
PPT
Chemical bonding and molecular structure
PDF
. Radiology Case Scenariosssssssssssssss
PDF
bbec55_b34400a7914c42429908233dbd381773.pdf
PPTX
microscope-Lecturecjchchchchcuvuvhc.pptx
PPTX
ECG_Course_Presentation د.محمد صقران ppt
PPTX
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
PPTX
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
PPTX
Comparative Structure of Integument in Vertebrates.pptx
PDF
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
AlphaEarth Foundations and the Satellite Embedding dataset
ELS_Q1_Module-11_Formation-of-Rock-Layers_v2.pdf
G5Q1W8 PPT SCIENCE.pptx 2025-2026 GRADE 5
Phytochemical Investigation of Miliusa longipes.pdf
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
famous lake in india and its disturibution and importance
An interstellar mission to test astrophysical black holes
Sciences of Europe No 170 (2025)
Derivatives of integument scales, beaks, horns,.pptx
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
Chemical bonding and molecular structure
. Radiology Case Scenariosssssssssssssss
bbec55_b34400a7914c42429908233dbd381773.pdf
microscope-Lecturecjchchchchcuvuvhc.pptx
ECG_Course_Presentation د.محمد صقران ppt
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
Comparative Structure of Integument in Vertebrates.pptx
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud

Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuristics and AI-support

  • 1. Even Li hter Than Li htwei ht Augmenting Type Inference with Primitive Heuristics and AI-support Larisa Safina, Jan Blizničenko IWST 25 – Gdańsk, 2025
  • 2. Type In erence? In Dynamic Lan ua es? Why? Improves correctness, maintainability, performance Hard in dynamic languages like Smalltalk - Polymorphism - Trade-off: precision vs. speed - Computational resources 2
  • 3. And no one did it be ore? 3
  • 4. A bit o history… 4 Impressive timeline (from 1981 by Suzuki) From less to more formal Compiler-oriented vs IDE-oriented Pluggable Types Gradual Typing Heuristics …
  • 5. What about the present 5 - IDE: RoelTyper - IDE: JInferer - TypeInfoTools - VM-level type feedback - … However, IDE-integrated type inference is not widely used by Pharo developers on a daily basis
  • 6. Why this insufficient adoption? - Problems of early solutions - Human factor - end of funding - lost of interest - phd/postdoc ends - Not user-friendly 6
  • 7. So what do we want ? And how ? - Balance precision and speed - Make inference interactive and IDE-friendly Step 1: Lightweight heuristics to pre-calculate types and speed up stronger tools Simple, fast, surprisingly effective 7
  • 8. Goin back to heuristics Heuristics on method titles (127k methods) - Implicit self returns (~57k methods) - Type by name (~7,8k methods) - Single return methods (~10k methods) - Collection-specific methods - Test methods (~22,5k methods) 8
  • 9. Goin back to heuristics Heuristics on method titles - Type by name (~7,8k methods) - Boolean (isEmpty, hasElements, includes, ..) - String (asString, …) - Numerical (size, …) 9
  • 10. Goin back to heuristics Heuristics on method titles - Single return methods (~10k methods) - AST LiteralNode as String, Number (8745 methods) - class reference (982 methods) - class new (394 methods) - self - self new (34 methods) - nil (278 methods) 10
  • 11. Goin back to heuristics Heuristics on method titles - Collection-specific methods - Numeric e.g indexOf - String e.g. concatenation - Boolean e.g. anySatisfy: - Transformation e.g asCollection - Collection-preserving e.g addAll:, copy 11
  • 12. Goin back to heuristics Heuristics on method titles (127k methods) - Implicit self returns (~57k methods) - Type by name (~7,8k methods) - Single return methods (~10k methods) - Collection-specific methods - Test methods (~22,5k methods) 12
  • 13. Evaluation Inference takes ~1 minute on Mac M2 with 24 GB of RAM In Pharo 13 image heuristics cover 97,3k methods of 127k Validation - Sanity Check - Comparison with TypeInfoTools 13
  • 14. AI-Assisted In erence (Experimental) - Queries to OpenAI/Mistral for type prediction - Promising, but slow and sometimes wrong - Can complement heuristics - Need to learn lessons from Python 14
  • 15. IDE Inte ration - Type results shown on demand - CSV-based or loaded into Pharo (negligible overhead) - AI-specific settings 15
  • 16. Type results shown on demand 16
  • 17. What's Next? Combine everything! (Heuristics, other TI tools, AI, CI, ADHD, …) - Interactive Type Refinement - Create a Smalltalk “typeshed” - Allow devs to refine suggestions - Improve AI part - … 17