---
title: "Investing in Performance: Fine-tune small models with LLM insights - a CFM case study"
description: "Capital Fund Management built a financial named-entity recognition pipeline that extracts company names from Benzinga news headlines in the FNSPID dataset."
url: "https://swe.quest/articles/investing-in-performance-fine-tune-small-models-with-llm-insights-a-cfm-case-116aeecc59f2bbd4"
canonical: "https://huggingface.co/blog/cfm-case-study"
source: "Hugging Face"
published: "2024-12-03"
difficulty: "medium"
kind: "Case study"
reading_minutes: 23
tags: ["model-training","llms","inference","cost-optimization","python"]
---

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

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2024-12-03, 23 min read, Case study. Original: [https://huggingface.co/blog/cfm-case-study](https://huggingface.co/blog/cfm-case-study)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Cost optimization](https://swe.quest/tags/cost-optimization.md) (Reliability & operations)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- named entity recognition
- LLM prompting ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- model fine-tuning basics ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))
- Python asyncio ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))

## Keywords

Llama 3.1, GLiNER, SpanMarker, Argilla, Hugging Face Inference Endpoints, Text Generation Inference, FNSPID

## Related posts

- [Hugging Face x LangChain : A new partner package](https://swe.quest/articles/hugging-face-x-langchain-a-new-partner-package-4a05b92542fbd2d8.md): Hugging Face · 2024-05-14 · Medium · 4 min read · LLMs, Python, Inference & serving, RAG & retrieval
  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.
- [Synthetic data: save money, time and carbon with open source](https://swe.quest/articles/synthetic-data-save-money-time-and-carbon-with-open-source-281f6f3c907e5527.md): Hugging Face · 2024-02-16 · Medium · 21 min read · Model training, LLMs, Machine learning, Cost optimization, Python
  An open-source LLM (Mixtral-8x7B-Instruct) can annotate task-specific data that is then used to fine-tune a small, efficient student model.
- [The model that didn't exist, so you made it yourself](https://swe.quest/articles/the-model-that-didn-t-exist-so-you-made-it-yourself-77bd5f69b5e22a6f.md): Hugging Face · 2026-10-08 · Medium · 9 min read · AI agents, Model training, Evaluation, Computer vision
  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.
- [Mozilla AI Guide Launch with Summarization Code Example](https://swe.quest/articles/mozilla-ai-guide-launch-with-summarization-code-example-4365124700aa44b2.md): Mozilla Hacks · 2023-11-16 · Medium · 12 min read · LLMs, Machine learning, Evaluation, Python
  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.
- [From OpenAI to Open LLMs with Messages API on Hugging Face](https://swe.quest/articles/from-openai-to-open-llms-with-messages-api-on-hugging-face-98058f09a7d2acc1.md): Hugging Face · 2024-02-08 · Medium · 7 min read · Inference & serving, LLMs, API design, RAG & retrieval
  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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
