Fine-tuning Mistral 7B for Multilingual Defense Intelligence Sentiment Analysis

vannevar_labs · Government · 2024 · source Agentic: no · promotional bias: high · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: defense intelligence sentiment analysis

Vannevar Labs needed more accurate and efficient multilingual sentiment analysis for news, blogs, and social media tied to strategic narratives, because GPT-4 prompting was expensive, only reached about 65% accuracy, and struggled with lower-resourced languages such as Tagalog.

Constraints:

Architecture

Vannevar Labs used Databricks to build an end-to-end compound AI system for data ingestion, model fine-tuning, and deployment. They fine-tuned an open-source Mistral 7B model with domain-specific data, targeted single-NVIDIA-A10 deployment for low latency, used MCLI and Python SDK tooling to orchestrate GPU nodes and container images, connected securely to datasets for ingestion, monitored training with third-party tooling, then converted trained models to Hugging Face format and exported them to S3 or the Hugging Face Model Repository for production use.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  multilingual-narrative-data-sources[Multilingual narrative data sources]
  databricks-ingestion-and-training-workspace[Databricks ingestion and training workspace]
  mcli-and-python-sdk[MCLI and Python SDK]
  mistral-7b-fine-tuning-job[Mistral 7B fine-tuning job]
  monitoring-tools[Monitoring tools]
  hugging-face-conversion-and-export[Hugging Face conversion and export]
  production-sentiment-model[Production sentiment model]
  multilingual-narrative-data-sources --> databricks-ingestion-and-training-workspace
  databricks-ingestion-and-training-workspace --> mcli-and-python-sdk
  databricks-ingestion-and-training-workspace --> mistral-7b-fine-tuning-job
  databricks-ingestion-and-training-workspace --> monitoring-tools
  mcli-and-python-sdk --> mistral-7b-fine-tuning-job
  mistral-7b-fine-tuning-job --> monitoring-tools
  mistral-7b-fine-tuning-job --> hugging-face-conversion-and-export
  hugging-face-conversion-and-export --> production-sentiment-model
  production-sentiment-model --> multilingual-narrative-data-sources
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Multilingual narrative data sources Public news, blogs, and social media content related to specific strategic narratives. Databricks ingestion and training workspace
Databricks ingestion and training workspace End-to-end platform for ingestion, fine-tuning, deployment preparation, and orchestration. MCLI and Python SDK, Mistral 7B fine-tuning job, Monitoring tools
MCLI and Python SDK Orchestrates GPU nodes, container images, data ingestion, and training/deployment lifecycle tasks. Databricks ingestion and training workspace, Mistral 7B fine-tuning job
Mistral 7B fine-tuning job Adapts the open-source 7B parameter model to Vannevar's multilingual sentiment-analysis task. Hugging Face conversion and export, Monitoring tools
Monitoring tools Tracks fine-tuning runs through integrations such as Weights & Biases. Mistral 7B fine-tuning job
Hugging Face conversion and export Converts trained models to standard Hugging Face format and exports them to S3 or Hugging Face repositories. Production sentiment model
Production sentiment model Classifies sentiment of multilingual intelligence content for defense mission applications. Multilingual narrative data sources

Data flow

Publicly available multilingual narrative data is found, aggregated, and ingested into Databricks. The team uses MCLI and the Python SDK to manage GPU nodes, container images, training parameters, and dataset access, then fine-tunes Mistral 7B on domain-specific labels. Training runs can hook into monitoring tools such as Weights & Biases. After training, the model is converted to standard Hugging Face format and exported to S3 or Hugging Face for production deployment.

“Using Databricks, Vannevar built an end-to-end compound AI system supporting data ingestion, model fine-tuning and deployment”article, stated
“MCLI’s robust capabilities for data ingestion allowed seamless, secure connection to Vannevar’s datasets, and played a crucial role in the model training lifecycle.”article, stated

Why this architecture

The team selected a fine-tuned smaller open-source model because GPT-4 prompting was too expensive and inaccurate for the multilingual task, while Mistral 7B could run on a single A10 GPU with lower real-time latency and be trained on domain-specific data inside Databricks.

“The best results we could get were around 65% accuracy, and it was overall too expensive for us”article, stated
“To meet the real-time demands of our applications, we needed a smaller model to fit on a single A10 and have very low real-time latency”article, stated

Models used: Mistral 7B · GPT-4

Scale

Alternatives considered (roads not taken)

GPT-4 with prompt engineering

Rejected because: it reached only about 65% accuracy, was too expensive, and struggled with lower-resourced languages.

“Punma’s team struggled with the limitations of using GPT-4 and prompt engineering, which did not yield satisfactory results for their specific needs.”article, stated

larger or less deployable models

