nekomata-14b-pfn-qfin
Model Description
nekomata-14b-pfn-qfin is a fine-tuned model based on rinna/nekomata-14b. This is the base model, which is good at generating continuous sentences for finance. nekomata-14b-pfn-qfin is fine-tuned on 370M tokens from multiple special datasets generated by Preferred Networks, which is clear to use for commercial usage. The fine-tuned were carried out at a 2048 context length. This model is released under Tongyi Qianwen LICENSE AGREEMENT.
The research article is available on arXiv.
Benchmarking
The benchmark score is obtained using Japanese Language Model Financial Evaluation Harness For the benchmark, 0-shot and default prompts are used.
| Task |Metric| nekomaba-14b | Ours |
|----------------|------|------|---|------|------|---|------|
|chabsa |f1 |0.7381| | |0.7428| | |
|cma_basics |acc |0.4737|± |0.0821|0.5263|± |0.0821|
|cpa_audit |acc |0.1608|± |0.0184|0.1633|± |0.0186|
|fp2 |acc |0.3389|± |0.0217|0.3642|± |0.0221|
|security_sales_1|acc |0.4561|± |0.0666|0.5614|± |0.0663|
|----------------|------|------|---|------|------|---|------|
|OVER ALL | |0.4335 |0.4716 |
Usage
Install the required libraries as follows:
>>> python -m pip install numpy sentencepiece torch transformers accelerate transformers_stream_generator tiktoken einops
Execute the following python code:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("pfnet/nekomata-14b-pfn-qfin", trust_remote_code=True)
# Use GPU with bf16 (recommended for supported devices)
# model = AutoModelForCausalLM.from_pretrained("pfnet/nekomata-14b-pfn-qfin", device_map="auto", trust_remote_code=True, bf16=True)
# Use GPU with fp16
# model = AutoModelForCausalLM.from_pretrained("pfnet/nekomata-14b-pfn-qfin", device_map="auto", trust_remote_code=True, fp16=True)
# Use GPU with fp32
# model = AutoModelForCausalLM.from_pretrained("pfnet/nekomata-14b-pfn-qfin", device_map="auto", trust_remote_code=True, fp32=True)
# Use CPU
# model = AutoModelForCausalLM.from_pretrained("pfnet/nekomata-14b-pfn-qfin", device_map="cpu", trust_remote_code=True)
# Automatically select device and precision
model = AutoModelForCausalLM.from_pretrained("pfnet/nekomata-14b-pfn-qfin", device_map="auto", trust_remote_code=True)
text = "日本銀行は"
input_ids = tokenizer(text, return_tensors="pt").input_ids.to(model.device)
with torch.no_grad():
generated_tokens = model.generate(
inputs=input_ids,
max_new_tokens=32,
do_sample=True,
temperature=1.0,
repetition_penalty=1.1
)[0]
generated_text = tokenizer.decode(generated_tokens)
print(generated_text)
# 日本銀行は、2016年9月に「長短金利操作付き量的・質的金融緩和」を導入し、長期国
Model Details
- Model size: 14B
- Fine-tuned tokens: 370M tokens (Japanese: 300M tokens, English: 13M tokens, Digits: 14M tokens)
- Context length: 2048
- Developed by: Preferred Networks, Inc
- Model type: Causal decoder-only
- Language(s): Japanese and English
- License: Tongyi Qianwen LICENSE AGREEMENT
Bias, Risks, and Limitations
nekomata-14b-pfn-qfin is a new technology that carries risks with use. Testing conducted to date has been in English and Japanese, and has not covered, nor could it cover all scenarios. For these reasons, as with all LLMs, nekomata-14b-pfn-qfin’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. This model is not designed for legal, tax, investment, financial, or other advice. Therefore, before deploying any applications of nekomata-14b-pfn-qfin, developers should perform safety testing and tuning tailored to their specific applications of the model.
How to cite
@misc{hirano2024,
title={Construction of Domain-specified Japanese Large Language Model for Finance through Continual Pre-training},
author={Masanori Hirano and Kentaro Imajo},
year={2024},
eprint={2404.10555},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Contributors
Preferred Networks, Inc.
- Masanori Hirano
- Kentaro Imajo
License
- Downloads last month
- 1,773