--- title: Lolaby emoji: π colorFrom: yellow colorTo: blue sdk: gradio python_version: "3.11" sdk_version: "6.17.3" app_file: app.py pinned: true license: llama3.2 short_description: AI-powered lullabies. tags: - lullaby - children - small-models - llama-cpp - fine-tuned - on-device - build-small-hackathon - backyard-ai - text-to-audio - agentic - gradio - track:backyard - sponsor:openbmb - achievement:offgrid - achievement:welltuned - achievement:offbrand - achievement:llama - achievement:sharing - achievement:fieldnotes - badge-tiny-titan models: - build-small-hackathon/lolaby-llama-3b - openbmb/MiniCPM-V-4.6 - hexgrad/Kokoro-82M datasets: - build-small-hackathon/lolaby-traces --- # Lolaby β AI-powered lullabies Meet Lola, your personal bedtime singer. A tiny AI that watches your child's drawings and sings them a personalised lullaby. Built for the [Hugging Face **Build Small Hackathon 2026**](https://huggingface.co/build-small-hackathon) Β· **Backyard AI** track π‘ **Team:** [andyolivers](https://huggingface.co/andyolivers) & [volivers](https://huggingface.co/volivers) **Try it:** [the live Space](https://huggingface.co/spaces/build-small-hackathon/lolaby) **Demo video:** [YouTube walkthrough](https://youtu.be/eY_JnijT62E) **Field notes:** [the build journal](https://huggingface.co/blog/build-small-hackathon/lolaby-blog) **Social media post**: [live on LinkedIn](https://www.linkedin.com/posts/andyolivers_huggingface-gradio-hackathon-ugcPost-7471134065912573953-4uv2) **Models:** - [`lolaby-llama-3b`](https://huggingface.co/build-small-hackathon/lolaby-llama-3b) β lyrics - MiniCPM-V 4.6 1.3B β vision - Kokoro 82M β voice Every runtime model in Lolaby runs under **4B parameters**, keeping the full pipeline comfortably within the hackathon's **32B cap**. --- ## The Problem Getting a small child to fall asleep is a daily battle for parents and anyone who looks after kids. My partner's sister teaches kindergarten. Every day she runs nap time for fifteen 4-year-olds, and ever since they learned about music and instruments in class, it starts the same way: *"sing a song for me."* She'd love to give each child their own song, built from whatever they love that week β a stuffed fox, a new puppy, the rainbow. She doesn't have the time, the musical training, or a tool that could do it. **Lolaby is that tool.** The child shows Lola what they love β doodling on screen, or handing over a paper drawing for the teacher to photograph. The teacher types the child's name. A small, on-device AI looks at the drawing, writes a lullaby about it, and sings it back β in about a minute. Everything runs locally. No cloud LLM, no per-song API cost, no child's drawing or name ever leaving the device. No massive models β just genuinely tiny AI that fits everywhere. Lola turns any child's drawing into a unique lullaby, all on-device. ## How it works
Watch the demo β
β Drop a like, upvote, comment or share on [LinkedIn](https://www.linkedin.com/posts/andyolivers_huggingface-gradio-hackathon-ugcPost-7471134065912573953-4uv2) and [YouTube](https://youtu.be/eY_JnijT62E). ## Try it yourself **Field notes:** [the build journal](https://huggingface.co/blog/build-small-hackathon/lolaby-blog) **Web version:** [the live Space](https://huggingface.co/spaces/build-small-hackathon/lolaby) Or to run it locally: ```bash git clone https://huggingface.co/spaces/build-small-hackathon/lolaby cd lolaby pip install -r requirements.txt python app.py ``` The lyric model is fetched from the Hub on first run (~2 GB GGUF, cached after). ## Dataset The lyric model was fine-tuned on **1,500 lullabies distilled from Claude Haiku 4.5** with strict anti-boilerplate gates: per-line n-gram dedup, opener dedup, theme caps, format gates, and per-example safety screening. The dataset itself, the generator (`generate_dataset.py`), and the training notebook (`train_lullaby.ipynb`) are in the [`train/`](./train/) folder. Regenerating the dataset requires an Anthropic API key; running the deployed app does not. Full details in the [model card](https://huggingface.co/build-small-hackathon/lolaby-llama-3b) and the [Field Notes blog post](https://huggingface.co/blog/build-small-hackathon/lolaby-blog). ## Repository ``` . βββ app.py # Gradio entrypoint βββ requirements.txt βββ utils/ β βββ safety.py # Content-safety filter βββ draw/ # Drawing-related helpers β βββ vision.py # MiniCPM-V 4.6 wrapper β βββ strokes.py # NumPy fallback if vision is unavailable βββ synths/ # Custom DSP instruments + Kokoro voice β βββ guitar.py β βββ piano.py β βββ musicbox.py β βββ harp.py β βββ xylophone.py β βββ ocarina.py β βββ voice.py βββ train/ # Dataset + training (build-time only; not used at runtime) β βββ generate_dataset.py β βββ train_lullaby.ipynb β βββ lullaby_dataset.jsonl βββ tests/ # Sanity checks for audio + LLM + voice ``` ## Safety Lolaby is built for small children, so safety isn't an afterthought β it's wired through the pipeline at three points: - **At training time** β every example in the lyric model's training set was screened during dataset distillation. The model learned from already-wholesome material, not from the open web. - **At input time** β when a user types a *love* or *fear*, the text is screened against a curated list of terms inappropriate for a child's lullaby (death, weapons, horror, substances, self-harm). Anything matching gets a gentle redirect ("Let's keep the lullaby to gentle, cosy thingsβ¦") instead of a generation. - **At generation time** β the same filter is shared between the runtime app and the dataset generator, so the training data and the live app can never enforce different rules. ## Limitations - **English only.** The lyric model was trained on English data. - **First-time Space cold-start** might take some time while all models pre-warm at boot. - **Strange or unusual loves** may be gently generalised by the lyric model into a nearby comforting concept β that's a deliberate behaviour for a bedtime song (soft landing > literal lookup) and described in the model card. - **Children's drawings are interpreted by an AI** that maps rough shapes and colours onto familiar concepts β much like an adult parent guessing what a kid drew. It can miss subtle details: a stick figure becomes "a little person", a wobbly square with a triangle becomes "a house". The "Lola sawβ¦" hint shows exactly what she understood, so you can redraw or use the What do they love? field instead. ## Credits - **[Meta](https://ai.meta.com/llama/)** β Llama 3.2 3B Instruct (base model, used under the Llama 3.2 Community License). - **[OpenBMB](https://huggingface.co/openbmb)** β MiniCPM-V 4.6 (vision). - **[hexgrad/Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M)** β TTS voice. - **[Unsloth](https://github.com/unslothai/unsloth)** β 4-bit + LoRA training stack. - **[Hugging Face & Gradio](https://huggingface.co/build-small-hackathon)** β for hosting the Build Small Hackathon and creating space for small-AI projects. ## License Apache 2.0 for the app code in this repo. The lyric model weights inherit the **Llama 3.2 Community License** from their base β see the [model card](https://huggingface.co/build-small-hackathon/lolaby-llama-3b) for full terms. ---
Built with bedtime magic. β¨
Lolaby β’ 2026