Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 15 min read Research mediumAdept

How good are LLMs at fixing their mistakes? A chatbot arena experiment with Keras and TPUs

Small instruction-tuned LLMs were given a calendar-assistant task that translates spoken requests into single-line Python API calls, then corrected in plain English when they made mistakes. Gemma 2 9B and Llama 3.1 8B completed the dialog reliably and fixed errors when told, while 1–3B models, Vicuna and Mistral 7B often failed or compounded mistakes. CodeGemma had sticky recurring errors, and online Gemini was not better despite its size. The test harness is a Gradio app on Hugging Face Spaces that shards eight models across a TPU v5e 2x4 (128GB) using Keras layout maps on JAX, keeping seven or eight sub-10B models in memory at once in bfloat16.

Assumes: LLM prompting basicsinstruction-tuned chat models

Related posts

  • “Llama 3.2 in Keras”

    Hugging Face mediumAdept

    Keras (via keras_hub) loads Llama 3.2 directly from standard safetensors Hugging Face checkpoints with on-the-fly conversion, so it has worked since day one. A tour of the workflow covers the multi-backend switch (JAX, PyTorch, TensorFlow), tokenizer-included generate/fit on raw strings, chat formatting for the Instruct model, preprocessor and backbone access, LoRA fine-tuning, and uploading presets back to the Hub. For larger models like Llama 3.1 8B, Keras's ModelParallel distribution with a device mesh and layout map shards weights across TPU/GPU cores. A custom layout map cut epoch time from 62s to 54s on an 8-core TPU v5e.

  • Building LLMs for Code Repair

    Replit hardMaster

    Replit finetuned a 7B code model (DeepSeek-Coder-Instruct-v1.5) to repair Python errors flagged by LSP diagnostics. Only 10% of these diagnostics come with deterministic fixes, while hundreds of millions are logged daily. Training data comes from replaying Operational Transformation histories to reconstruct the project state at each diagnostic. LLM-synthesized numbered line diffs are then generated with DSPy, verified, and distilled. Sentinel-token schemas replace natural-language instructions, and training ran on 8xH100 with LLM Foundry, FSDP and 4 epochs. Evaluation uses a new Replit repair benchmark plus a contamination-resistant Leetcode set built from DebugBench and recent LiveCodeBench-style problems.

  • Code Llama: Llama 2 learns to code

    Hugging Face mediumAdept

    Code Llama is a family of 7B, 13B and 34B Llama 2 derivatives trained on 500B tokens of code. It comes in base, Python-specialized and instruction-tuned variants, has a 16k training context that extrapolates to 100k via RoPE frequency scaling, and supports fill-in-the-middle infilling in the 7B and 13B models. Hugging Face integration starts at transformers 4.33, with code for completion, infilling with the <FILL_ME> token, the Llama 2 chat prompt template, and 4-bit bitsandbytes loading. Recommended setup is float16 for inference and bfloat16 for fine-tuning, plus GPU sizing guidance for TGI/Inference Endpoints and HumanEval/MultiPL-E evaluation.

  • 📚 3LM: A Benchmark for Arabic LLMs in STEM and Code

    Hugging Face mediumAdept

    3LM is a benchmark for evaluating Arabic LLMs on STEM reasoning and code generation, built from three datasets: 865 native MCQs extracted from Arabic grade 8–12 educational materials via OCR (with Pix2Tex for math) and LLM-assisted extraction, 1,744 synthetic mid-to-high difficulty MCQs generated with the YourBench pipeline, and Arabic translations of HumanEval+ and MBPP+ validated by backtranslation with a ROUGE-L F1 cutoff of 0.8. Across 40+ models, Qwen2.5-72B-Instruct led MCQ accuracy (71.8% native, 67.0% synthetic), Gemma-3-27B led completion-style STEM (43.2%), and GPT-4o led code (83.5% pass@1+ on HumanEval-ar, 63.6% on MBPP-ar). Arabic and English pass@1 scores correlate at about 0.97, and instruction-tuned models proved more robust than base models under distractor perturbation. Datasets and lighteval/evalplus evaluation scripts are open-sourced.

  • CodeGemma - an official Google release for code LLMs

    Hugging Face mediumAdept

    CodeGemma is a family of Gemma-based code models from Google: a 2B base model trained only on fill-in-the-middle infilling for fast, low-latency completion, a 7B base model mixing infilling (80%) with natural language, and a 7B instruct model for conversational coding. All have an 8K context and were trained on an extra 500B tokens. CodeGemma 7B beats most 7B peers except DeepSeek-Coder-7B on HumanEval and MultiPL-E. Practical usage covers the FIM prompt tokens, stopping generation on FIM/file-separator terminators to avoid verbose trailing output, precision choices (bfloat16 vs float16), and 4-bit loading at about 9 GB.

The quest for software engineering knowledge.

Look:
Layout: