How pedroarruda07/functiongemma_fine-tune works
This repo is not a “service” or “app” in the classic sense; it’s an ML fine-tuning + evaluation + conversion pipeline packaged as two Jupyter notebooks (Colab + Kaggle variants). The system you’re diagramming is the end-to-end lifecycle:
FunctionGemma 270M (base) → prepare Mobile Actions dataset → fine-tune with LoRA / optional QLoRA using TRL+PEFT → evaluate (tool accuracy / exact match) → export artifacts (checkpoints + .litertlm) → deploy/run in Edge Gallery / edge devices.
So the “architecture” is primarily a workflow architecture with key components (data, training runtime, libraries, model registry, conversion target, consumer runtime).
File tree analysis (what exists / what’s missing)
Top-level:
• notebooks/
• colab-finetune_functiongemma_270m_for_mobile_actions_with_LoRA.ipynb
• kaggle-finetune_functiongemma_270m_for_mobile_actions_with_LoRA.ipynb
These are the source of truth for the pipeline logic (setup → data → train → eval → export).
• results/
• scored_df_20251228_base.json
• scored_df_20251228_trained_full_finetuned.json
• scored_df_20251228_trained_lora.json
These are evaluation outputs (evidence artifacts), useful for showing “metrics generation” in the flow.
• assets/
• demo gif for Edge Gallery usage (deployment consumer).
README-derived architecture signals (explicit components)
• Base model: FunctionGemma 270M (instruction-tuned)
• Dataset: Mobile Actions dataset
• Fine-tuning method: LoRA (optional QLoRA)
• Frameworks: Hugging Face TRL + PEFT
• Optimizer: paged_adamw_32bit (especially relevant when QLoRA is enabled)
• Training env: Colab or Kaggle with single NVIDIA T4
• Outputs:
• trained checkpoint (LoRA adapters / merged model depending on notebook)
• evaluation JSON in /results
• .litertlm export for edge deployment
• External distribution: Hugging Face model repo hosting .litertlm
• Deployment consumer: Edge Gallery (Mobile Actions section) / supported edge devices
Notebook Orchestrator
• “Colab Notebook” and “Kaggle Notebook” as two entrypoints (same logical pipeline, different secrets/paths)
Runtime / Compute
Execution Environment
• Colab or Kaggle runtime
• GPU: NVIDIA T4
Data Plane
Mobile Actions Dataset Source
• wherever it’s pulled from in the notebook (show as external “Dataset provider”)
Base Model Source
• “FunctionGemma 270M” from model provider (likely Hugging Face / Google release; represent as external registry)
Fine-tuning Engine
• TRL Trainer (conceptually) + PEFT LoRA injection
Quantization Branch (optional)
• QLoRA path (bitsandbytes/4-bit quant) as a conditional subcomponent
Optimizer
• paged_adamw_32bit (connect to training loop)
Evaluation
Evaluation / Scoring
• computes: Correct Tool Accuracy, Exact Match Rate
Results Artifacts
• writes JSON to results/*.json
Packaging / Export
Checkpoint Saving
• LoRA adapter weights / final weights
Conversion to .litertlm
Distribution / Deployment
Model Hosting
• Hugging Face repo (external)
Edge Consumer
• Edge Gallery / edge device runtime loading .litertlm
Architectural patterns / principles actually used here
This repo is best described as:
• Notebook-driven ML pipeline (single orchestrator script, multiple stages)
• Artifact-oriented workflow: dataset → checkpoints → metrics JSON → export format
• Parameter-efficient fine-tuning (LoRA/QLoRA) rather than full model updates
• Environment-specific entrypoints: Colab vs Kaggle notebooks (same architecture, different integration details)
Technologies
• Hugging Face TRL (training loop)
• PEFT (LoRA injection)
• LoRA / QLoRA (parameter-efficient tuning strategy)
• Paged AdamW 32-bit (optimizer)
• FunctionGemma 270M (base)
• .litertlm (edge packaging target)
• Colab/Kaggle + T4 (compute constraints that justify LoRA/QLoRA)
Labels
• Use explicit artifact names:
• “Base Model Weights (FunctionGemma 270M)”
• “LoRA Adapter Weights”
• “Evaluation JSON (results/scored_df_*.json)”
• “.litertlm package”
Boundaries (important)
• “This repository” (notebooks + results)
• “External providers” (dataset, base model registry, Hugging Face hosting, Edge Gallery)
A “best possible” component breakdown for this repo (what to literally put on the canvas)
• User/Engineer
• Notebook (Colab) / Notebook (Kaggle)
• Runtime: Colab/Kaggle VM + NVIDIA T4
• Env setup (pip installs / auth / secrets)
• Dataset download
• Dataset preprocessing + prompt formatting
• Tokenizer
• Base model download (FunctionGemma 270M)
• LoRA config (r=16, alpha=32, dropout=0.1, target Linear modules...)
• (Optional) QLoRA quantization
• Training loop (TRL)
• PEFT adapter injection
• Optimizer: paged_adamw_32bit
• Checkpoint output
• Evaluation
• Metrics computation
• Results JSON in /results
• Convert to .litertlm
• Hugging Face model repo
• Edge Gallery / edge device runtime
That level of decomposition matches the README and avoids inventing absent code structure.