Manimancer-4B

Manimancer-4B is a fine-tuned version of Qwen3-4B (4B parameters) that writes Manim animation code from natural-language descriptions. Describe a concept, algorithm or scene, and the model returns a Python Manim script you can render into a video.

This repository contains the GGUF quantized build (Q4_K_M, ~2.5 GB) for local inference with llama.cpp, Ollama, LM Studio and similar tools.

Model Details

Base model Qwen3-4B
Parameters ~4B
Architecture Qwen3 (decoder-only transformer)
Fine-tuning task Natural language โ†’ Manim (Python) scene code
Format GGUF, Q4_K_M (4-bit), file: manimancer-4b.Q4_K_M.gguf
Language English prompts, Python output
License Apache 2.0 (inherited from the base model)
Developed by rachitgoyell

Intended Use

  • Generating Manim scenes for math, CS and science explainers
  • Turning algorithm or code walkthroughs into animation scripts
  • Drafting a first version of a scene that you then refine by hand
  • Running fully offline on consumer hardware (CPU or modest GPU)

Out of Scope

  • General-purpose chat or reasoning (the fine-tune is specialised for Manim)
  • Executing generated code without review or sandboxing
  • Safety-critical or production use without human oversight

How to Use

Ollama

ollama run hf.co/rachitgoyell/Manimancer-4B:Q4_K_M

llama.cpp

llama-cli -hf rachitgoyell/Manimancer-4B:Q4_K_M \
  -p "Write a Manim scene that animates binary search on a sorted array."

Python (llama-cpp-python)

pip install llama-cpp-python huggingface_hub
from llama_cpp import Llama

llm = Llama.from_pretrained(
    repo_id="rachitgoyell/Manimancer-4B",
    filename="manimancer-4b.Q4_K_M.gguf",
    n_ctx=4096,
    n_gpu_layers=-1,  # set to 0 for CPU only
)

out = llm.create_chat_completion(
    messages=[
        {"role": "system", "content": "You are an expert Manim developer. Respond with a complete, runnable Manim scene in Python."},
        {"role": "user", "content": "Animate the Pythagorean theorem with a visual proof."},
    ],
    temperature=0.3,
    max_tokens=1500,
)
print(out["choices"][0]["message"]["content"])

Rendering the output

Save the generated code as scene.py, then:

pip install manim
manim -pql scene.py YourSceneName

Prompting Tips

  • Be specific about what should appear on screen and in what order
  • Name the objects you want (axes, arrays, graphs, equations)
  • Use a low temperature (0.2โ€“0.4) for more reliable, runnable code
  • Ask for one scene at a time and iterate

Limitations and Risks

  • Generated code can fail. Scripts may have API errors, hallucinated Manim methods or version mismatches. Test and debug before relying on them.
  • Version sensitivity. Manim Community and ManimGL differ; the model may mix their APIs.
  • Visual quality is not guaranteed. Layout, timing and overlap often need manual tweaking.
  • Quantization trade-off. Q4_K_M is compact and fast but slightly less accurate than full-precision weights.
  • Run untrusted code safely. Always review LLM-generated Python, and run it in a sandbox or container, before executing it.

Acknowledgements

Citation

@misc{manimancer-4b,
  author = {rachitgoyell},
  title  = {Manimancer-4B},
  year   = {2026},
  url    = {https://huggingface.co/rachitgoyell/Manimancer-4B}
}
Downloads last month
48
GGUF
Model size
4B params
Architecture
qwen3
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for rachitgoyell/Manimancer-4B

Finetuned
Qwen/Qwen3-4B
Quantized
(364)
this model