Model reference · open weights
Sentiment-Analysis is an open-weight language model from microsoft. Sentiment-Analysis-7B (BF16) weighs 14.5 GB; the smallest configuration that runs it is 2× RTX 3060 12 GB.
For self-hosting, compare this build's requirements below with the GPU you plan to rent.
Summary of the microsoft/Sentiment-Analysis-7B model card, 2026-10-21
What it is
| Released by | microsoft |
|---|---|
| Released | 2026-10-17 |
| Parameters | 7.2B |
| VRAM | 14.5 GB for the weights |
What it runs on
| Card | Requests at once | Context max | Memory | |
|---|---|---|---|---|
| 8K each | 32K each | |||
| RTX 3060 12 GB | 11.6 GB | |||
| RTX 4060 Ti 16 GB | 2K | 15.4 GB | ||
| RTX 3090 24 GB | 7 | 1 | all 32K | 23.4 GB |
| RTX 4090 24 GB | 7 | 1 | all 32K | 23.4 GB |
| RTX 5090 32 GB | 14 | 3 | all 32K | 31.0 GB |
| L40S 48 GB | 26 | 6 | all 32K | 44.0 GB |
| A100 80 GB | 58 | 14 | all 32K | 78.2 GB |
| H100 80 GB | 55 | 13 | all 32K | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | 70 | 17 | all 32K | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | 83 | 20 | all 32K | 107 GB |
| H200 141 GB | 111 | 27 | all 32K | 138 GB |
| B200 180 GB | 146 | 36 | all 32K | 176 GB |
| 2× RTX 3060 12 GB tensor parallel | 6 | 1 | all 32K | 11.6 GB a card |
| 2× RTX 4060 Ti 16 GB tensor parallel | 14 | 3 | all 32K | 15.4 GB a card |
| 2× RTX 4090 24 GB tensor parallel | 28 | 7 | all 32K | 23.4 GB a card |
| 2× RTX 3090 24 GB tensor parallel | 28 | 7 | all 32K | 23.4 GB a card |
| Requests at once | 8K tokens each | 32K tokens each |
|---|---|---|
| 1 | 16.2 GB | 19.4 GB |
| 5 | 20.5 GB | 36.6 GB |
| 8 | 23.7 GB | 49.5 GB |
| 16 | 32.3 GB | 83.8 GB |
| 32 | 49.5 GB | 153 GB |
| 64 | 83.8 GB | 290 GB |
One card, with vLLM's small-card settings.
From the model card
Sentiment-Analysis-7B is a 7B-parameter autoregressive language model fine-tuned for sentiment classification of user messages directed at a service, product, or agent (the "Target"). It is built on top of mistralai/Mistral-7B-Instruct-v0.2 and was fine-tuned with reinforcement learning, using an LLM as a judge, on a small internal training set of ~300 examples. No pre-defined labels were used for training.
Given a user message, the model generates a response in the following format: the first token is the sentiment label (Negative, Neutral, or Positive), followed by a short explanation of the decision. If only the label is needed, set max_new_tokens=3.
The evaluation metric used is accuracy. The following compares the base model with the fine-tuned model.
| model | accuracy |
|---|---|
| mistralai/Mistral-7B-Instruct-v0.2 | 62.0% |
| Sentiment-Analysis-7B (ours) | 72.8% |
The model is a causal language model and is loaded with AutoModelForCausalLM. The sentiment label is always the first generated token, so setting max_new_tokens=3 returns the label only. Use the system prompt below, which defines the "Target" and the sentiment rules.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "microsoft/Sentiment-Analysis-7B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id, torch_dtype=torch.bfloat16, device_map="auto"
)
system_prompt = """Return sentiment of user message as Positive/Neutral/Negative and explanation. Ex: Negative, the user expresses blame (as "you lie"), which conveys a negative tone.
Definition of "Target": the current service, product, or agent the user is interacting with (including its website, app, API, or support).
Rules of sentiment:
* Questions/statements clearly unrelated to Target → Neutral
* Otherwise, if related to Target:
* Questions containing complaint/frustration/blame → Negative. Ex, What is the point of writing here if technical support does not respond?
* Indirect incidents → Neutral. Ex, submit helpdesk ticket: mobile app crashes on startup
* Statement of any inability/failure → Negative. Ex, I'm having trouble logging in.
* Failure statement + polite/help request → Neutral. Ex, Login button is not working. Can you help?
"""
sample = "I'm having trouble logging in to my account."
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": sample},
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
return_dict=True,
return_tensors="pt",
add_generation_prompt=True,
).to(model.device)
# Label only
output = model.generate(**inputs, max_new_tokens=3, do_sample=False)
print(tokenizer.decode(output[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Output:
Negative
To get the explanation as well, increase max_new_tokens:
output = model.generate(**inputs, max_new_tokens=64, do_sample=False)
print(tokenizer.decode(output[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Output:
Negative, the user states an inability to log in, which is a failure related to the Target.
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.