Few-shot example injection #15

Open
opened 2026-04-07 20:23:30 +00:00 by austin · 0 comments
Owner

Implement automatic few-shot example selection from the project codebase.

  • Given a generation task, find similar existing code in the project (via embedding similarity + structural matching)
  • Include 1-3 examples in the prompt as demonstrations of the project's style and patterns
  • Examples should show the same kind of construct the model is being asked to produce (e.g., if writing an API handler, show existing API handlers)
  • Trim examples to fit within the few-shot budget allocation

Small models benefit enormously from in-context examples. A 3B model asked to "write a test" with zero examples produces generic code; shown two tests from the same project, it matches the style and conventions.

Implement automatic few-shot example selection from the project codebase. - Given a generation task, find similar existing code in the project (via embedding similarity + structural matching) - Include 1-3 examples in the prompt as demonstrations of the project's style and patterns - Examples should show the same kind of construct the model is being asked to produce (e.g., if writing an API handler, show existing API handlers) - Trim examples to fit within the few-shot budget allocation Small models benefit enormously from in-context examples. A 3B model asked to "write a test" with zero examples produces generic code; shown two tests from the same project, it matches the style and conventions.
austin added this to the Context Assembly milestone 2026-04-07 20:29:38 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
austin/localcode#15
No description provided.