Model Overview
Model Features
Model Capabilities
Use Cases
🚀 HK-O1aw (v0)
HK-O1aw is a legal assistant with O1-style complex reasoning capabilities. It is trained using the Align-Anything framework on the O1aw-Dataset, based on the pre-trained LLaMA-3.1-8B model.
HK-O1aw aims to enhance the reasoning and complex problem-solving abilities of large language models in the legal domain, specifically in Hong Kong. More importantly, HK-O1aw has open-sourced all training data, code, and prompts for synthetic data generation, offering greater convenience to the community and researchers.
- Developed by: the HKAIR-Lab Team.
- Fine-tuned from model: LLaMA-3.1-8B.
🚀 Quick Start
HK-O1aw is a powerful legal assistant with complex reasoning capabilities. It can help users solve various legal problems in the Hong Kong region.
✨ Features
- Complex Reasoning: HK-O1aw has O1-style complex reasoning capabilities, enabling it to handle intricate legal issues.
- Open Source: All training data, code, and prompts for synthetic data generation are open-sourced, facilitating community research.
- Legal Domain Focus: Specifically designed for the legal domain in Hong Kong, enhancing problem-solving abilities in this area.
📦 Installation
No specific installation steps are provided in the original document.
💻 Usage Examples
Basic 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]
Advanced Usage
The original document does not provide advanced usage examples.
📚 Documentation
Model Sources
- Repository and Dataset: https://github.com/HKAIR-Lab/HK-O1aw
Example Cases
Model Cases | Details |
---|---|
Case 1 | Prompt: Generally, can a doctor treat a patient or conduct a medical procedure without the patient's consent? Output: Analyzing the legal background, according to Hong Kong law, doctors usually need the patient's consent to perform treatment or medical procedures. However, there are exceptions that allow treatment without consent in emergencies to save the patient's life. Understanding the exception of emergencies, in an emergency, if the patient cannot give consent and delaying treatment may endanger life, the doctor can act without consent to ensure the patient's safety. Considering other possibilities, apart from emergencies, doctors usually need the consent of the patient or their family to perform treatment. There are no other clear legal provisions allowing treatment without consent in non-emergency situations. Through analysis, we confirm that in non-emergency situations, doctors usually need the consent of the patient or their family to perform treatment. Only in emergencies, consent is not required to save a life. |
Case 2 | Prompt: What potential risks are involved when a landlord and a tenant rent a property without a written lease? Output: Analyzing the risks of not having a written lease, without a written lease, landlords and tenants may face various risks. Firstly, both parties may have disputes over the lease terms, leading to legal disputes. Secondly, the lack of written records may put the tenant at a disadvantage in property management or maintenance issues. Additionally, if the property is confiscated or the land is reclaimed by the government, the tenant may not receive any compensation. Method 1: The possibility of legal disputes. Without a written agreement, both parties may have different understandings of the rental details. In this case, it is difficult to prove who is right or wrong legally if a dispute occurs. This means that if one party believes the other has violated the agreement, they may not be able to obtain compensation or a solution through legal means. Method 2: Property management and maintenance issues. Without a written agreement, tenants usually cannot prove they have paid the fees, so it is difficult to require the landlord to carry out necessary repairs or management. This also means that if there are any damages or maintenance issues, communication and coordination between the two parties become more complicated. Method 3: The risk of government land reclamation. If the property is confiscated by the government or the land is reclaimed, the lack of a written agreement will prevent the tenant from receiving any compensation. Since there are no clear contractual terms in law to support their position, they may lose all their investments. Through analysis from different perspectives, we can confirm that there are multiple potential risks without a written agreement. These include legal disputes, property management issues, and the risk of government land reclamation. Each method verifies these risks from different aspects and points to the same conclusion, that the lack of written records will lead to serious consequences. |
Case 3 | Prompt: I rarely participate in high-risk sports (such as water skiing), but I got injured once when playing such sports. Will this injury be regarded as an "accident", "self-inflicted", or "negligent" incident? Will it affect my medical or accident insurance claim? Output: Analyzing the nature of the injury incident, first, we need to determine the nature of the injury incident. By definition, an accident refers to an unintentional, unforeseeable, and non-customary event. Self-inflicted refers to an accident caused by overconfidence or negligence, while negligence refers to the failure to take reasonable care. Evaluating water skiing as a high-risk sport, water skiing is classified as a high-risk sport, which means it has a relatively high inherent risk. We need to consider whether the injury in this case meets the definition of an accident, that is, unforeseeable and unintentional. Checking the exceptions in the insurance policy, insurance contracts usually list certain exceptions. For example, accidents that occur while participating in high-risk sports may not be covered. This requires a careful examination of the specific terms in the insurance contract. Considering the impact on medical and accident insurance claims, if the injury is regarded as an accident rather than self-inflicted or negligent, it usually affects the insurance claim. Medical insurance may cover part of the costs, while accident insurance may provide more comprehensive compensation. Through multiple methods of analysis, we can conclude that if the injury incident meets the definition of an accident and is not within the exceptions in the insurance contract, it may not affect the claim. But if it is regarded as self-inflicted or negligent, it may affect the claim. |
Case 4 | Prompt: What are the basic principles for drafting an excellent writ? Output: Analyzing the basic requirements of a writ, a writ is an important document in legal proceedings, used to formally make a legal request or claim. Its purpose is to clearly state the basis of the claim and relevant facts. Therefore, when drafting a writ, it is necessary to describe the event clearly, specifically, and accurately. Method 1: Analyzing from the perspective of legal proceedings. From the perspective of legal proceedings, a writ must follow specific format and content requirements. This includes providing detailed factual support, clearly listing the reasons for the claim, and providing an overview of relevant evidence. This method emphasizes compliance with legal procedures. Method 2: Analyzing from the perspective of communication efficiency. From the perspective of communication efficiency, a writ should be clear and easy to read so that the court and all parties can quickly understand the case background and the content of the claim. This means using simple and clear language and organizing information in paragraphs for quick reference. Method 3: Analyzing from a strategic perspective. From a strategic perspective, the drafter should consider how to most effectively support their position. By selecting appropriate facts and evidence, the impact on the court's decision can be maximized. Additionally, understanding the possible defenses that the other party may raise and preparing corresponding responses in the writ. Through verification using multiple methods, it is finally confirmed that an excellent writ should have the characteristics of clarity, accuracy, comprehensiveness, readability, and strategy. These characteristics together ensure that the court can effectively understand the case background and make a fair decision. |
Case 5 | Prompt: Why do businesses need mediation and arbitration? Output: Analyzing the necessity of business mediation, business mediation plays an important role in international trade because it provides a non-confrontational way to resolve disputes. Through mediation, both parties can discuss issues in a confidential environment, avoiding public legal proceedings, which is crucial for maintaining business relationships. Exploring the advantages of arbitration, arbitration is a more formal dispute resolution mechanism, usually faster, more private than court litigation, and arbitration awards are legally binding. Since international trade may involve different jurisdictions, arbitration provides a unified legal framework to resolve disputes. Comparing mediation and arbitration, both mediation and arbitration are alternative dispute resolution mechanisms, but they have different characteristics. Mediation is voluntary and flexible, while arbitration is legally binding. Businesses need both mechanisms to meet different needs: mediation is used to quickly resolve small disputes, while arbitration is used for complex or high-value transactions. Verifying and excluding other possibilities, considering other possible dispute resolution methods, such as direct negotiation or litigation, it is found that these methods have their own limitations. Direct negotiation may not have enforceability, while litigation is complex and time-consuming. Additionally, different legal systems in international trade make court litigation complicated. Through a re - examination of each step, the unique role of mediation and arbitration in international trade is confirmed. They provide flexibility, confidentiality, and legal protection, enabling businesses to effectively manage risks and maintain relationships. |
🔧 Technical Details
The original document does not provide technical details.
📄 License
HK-O1aw is released under the Apache License 2.0, and you also need to agree with the LLAMA 3.1 COMMUNITY LICENSE.
📚 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}},
}

