File size: 1,706 Bytes
04dc12d f499485 04dc12d f499485 04dc12d f499485 04dc12d f499485 04dc12d f499485 33556a6 f499485 33556a6 5d18f7c f499485 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ---
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.
|