license: apache-2.0
datasets:
- HKAIR-Lab/HK-O1aw-SFT-16K
language:
- zh
base_model:
- meta-llama/Llama-3.1-8B
pipeline_tag: text2text-generation
tags:
- text-generation-inference
HK-O1aw (v0)
HK-O1aw is a legal assistant with O1-style complex reasoning capabilities, trained using the Align-Anything framework on the O1aw-Dataset, based on LLaMA-3.1-8B (pre-trained version).
HK-O1aw aims to enhance large language models' reasoning capabilities and complex problem-solving abilities in the legal domain (specifically in Hong Kong). More importantly, HK-O1aw has open-sourced all training data, code, and prompts used for synthetic data generation, providing greater convenience for the community and researchers.
- Developed by: the HKAIR-Lab Team.
- Fine-tuned from model: LLaMA-3.1-8B.
Model Sources
- Repository and Dataset: https://github.com/HKAIR-Lab/HK-O1aw
Example
Model Cases |
---|
Case 1Prompt: Output: 理解紧急情况的例外 考虑其他可能性 通过分析,我们确认在非紧急情况下,医生通常需要病人或其家属的同意才能进行治疗。只有在紧急情况下,为了拯救生命而无需获得同意。 |
Case 2Prompt Output: 方法一:法律纠纷的可能性 方法二:物业管理和维修问题 方法三:政府收回土地的风险 通过不同的角度分析,我们可以确认没有书面协议存在多种潜在风险。这些包括法律纠纷、物业管理问题以及政府收回土地的风险。每种方法都从不同方面验证了这些风险,并且都指向相同的结论,即缺乏书面记录会导致严重后果。 |
Case 3Prompt: Output: 评估滑水作为高危运动 检查保险条款中的例外情况 考虑医疗和意外保险索偿影响 通过多种方法分析,我们可以得出结论:如果受伤事件符合意外的定义,并且不在保险合同中的例外情况内,则可能不会影响索偿。但如果被视为自招或疏忽,则可能会影响索偿。 |
Case 4Prompt: Output: 方法一:从法律程序角度分析 方法二:从沟通效率角度分析 方法三:从策略性角度分析 通过多种方法验证后,最终确认优秀状书需具备清晰、准确、全面、易读及策略性的特征。这些特征共同确保法庭能够有效理解案件背景并作出公正判决。 |
Case 5Prompt: Output: 探讨仲裁的优势 比较调解和仲裁 验证和排除其他可能性 通过重新审视各个步骤,确认调解和仲裁在国际贸易中的独特作用。它们提供了灵活性、保密性和法律保障,使得商业能够有效地管理风险并维护关系。 |
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "HKAIR-Lab/HK-O1aw"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
user_prompt: str = '<|reserved_special_token_0|>{input}<|reserved_special_token_1|>\n'
infer_template = user_prompt + '<|reserved_special_token_2|>\n**'
prompt = "在物业买卖过程中,业主是否有义务将租赁详情完全披露给准买家?如果未能完全披露,可能会产生哪些法律后果?"
text = infer_template.format(input=prompt)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
Citation
Please cite our work if you use the data or model in your paper.
@misc{HK-O1aw,
author = {HKAIR Lab},
title = {HK-O1aw Models: Leveraging O1 Slow Thinking in the Development of Hong Kong Legal Large Language Models},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/HKAIR-Lab/HK-O1aw}},
}
License
HK-O1aw is released under Apache License 2.0, and you also need to agree with LLAMA 3.1 COMMUNITY LICENSE.