Skip to content

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

Hugging Face 23 min read Case study mediumAdept

Investing in Performance: Fine-tune small models with LLM insights - a CFM case study

Capital Fund Management built a financial named-entity recognition pipeline that extracts company names from Benzinga news headlines in the FNSPID dataset. Llama 3.1-70B, served on Hugging Face Inference Endpoints, pre-labels the headlines using a structured few-shot prompt and JSON-schema guided output, and humans then review those labels in Argilla. Fine-tuning compact models such as GLiNER and SpanMarker on the curated labels raises F1 to 93.4% and 90.1%. That approaches the 95% zero-shot F1 of Llama 3.1-70B at up to 80x lower inference cost. The walkthrough includes endpoint setup, prompt design, async batched requests with AsyncInferenceClient, and a comparison against weak supervision.

Related posts

  • Hugging Face x LangChain : A new partner package

    Hugging Face mediumAdept

    langchain-huggingface is a new Python partner package jointly maintained by Hugging Face and LangChain, replacing community-written integrations that had drifted out of date. It provides HuggingFacePipeline for running transformers models locally, HuggingFaceEndpoint for the serverless Inference API or deployed TGI endpoints via InferenceClient, and ChatHuggingFace, which turns message lists into model-specific prompts with tokenizer.apply_chat_template. For embeddings it offers HuggingFaceEmbeddings (local sentence-transformers) and HuggingFaceEndpointEmbeddings (Hub or TEI instances), each shown with short code examples.

  • Synthetic data: save money, time and carbon with open source

    Hugging Face mediumAdept

    An open-source LLM (Mixtral-8x7B-Instruct) can annotate task-specific data that is then used to fine-tune a small, efficient student model. On financial_phrasebank investor sentiment, a RoBERTa model trained this way matches GPT-4 at 94% accuracy and 0.94 F1 macro. It costs about $2.7 versus $3061 to analyze a large news corpus, emits roughly 0.12 kg CO2 versus an estimated 735–1100 kg, and responds in 0.13 seconds versus multiple seconds. The walkthrough covers chat templates, output cleaning, and Chain-of-Thought plus Self-Consistency prompting, which lifts zero-shot accuracy above 91.6%. It then covers validating the synthetic labels and fine-tuning with AutoTrain.

  • The model that didn't exist, so you made it yourself

    Hugging Face mediumAdept

    Six custom models were built by prompting ML Intern, an agent mode in HuggingChat, to plan, budget, train, evaluate and publish on Hugging Face hardware, for about USD 103 in total compute. The projects were a citrus-disease VLM fine-tuned from Qwen3.5-2B (14.9% to 52.8% accuracy for USD 1.90), a Huggy character LoRA on FLUX.2 klein, camera-angle and doodle-in editing LoRAs for Qwen-Image 2.1 with synthetic datasets, a 0.8B prompt rewriter distilled from a 9B teacher, and a 4-step distillation of Agate Preview 002 exported to ONNX for the browser. The prompting advice is to list verified facts so the agent doesn't re-derive them, require a zero-shot baseline and a smoke test before full training, and set a hard spending cap.

  • Mozilla AI Guide Launch with Summarization Code Example

    Mozilla Hacks mediumAdept

    Mozilla's AI Guide launches as a community resource for developers new to AI, starting with LLM basics and a section on choosing open models. A worked example shows how to pick an open summarization model: use Hugging Face to list candidates, then Papers With Code to find the most-cited dataset (CNN/DailyMail), vet its license and provenance, and compare models on ROUGE-1/2/L for abstractive summarization. Google's Pegasus fine-tuned on CNN/DailyMail is then run locally with Hugging Face Transformers. Experiments with max_new_tokens, temperature, top_k and top_p sampling show how decoding settings change summary length and quality.

  • 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).

The quest for software engineering knowledge.

Look:
Layout: