Skip to content

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

Mozilla Hacks 19 min read Case study mediumAdept

So you want to build your own open source ChatGPT-style chatbot…

Mozilla's innovation team built a self-hosted, open source LLM chatbot prototype on its own GCP infrastructure during a one-week hackathon, and walks through each layer of the stack and the tradeoffs behind each choice. Hugging Face's text-generation-inference proved hard to deploy because of CUDA and driver requirements, so the team switched to llama.cpp on a CPU-only AMD server, using its OpenAI-compatible Python bindings. That decision limited them to LLaMA-architecture models, and licensing restrictions on LLaMA-derived weights narrowed the list further, so they picked LLaMA 2 after a manual evaluation of bias and safety. They also used embeddings and vector search to add internal Mozilla knowledge, stressing that every choice in the stack constrains the others.

Related posts

  • Open-source LLMs as LangChain Agents

    Hugging Face mediumAdept

    Open-source LLMs can now serve as reasoning engines for tool-using ReAct agents, with Mixtral-8x7B outperforming GPT-3.5 out of the box on a mixed benchmark drawn from HotpotQA, GSM8K and GAIA, graded by GPT-4-as-a-judge. The ReAct loop works by prompting for a Thought plus a JSON tool call or a Final Answer, then parsing the output, running the tool and appending the Observation to the prompt. Agents are built in LangChain with the new ChatHuggingFace wrapper. Llama2-70b and Zephyr-7b perform poorly. About 10% of Mixtral's GAIA failures come from malformed tool arguments, so fine-tuning for function calling is the recommended next step. Giving models a calculator lifts zero-shot GSM8K scores, though only 20 questions were tested.

  • Llama 2 is here - get it on Hugging Face

    Hugging Face mediumAdept

    Meta's Llama 2 family (7B, 13B, 70B base and RLHF-tuned chat models) is released under a commercially usable license, trained on 40% more tokens than Llama 1 with 4k context and grouped-query attention for the 70B model, and is integrated across the Hugging Face ecosystem. Inference runs through transformers 4.31 or Text Generation Inference and Inference Endpoints, with recommended GPU sizes per model (A10G for 7B, A100 for 13B, 2-4x A100 for 70B). The 7B model can be fine-tuned on a single 16GB T4 using QLoRA and trl's SFTTrainer. The chat prompt format uses [INST] and <<SYS>> delimiters, and prompts must match the training template exactly for system prompts and multi-turn conversations to work.

  • From OpenAI to Open LLMs with Messages API on Hugging Face

    Hugging Face mediumAdept

    Text Generation Inference 1.4.0 adds a Messages API compatible with OpenAI's Chat Completion API, so open LLMs on Inference Endpoints can be called from existing OpenAI client code by changing the base URL and token. The guide deploys Nous-Hermes-2-Mixtral-8x7B-DPO via huggingface_hub with TGI token-limit settings and then calls it from the OpenAI Python and JavaScript clients. It also plugs the endpoint into LangChain (ChatOpenAI) and LlamaIndex (OpenAILike) RAG pipelines. Limitations: no function calling, only models with a chat_template, and a subset of parameters (stream, max_tokens, temperature, top_p, seed, logprobs, frequency_penalty).

  • Liberate your OpenClaw

    Hugging Face mediumAdept

    With Anthropic restricting Claude access in open agent platforms for Pro/Max subscribers, OpenClaw agents can be moved to open models either through Hugging Face Inference Providers or by running a model locally. The hosted path uses `openclaw onboard` with a Hugging Face token and a model ID such as GLM-5, which is recommended for its Terminal Bench scores. The local path runs Qwen3.5-35B-A3B GGUF via llama.cpp's `llama-server` on about 32GB of RAM and points OpenClaw at its OpenAI-compatible endpoint. Hosted is the quickest way back, while local gives privacy, no API bill and no rate limits.

  • How to Make an AI Chatbot from Scratch using Docker Model Runner

    Docker mediumAdept

    A local GenAI chatbot built on Docker Model Runner, which runs llama.cpp models natively on the host and exposes an OpenAI-compatible API to containers. A Go backend uses the OpenAI client to stream tokens over SSE to a React/TypeScript UI. The backend also acts as a metrics bridge, exporting llama.cpp-specific Prometheus gauges such as tokens per second, context size, prompt evaluation time and memory per token, alongside Grafana dashboards and Jaeger tracing. The walkthrough covers pulling Llama 3.2 1B, starting the stack with docker compose, wiring Grafana to Prometheus, and the key code paths.

The quest for software engineering knowledge.

Look:
Layout: