llm-jp/llm-jp-3-3.7b-instruct

text generationtransformersenjatransformerssafetensorsllamatext-generationconversationalenapache-2.0
vLLMRunnable with vLLM
2.2M

llm-jp-3-3.7b-instruct

This repository provides large language models developed by the Research and Development Center for Large Language Models at the National Institute of Informatics.

Checkpoints format: Hugging Face Transformers

Required Libraries and Their Versions

  • torch>=2.3.0
  • transformers>=4.40.1
  • tokenizers>=0.19.1
  • accelerate>=0.29.3
  • flash-attn>=2.5.8

Usage

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("llm-jp/llm-jp-3-3.7b-instruct")
model = AutoModelForCausalLM.from_pretrained("llm-jp/llm-jp-3-3.7b-instruct", device_map="auto", torch_dtype=torch.bfloat16)
chat = [
    {"role": "system", "content": "以下は、タスクを説明する指示です。要求を適切に満たす応答を書きなさい。"},
    {"role": "user", "content": "自然言語処理とは何か"},
]
tokenized_input = tokenizer.apply_chat_template(chat, add_generation_prompt=True, tokenize=True, return_tensors="pt").to(model.device)
with torch.no_grad():
    output = model.generate(
        tokenized_input,
        max_new_tokens=100,
        do_sample=True,
        top_p=0.95,
        temperature=0.7,
        repetition_penalty=1.05,
    )[0]
print(tokenizer.decode(output))

Model Details

  • Model type: Transformer-based Language Model
  • Total seen tokens: 2.1T
ParamsLayersHidden sizeHeadsContext lengthEmbedding parametersNon-embedding parameters
1.8b242048164096407,896,0641,459,718,144
3.7b283072244096611,844,0963,171,068,928
13b4051204040961,019,740,16012,688,184,320

Tokenizer

The tokenizer of this model is based on huggingface/tokenizers Unigram byte-fallback model. The vocabulary entries were converted from llm-jp-tokenizer v3.0. Please refer to README.md of llm-jp-tokenizer for details on the vocabulary construction procedure (the pure SentencePiece training does not reproduce our vocabulary).

Datasets

Pre-training

The models have been pre-trained using a blend of the following datasets.

LanguageDatasetTokens
JapaneseWikipedia2.6B
Common Crawl762.8B
WARP/PDF237.3B
WARP/HTML2.7B
Kaken1.8B
EnglishWikipedia4.7B
Dolma/CC-head608.5B
Dolma/C4181.6B
Dolma/Reddit83.1B
Dolma/PeS2o62.9B
Dolma/Gutenberg5.5B
Dolma/Wiki3.9B
CodeThe Stack114.1B
ChineseWikipedia0.8B
KoreanWikipedia0.3B

Instruction tuning

The models have been fine-tuned on the following datasets.

LanguageDatasetdescription
Japaneseichikara-instruction-004-002A manually constructed instruction dataset
answer-carefully-002A manually constructed instruction dataset focusing on LLMs' safety
ichikara-instruction-formatA small amount of instruction dataset edited from ichikara-instruction, with some constraints on the output format.
AutoMultiTurnByCalm3-22BA synthetic instruction dataset.
ramdom-to-fixed-multiturn-Calm3A synthetic instruction dataset.
wizardlm8x22b-logical-math-coding-sft_additional-jaA synthetic instruction dataset.
Synthetic-JP-EN-Coding-Dataset-567kA synthetic instruction dataset. We used sampled one.
EnglishFLANWe used sampled one.

Evaluation

llm-jp-eval (v1.3.1)

We evaluated the models using 100 examples from the dev split.

Model nameaverageELFAHEMCMRMTNLIQARC
llm-jp-3-1.8b0.37670.37250.19480.23500.25000.09000.77300.30800.46290.7040
llm-jp-3-1.8b-instruct0.45960.42800.19870.32500.33000.42000.79000.35200.46980.8224
llm-jp-3-3.7b0.42310.38120.24400.22000.19000.36000.79470.38000.46880.7694
llm-jp-3-3.7b-instruct0.51880.41910.25040.34000.50000.58000.81660.45000.48810.8247
llm-jp-3-13b0.58020.55700.25930.46000.70000.63000.82920.34600.59370.8469
llm-jp-3-13b-instruct0.61680.54080.27570.49500.92000.71000.83170.46400.46420.8500

Japanese MT Bench

We evaluated the models using gpt-4-0613. Please see the codes for details.

Model nameaveragecodingextractionhumanitiesmathreasoningroleplaystemwriting
llm-jp-3-1.8b-instruct4.931.504.707.801.552.607.806.107.40
llm-jp-3-3.7b-instruct5.501.954.058.252.254.008.807.257.45
llm-jp-3-13b-instruct6.473.157.059.153.755.408.307.507.45

Risks and Limitations

The models released here are in the early stages of our research and development and have not been tuned to ensure outputs align with human intent and safety considerations.

Send Questions to

llm-jp(at)nii.ac.jp

License

Apache License, Version 2.0

Model Card Authors

The names are listed in alphabetical order.

Hirokazu Kiyomaru and Takashi Kodama.

DEPLOY IN 60 SECONDS

Run llm-jp-3-3.7b-instruct on Runcrate

Deploy on H100, A100, or RTX GPUs. Pay only for what you use. No setup required.