PLaMo-3-8B-Fin-Instruct

Model Description

PLaMo-3-8B-Fin-Instruct is a Japanese language model for the financial domain, developed by Preferred Networks, Inc. It is fine-tuned from a PLaMo-3 base model through continued pre-training on financial corpora followed by supervised fine-tuning and direct preference optimization. This is an instruction-tuned model for the financial domain. The model follows the PLaMo-3 chat format.

The model is provided as a chat model that reasons in Japanese: it first writes its thought process in Japanese and then gives the answer. It also supports function calling (tool use). Part of the training was carried out on MN-Core 2, a deep learning accelerator developed by Preferred Networks.

Usage

Requirements

The model has been tested with the following versions:

python==3.12
numpy==2.5.4
numba==0.68.0
torch==2.9.0
transformers==5.20.2
accelerate==1.15.0

Direct loading

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_name = "pfnet/plamo-3-8b-fin-instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_name, trust_remote_code=True, dtype=torch.bfloat16, device_map="auto"
)

messages = [
    {"role": "user", "content": "PERใจใฏไฝ•ใงใ™ใ‹?ไธ€ๆ–‡ใง็ญ”ใˆใฆใ€‚"},
]
inputs = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, return_dict=True, return_tensors="pt"
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))

Reasoning

The model writes its reasoning in Japanese before answering. The response contains a reasoning block delimited by <|plamo:begin_think:plamo|> and <|plamo:end_think:plamo|>, followed by the answer, terminated by <|plamo:tag|>. When showing responses to end users, separate the reasoning block from the answer.

Function calling

Pass OpenAI-style function definitions to the chat template with the tools argument. When the model decides to call a tool, it writes the call after its reasoning instead of an answer. Evaluate how accurately it works with your own tools and tasks before use.

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_stock_price",
            "description": "้Š˜ๆŸ„ใ‚ณใƒผใƒ‰ใ‚’ๆŒ‡ๅฎšใ—ใฆใ€็พๅœจใฎๆ ชไพกใ‚’่ฟ”ใ—ใพใ™ใ€‚",
            "parameters": {
                "type": "object",
                "properties": {"code": {"type": "string", "description": "4ๆกใฎ้Š˜ๆŸ„ใ‚ณใƒผใƒ‰"}},
                "required": ["code"],
            },
        },
    },
]
messages = [{"role": "user", "content": "ใƒˆใƒจใ‚ฟ่‡ชๅ‹•่ปŠ(7203)ใฎไปŠใฎๆ ชไพกใ‚’ๆ•™ใˆใฆใ€‚"}]
inputs = tokenizer.apply_chat_template(
    messages, tools=tools, add_generation_prompt=True, return_dict=True, return_tensors="pt"
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))

A tool call is written in the following format, with the arguments as a JSON object:

<|plamo:begin_tool_requests:plamo|><|plamo:begin_tool_request:plamo|><|plamo:begin_tool_name:plamo|>get_stock_price<|plamo:end_tool_name:plamo|><|plamo:begin_tool_arguments:plamo|><|plamo:constrain|>json<|plamo:msg|>{"code": "7203"}<|plamo:end_tool_arguments:plamo|><|plamo:end_tool_request:plamo|><|plamo:end_tool_requests:plamo|>

Execute the call in your application, append the assistant turn (with tool_calls) and the result (a message with role tool) to messages, and generate again. Pass tools on every turn: the chat template renders the tool calls in the history only when tools is given.

Model Details

  • Developed by: Preferred Networks, Inc.
  • Model type: Causal decoder-only
  • Context length: 262,144 tokens (the base model's maximum; continued pre-training on financial corpora used sequences of up to 32,768 tokens)
  • Language(s): Japanese
  • Tensor type: BF16
  • License: PLaMo community license

Tokenizer

The tokenizer is the PLaMo-3 tokenizer, distributed with this repository as tokenizer.jsonl and tokenization_plamo.py.

Bias, Risks, and Limitations

PLaMo-3-8B-Fin-Instruct is a new technology that carries risks with use. Testing conducted to date has been in Japanese, and has not covered, nor could it cover all scenarios. For these reasons, as with all LLMs, PLaMo-3-8B-Fin-Instruct's potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses to user prompts. Therefore, before deploying any applications of PLaMo-3-8B-Fin-Instruct, developers should perform safety testing and tuning tailored to their specific applications of the model.

Domain specialization

This model has been additionally trained on financial-domain data and is intended for financial use cases. It is not a general-purpose assistant. If you intend to use it outside the financial domain, evaluate it on your own task first.

Model size and hallucination

With 8B parameters, this model holds less factual knowledge than larger models and is more prone to hallucination: fluent, confident text that is factually wrong. Verify factual and numerical claims against an authoritative source before acting on them, and keep a human reviewer in the loop for consequential decisions.

Function calling

How accurately function calling works depends on your tools and tasks. Evaluate it on your own use case before deploying it. Validate every tool call against your schema before executing it, and require human confirmation before any action with real-world effects, such as placing orders or transferring funds.

Harmful content

Safety alignment is not fully reliable, and the model may generate harmful content, including offensive or violent expressions. Developers should apply content filtering appropriate to their deployment.

Not professional advice

The outputs of this model do not constitute legal, financial, tax, or investment advice, and must not be presented to end users as such. Applications built on this model should not be used to make investment decisions on a user's behalf.

License

PLaMo-3-8B-Fin-Instruct is released under the PLaMo Community License.

Please review the PLaMo Community License and contact us via this form for commercial use: https://forms.gle/mTL8tBLrMYXKNZD56

Contributors

Preferred Networks, Inc.

  • Ryo Wakai
  • Ryota Ozaki
  • Kentaro Imajo
  • Masanori Hirano
  • Lihang Hong
  • Yoshiki Sato

AI policies for Preferred Networks, Inc. group

Downloads last month
-
Safetensors
Model size
9B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for pfnet/plamo-3-8b-fin-instruct

Finetuned
(5)
this model