Rejected because: the application needed a model small enough for single-A10 deployment and low real-time latency.

“we needed a smaller model to fit on a single A10 and have very low real-time latency”article, stated

manage fine-tuning infrastructure manually

Rejected because: GPU scarcity and orchestration overhead made infrastructure management part of the bottleneck.

“they encountered several hurdles, particularly in spinning up the necessary GPU resources to fine-tune these models, as GPUs were in short supply at the time.”article, stated

Patterns

fine-tuning-adaptation (model-operations)

Vannevar fine-tuned Mistral 7B on domain-specific multilingual sentiment data to outperform GPT-4 prompting for its defense-intelligence task.

“Specifically, they fine-tuned Mistral’s 7B parameter model using domain-specific data.”article, stated

latency-optimization (serving)

The model choice and deployment target were optimized for a single A10 GPU and low real-time latency.

“To meet the real-time demands of our applications, we needed a smaller model to fit on a single A10 and have very low real-time latency”article, stated

observability-tracing (operations)

Training orchestration used MCLI-managed configurations with third-party monitoring hooks such as Weights & Biases.

“The MCLI managed configurations allowed us to easily adapt training parameters and efficiently train across multiple GPUs, hooking into third-party monitoring tools like Weights & Biases.”article, stated

cost-aware-routing (serving)

The team replaced an expensive GPT-4 prompting path with a fine-tuned smaller model that was faster and more cost-effective.

“On all three fronts — accuracy, cost and speed — the fine-tuning solution built and trained with Databricks came out ahead.”article, stated

Tradeoffs

Fine-tune Mistral 7B instead of continuing GPT-4 prompting.

Chose domain-adapted open-source smaller model over GPT-4 prompt engineering.

Rationale: GPT-4 was too expensive and inaccurate for the multilingual task, while fine-tuned Mistral improved accuracy, cost, and speed.

“The best results we could get were around 65% accuracy, and it was overall too expensive for us”article, stated

Target a single-A10 deployment footprint.

Chose Mistral 7B sized for one NVIDIA A10 over larger models that would require heavier serving infrastructure.

Rationale: Real-time mission applications needed low latency and practical GPU deployment.

“This model was chosen for its open source nature and its ability to efficiently operate on a single NVIDIA A10 Tensor Core GPU.”article, stated

Use Databricks tooling for model lifecycle orchestration.

Chose MCLI, Python SDK, managed YAML configurations, and platform export over manual GPU/container orchestration.

Rationale: Infrastructure management affected iteration speed, and managed tooling simplified training parameters, GPU scaling, monitoring, and export.

“Databricks also facilitated efficient training across multiple GPUs by managing the configurations through YAML files”article, stated

Gotchas (what bit them)

GPT-4 prompting did not meet task accuracy or cost needs.

Root cause: The sentiment task involved multilingual defense-domain data, including lower-resourced languages where GPT-4 struggled.

Resolution: Vannevar fine-tuned Mistral 7B on domain-specific data through Databricks.

“There was also a multilingual problem. We have data in Tagalog, Spanish, Russian and Mandarin, and GPT-4 struggled with lower-resourced languages like Tagalog.”article, stated

Fine-tuning cycles were constrained by GPU access and infrastructure management.

Root cause: The team had to spin up GPU resources and manage training infrastructure while GPUs were in short supply.

Resolution: Databricks MCLI and managed configurations simplified orchestration, scaling, monitoring, and multi-GPU training.

“Challenges in orchestration and infrastructure management further complicated his team’s efforts.”article, stated

Instruction labels were a companywide bottleneck.

Root cause: The fine-tuning approach required enough domain-specific instruction labels for the task.

Resolution: The customer story does not describe a full labeling-system solution, but the Databricks workflow shortened training/deployment iteration once data was available.

“Gathering a sufficient number of instruction labels to fine-tune these models was a companywide challenge.”article, stated

Evaluation

The case compares the Databricks-trained fine-tuned model with the previous GPT-4 prompting baseline across accuracy/F1, cost, and latency for multilingual sentiment analysis.

Metrics: GPT-4 prompt baseline around 65% accuracy · fine-tuned model overall F1 score of 76% · 75% latency reduction versus previous implementations · fully functional model deployed within two weeks

“The fine-tuned model achieved an overall F1 score of 76%, an improvement over the 65% accuracy previously achieved with GPT-4”article, stated
“Latency time was reduced by 75% compared with previous implementations.”article, stated

Outcomes

The system supports defense mission applications for hundreds of users across DoD branches, processing multilingual public narrative data and enabling large backfill jobs.

“The latency is way faster — a quarter of the time — so we’re able to run large backfill jobs and process significantly more data more efficiently.”article, stated