Speaker Notes

Agentic coding workflows with small models

Small language models complement frontier models in developer workflows, offering cost-efficient local execution when properly configured with quantization, expanded context, and task orchestration.

Android Developers · 31:32 · YouTube ↗

Talk · 3 speakers  Intermediate · concepts and setup strategy

Highlights

5 clips · 6 min of 32 min
    • Post-training quantization shrinks model weights but harms output accuracy.
    • Quantization-aware training minimizes accuracy loss during model compression.
    • Mixed mobile quantization fits large models onto consumer mobile hardware.
    • A smaller drafter model predicts tokens verified by a larger model using a shared KV cache.
    • Delivers up to a 3x speedup with zero quality loss.
    • Highly effective for predictable structured outputs like JSON and code.
    • Small context windows cause agent harnesses to evict critical files during compaction.
    • Increasing context from 32k to 256k doubled task success rates in Android bench tests.
    • Maximize the model's supported context window rather than relying on default limits.
    • Add explicit verification hints for unit tests, emulators, and build commands.
    • Avoid bloated system prompts and massive tool descriptions that degrade small model performance.
    • Set up fallback models to avoid downtime, rate limits, or offline blocks.
    • Use small models for execution with advisor or peer-review models for validation.
    • Cascade tasks from frontier planning models to small execution models for cost efficiency.

Questions this video answers

9 · every answer cites the moment it was said
01 How do small language models compare to frontier models in cost and capability? 2 sources · 1:28

Small language models are significantly more cost-effective, running datasets at a fraction of the cost of frontier models. While frontier models handle complex tasks easily, small models can solve a substantial percentage of common tasks when properly guided.

02 What are the primary reasons to choose a local small model over a cloud API? 2 sources · 6:18

Developers choose local models for data privacy, zero latency without round trips to servers, zero marginal cost during error loops, and offline access. These benefits make local execution ideal for sensitive code and disconnected environments.

03 How does quantization reduce memory requirements for running models locally? 2 sources · 7:31

Quantization shrinks the precision of model weights, such as compressing a 16-bit floating-point model down to a 4-bit integer format. This dramatically reduces video RAM requirements so the model can fit on standard consumer hardware.

04 What is speculative decoding and how does it speed up generation? 2 sources · 8:58

Speculative decoding uses a smaller drafter model to predict a few upcoming tokens ahead of time, which are then validated by the larger model. Because they share the same context cache, this technique achieves significant speedups without degrading output quality.

05 Why is expanding the context window important for small model performance? 2 sources · 10:43

Small models can fail tasks if important files or logs are pushed out of memory by agent compaction. Increasing the context window ensures the model retains critical file information and significantly improves its success rate.

06 How can developers evaluate whether a model configuration is ready for their tasks? 2 sources · 12:10

Developers can use a readiness framework that scores tasks based on reliability, latency thresholds, and RAM usage alongside the model and hardware configuration. Green scores indicate the setup is ready, while other colors suggest adjustments are needed.

07 What types of coding tasks are small models best suited for? 2 sources · 20:22

Small models excel at small tasks like basic Compose layouts and medium tasks that require reading and writing just a few files. However, they struggle with long horizon tasks like massive migrations that span dozens of files.

08 What adjustments can developers make to help small models succeed on tasks? 2 sources · 24:31

Developers can improve small model success by ensuring full context windows are enabled, using CLI tools for niche documentation, and adding verification hints for tests. Avoiding bloated system prompts also prevents performance degradation.

09 How does model orchestration provide resilience and efficiency in workflows? 2 sources · 27:54

Orchestration allows developers to set up fallback models to prevent workflow blocks during provider outages or offline scenarios. It also enables cascading tasks, routing simpler jobs to smaller models and complex planning to frontier models for cost efficiency.

Section-by-section summary

6 parts

Small language models complement frontier models efficiently

Small language models offer a highly cost-efficient alternative to frontier models for many standard coding tasks. While they solve roughly 50 percent of medium-to-hard tasks out of the box, they consume a fraction of the tokens and cost significantly less.

Understanding small model types and architectures

The small model ecosystem includes autoregressive models for token prediction, diffusion models for block generation, and embedding models for semantic mapping. Specialized models also exist for specific jobs like function calling, classification, and vision.

Evaluating local model hardware and quantization trade-offs

Running models locally provides privacy, zero marginal cost, offline access, and zero network latency. Hardware deployment relies on quantization and quantization-aware training to drastically reduce RAM footprints without sacrificing output accuracy.

Trying local models directly in Android Studio

Developers can easily integrate and test models like Gemma locally using Android Studio's model provider settings. Switching models mid-conversation resets context, so managing conversation state is critical when swapping backends.

Task categorization using Android bench evaluations

Coding tasks are categorized into small, medium, big, and long-horizon based on scope and complexity. While small models excel at localized edits and basic Compose tasks, they often skip verification steps and require targeted assistance for broader architectural changes.

Orchestrating models for resilience and cost savings

Advanced orchestration prevents downtime via fallbacks and improves answers through peer review or consensus workflows. Routing initial planning through frontier models while cascading execution to small models maximizes token and cost efficiency.

0:00 / 31:32
k play/pause · f fullscreen · m mute
n next · p previous clip · t highlights/full
< > slower/faster · / search what was said
  • Small language models15× · first 0:28

    Language models with smaller parameter sizes used to complement frontier models in developer workflows.

  • Quantization4× · first 7:25

    A process that shrinks model precision to reduce memory footprints and fit on local hardware.

  • Speculative decoding1× · first 9:00

    A technique using a smaller drafter model to predict tokens and a larger model to validate them for speedups.

  • Android Studio5× · first 2:27

    An integrated development environment where local models like Gemma can be run directly.

  • Android bench4× · first 10:35

    A benchmark capturing the Android ecosystem and developer tasks for agent evaluation.

  • Context window7× · first 5:31

    The space available for processing data and maintaining model memory during tasks.

  • Embedding models1× · first 4:14

    Specialized models that turn concepts into high-dimensional vectors for similarity comparisons.

  • Quantization aware training1× · first 8:00

    A technique where models are trained to handle smaller sizes to prevent accuracy loss.