austindixson's picture
Oct 30 full-context results; Oct 28 accuracy gains labeled as cap effects
3547d74 verified
|
Raw History Blame
1.71 kB
metadata
title: Python sandbox math demo
emoji: 🧮
colorFrom: blue
colorTo: gray
sdk: static
app_file: index.html
pinned: false
license: mit
short_description: Same question with and without a run_python tool.

Python sandbox math demo

This Space shows a small local model (LFM3-1.7B) answering the same math question twice: once on its own, and once with a sandboxed run_python tool. For each side you see the answer, the generated tokens, the time and the tool calls.

It replays recorded runs. It is not live. Hugging Face now needs a PRO subscription to host a Gradio Space on free CPU, so this is a static Space. The runs were recorded with live/app.py (included here) on a 2-thread Linux machine using the bwrap sandbox backend.

Tool code and results: https://huggingface.co/austindixson/python-sandbox-math-tool

Notes:

  • To run it live yourself: cd live && pip install -r requirements.txt && python app.py. It downloads llama.cpp b11938 and the LFM3-1.7B Q4_0 GGUF on first start (Linux x64). On 2 CPU cores, expect up to a minute per side.
  • At full context (Oct 30 run on an A100), the tool gave about the same accuracy as no tools and used 6 to 23% fewer tokens per solved problem. The accuracy gains in the earlier capped runs were cap effects. Write-up: https://www.destroyrebuild.xyz/blog/lfm3-python-tool-full-context
  • The demo caps each answer at 1,024 tokens. That is not the 25,000-token budget used in the recorded evaluation. A small cap exaggerates the gap, because the no-tools side often runs out before it finishes.
  • On Linux the sandbox is bubblewrap if user namespaces work, otherwise a weaker fallback. On a Mac the tool uses sandbox-exec, which is stronger.