HooRin/AuditWen

An Open-source Large Language Model for Audit

Python

29

78 commits

updated Apr 27, 2025

See the code

README

AuditWen

An Open-source Large Language Model for Audit

Introduction

The first Chinese open source audit model is based on Qwen-7B-chat and fine-tunes a large amount of supervisory audit related data. The model has a wide range of audit knowledge and intelligent analysis capabilities, aiming to provide comprehensive and effective problem analysis and audit foundation recommendations for the audit field.In the future, we will closely follow the update of qwen version and launch qwen 2.5 version. Stay tuned.

Explain

  1. This project is still constantly iterating and updating. Considering the wide coverage of the audit field and the serious shortage of domain dataset resources, we have only released fine-tuning models on the audit laws, regulations, and qualitative question and answer datasets;
  2. The data and models provided in this project are for scientific research purposes only and are strictly prohibited from being used for commercial purposes;

Application Scenarios of LLM in Audit Domain

Audit issue summary and Laws Recommendation

The primary task of audit is to identify any potential audit issues within a project and determine which laws and regulations can serve as the audit basis. From this perspective, auditors are seeking LLMs to assist in summarizing audit issues based on audit working papers and recommending suitable laws and regulations as both qualitative and punishment basis. The primary challenge in the application is that an internal auditor may have a divergent qualitative basis for an audit issue compared to a social auditor based on the case description in the audit working paper. For example, an internal auditor may use items from enterprise internal control manual as qualitative basis without any penalty provision, while a social auditor may refer to items in Accounting Law and Criminal Law for punishment. To address this challenge, we propose an audit issue schema that summarizes audit issue from case description and aligns them with the clauses of laws and regulations simultaneously。We hope to bridge a gap between the clause of laws and regulations and the audit issue:

Qualitative basis of audit problem and recommended model of punishment basis

Description of the image

Audit Relevant Question and Answer

The secondary task of LLM used in audit is to answer question related to audit, such as questions list in Table 1. These questions pertain to defining an audit concept, understanding the specifics of a particular clause of a law, determining the methods for investigating and verifying audit issues, and identifying the necessary data to be collected. These diverse questions prompt us to gather relevant audit documents pertaining to audit cases, audit criteria, audit guidelines, and so on. When assessing the quality of answers generated by LLM, it is crucial to minimize the occurrence of hallucination responses and ensure the retrieval of original text based on existing system documents and other relevant content:

Examples of possible QA proposed by auditor
QueryAnswer
What internal control information does the company need to disclose? (公司需要披露哪些内部控制信息?)The Company shall fully disclose any internal control information that has a significant impact on investors' investment decisions.(凡对投资者投资决策有重大影响的内部控制信息,公司均应充分披露。)
What are the responsibilities of the audit institution under the Internal Audit Regulations? (内部审计条例规定的审计机关的职责有哪些?)According to Article 23 of Chapter 5 of the Internal Audit Regulations of XX Province, the responsibilities of audit institutions include the following:… (根据XX省内部审计条例第五章第二十三条,审计机关的职责包含以下几项:...)
What methods should be adopted in the audit of significant secured loans to identify and conduct detailed investigation? (重大担保借款审计中需要采取哪些方法来识别并展开详细调查?)Review meeting minutes and materials, documents, contract approval documents, etc., review decision-making process, guarantee scope, scale, etc. (调阅会议纪要及上会材料、文书、合同审批文件等,审核决策流程、担保范围、规模等。)
What key information should be collected when conducting a construction project performance audit? (在进行建设项目绩效审计时,应该收集哪些关键资料?)When conducting a construction project performance audit, key data include: approved project proposals and feasibility study reports,… (在进行建设项目绩效审计时,关键资料包括:已获批准的项目建议书和可行性研究报告,...)

Audit assistant

Further derive requirement of LLM applied in audit domain is LLM can act as an intelligent assistant and help auditor to extract specified phrase from audit document, do accounting relevant numerical calculation, generate an outline for an audit report and further fill content based on the given audit working papers. The possible case questions are list in Table 2. Audit assistant usually need to execute fine-grained NLP task step by step, such as information extraction, multi-documents summarization and document generation. Additionally, audit assistants must achieve collaborative work between humans and machines with the guidance of human-provided knowledge:

The potential tasks that may be assigned to an audit intelligent assistant.
IdQuery
Q1Please extract entity about the audited organization from the following documents. (请从下面文档中抽取出被审计单位信息。)
Q2Please judge whether Company A is losing money according to the following statement.(请根据下面的报表判断A公司是否亏损?)
Q3Please write a business leader economic responsibility audit report template. (请撰写出一个企业领导人经济责任审计报告模板。)
Q4Based on the uploaded audit draft and the generated audit report template, please write the audit process and method of XX leader's accountability audit. (基于上传的审计底稿和生成的审计报告模板,请撰写XX领导人经责审计的审计过程与方法。)
Q5Based on the uploaded audit ledger list, audit ledgers belonging to the same audit issue are merged into the same document and output. (基于上传的审计台账列表,将属于同一审计问题的审计台账归并到同一文档中并输出。)

Modality and Prompts

On the basis of collecting and organizing structured data for various audit tasks, write instruction data. Taking audit procedures as an example, the table below shows some structured data:

Raw structured data
审计类型审计事项审计程序
公共工程审计工程项目内部控制审计关于工程项目内部控制审计程序,中天恒3C框架研制的工程项目内部控制审计一般程序包括工程项目内部控制有效性调查、初步评价、风险评估、控制测试、评价缺陷、审计评价、形成意见等...
公共工程审计工程项目投资决策审计工程项目投资决策审计程序:·收集工程项目投资决策相关法律法规。·收集工程项目投资决策相关材料。·调查了解工程项目投资决策情况。·查证核实工程项目投资决策情况(对专业技术文件可委托专业中介机构进行审核,并出具专业审核意见)...
公共工程审计工程项目征地拆迁审计征地拆迁除要满足一般的审计程序之外,需要特殊考虑的审计程序或工作主要有:...

Next, construct the corresponding instructions through the following scheme:
Question:在[审计类型]中,[审计事项]的审计程序是什么?
Answer:[审计程序]
(For more types of tasks, refer to the file Raw structured data.xlsx in the directory/corpus/Raw structured data)
Based on the above template, the converted instruction data is as follows:

Instruction data set presentation
QueryAnswer
在公共工程审计中,工程项目内部控制审计的审计程序是什么?关于工程项目内部控制审计程序,中天恒3C框架研制的工程项目内部控制审计一般程序包括工程项目内部控制有效性调查、初步评价、风险评估、控制测试、评价缺陷、审计评价、形成意见等...
在公共工程审计中,工程项目投资决策审计的审计程序是什么?工程项目投资决策审计程序:·收集工程项目投资决策相关法律法规。·收集工程项目投资决策相关材料。·调查了解工程项目投资决策情况。·查证核实工程项目投资决策情况(对专业技术文件可委托专业中介机构进行审核,并出具专业审核意见)...
在公共工程审计中,工程项目征地拆迁审计的审计程序是什么?征地拆迁除要满足一般的审计程序之外,需要特殊考虑的审计程序或工作主要有:...

The table below summarizes the different tasks, template and examples of an instruction data:

Examples of the instruction data used in LLM tuning dataset
Task nameTemplateExamples of an instruction data
Audit NERT (1)"query": 文本: 通过对证券公司和国有企业审计,…。","在上面的文本中,请完成命名实体识别任务,即识别代表审计疑点('auditissue')、机构('ORG')、审计法律法规('auditlbasis')三类实体类型的实体名称,答案应遵循格式"实体名称, 实体类型"。"answer": "证券公司, ORG","label": ["O", "O", "O", "B-ORG", "I-ORG", "I-ORG", "I-ORG", "",…]
Relation ClassificationT (1)"query":文本:将进口料件表体、报关单表头与加工贸易禁止类商品目录通过商品编号进行关联,筛选出涉及禁止类商品的加工贸易手册。实体对:禁止类商品-加工贸易禁止类商品目录", 根据提供的审计内容和实体对,从['审计问题', '审计事项', '审计依据', '审计方法', '审计机构','审计成果','被审计单位','涉及的行业或领域']中选择能准确表示该实体对关系的选项。请直接回答,如有不确定情况可回答unknown。"answer": 审计依据, "choices": ["unknown", "审计问题", "审计事项", "审计依据", "审计方法", "审计机构", "审计成果", "被审计单位", "涉及的行业或领域"], "gold": 3.
Definition of audit entityT (2)"query": 请问什么是营业外收入?, "answer": 该科目核算的是企业发生的与其生产经营无直接关系的各项收入,包括固定资产盘盈、处置固定资产净收益….。
Audit-legal relevant quesitonT (2)"query": 如果某公司违反了中华人民共和国证券法第九十条关于征集股东权利的规定,将受到何种法律后果?"answer":根据中华人民共和国证券法第一百九十九条,该公司将被责令改正并给予警告…。
Audit-issue relevant questionT(2)"query":请问项目单位挤占挪用社会福利基金的表现形式是什么样的?"answer": 项目单位挤占挪用社会福利基金的表现形式:社会福利基金用于投资办企业…。
Other-audit relevant questionT(2)"query": 请问资源环保审计包括的审计内容是什么?,"answer": 资源环保审计包括的审计内容是土地资源资产,…。
Risk/problem analysisT (2)"query": 在国有企业经济责任审计,资产审计可能存在哪些审计风险?"answer": 资产审计可能存在如下风险点:(一)客户管理效率低,没有全面调研客户资质、信用状况并动态跟踪,没有对客户分类,并采取不同的销售政策。…。

Tasks

The details of our evaluation datasets. "Annotation" denotes the construction manner of the instruction data from raw data source.
LevelTask nameSub-task nameTrainValidationTestAnnotation
Sentence levelAudit NERAudit NER409110221424human annotation
Sentence levelRelation ClassificationRelation Classification817232117human annotation
Sentence levelPhrase classificationaudit entity classification--1578human annotation
Sentence levelPhrase classificationaudit-issue phrase classification1210344166human annotation
Sentence levelPhrase classificationlegal name classification1463418218human annotation
Paragraph LevelDefinition of audit entityDefinition of audit entity1756500190Extract from raw text
Paragraph LevelAudit-legal relevant questionAudit-legal relevant question15774112505Generated by GPT-4
Paragraph LevelAudit-problem relevant questionaudit issue summary2537136Extract from raw text
Paragraph LevelAudit-problem relevant questionaudit issue describe2025629Extract from raw text
Paragraph LevelAudit-problem relevant questionlegal recommendation1567445224Extract from raw text
Paragraph LevelOther-audit relevant questionaudit procedures and material67119096Extract from raw text
Paragraph LevelOther-audit relevant questionaudit type and objectives60917187Extract from raw text
Paragraph LevelOther-audit relevant questionother question903257129Converted from audit knowledge graph
Documents LevelAudit item/risk/problem analysisAudit item/risk/problem analysis54415177Extract from raw text
Documents LevelAudit case/report generationAudit case/report generation48116Extract from raw text
Total2990839804941

The overall performance of different LLMs on audit evaluation benchmark, * denotes 5-shot evaluation for the task.

Task nameSub-task nameMetricQwen-7B-chatChatGLM3-6BGPT-4AuditWen
NERNERentity_F10.140*0.015*0.108*0.535*
Relation ClassificationRelation Classificationaccuracy--/0.085*0.376/0.342*0.402/0.624*0.615/0.188*
Relation ClassificationRelation ClassificationF1--/0.037*0.243/0.373*0.432/0.649*0.744/0.220*
Relation ClassificationRelation Classificationmissing0.410/0.000.008/0.0000.000/0.0000.350/0.274
Phrase classificationaudit entity classification*accuracy0.716/0.763*0.493/0.5400.679/0.810*0.601/0.720*
Phrase classificationaudit entity classification*F10.710/0.734*0.583/0.612*0.697/0.816*0.612/0.716*
Phrase classificationaudit entity classification*missing0.042/0.000.146//0.0000.023/0.0000.077/0.000*
Phrase classificationaudit-issue phrase classificationaccuracy--/0.399*0.254/0.353*0.464/0.543*0.437/0.601*
Phrase classificationaudit-issue phrase classificationF1--/0.347*0.193/0.252*0.484/0.557*0.428/0.0.595*
Phrase classificationaudit-issue phrase classificationmissing0.751/0.0000.078/0.0580.000/0.0000.085/0.037
Phrase classificationlegal name classificationaccuracy--/0.146*0.394/0.468*0.637/0.647*0.752/0.431*
Phrase classificationlegal name classificationF1--/0.075*0.388/0.428*0.623/0.639*0.774/0.405*
Phrase classificationlegal name classificationmissing0.766/0.1650.000/0.0000.004/0.0000.050/0.037
Definition of audit entityDefinition of audit entityROUGE-10.2450.220.2020.298
Definition of audit entityDefinition of audit entityROUGE-20.0530.0370.0370.121
Definition of audit entityDefinition of audit entityROUGE-L0.1780.1560.1210.237
Definition of audit entityDefinition of audit entityBF10.6780.6700.6620.702
Definition of audit entityDefinition of audit entityBART Score-4.527-4.535-4.391-4.175
Audit-legal relevant questionAudit-legal relevant questionBF10.6960.6710.6650.723
Audit-legal relevant questionAudit-legal relevant questionBART Score-3.659-3.356-3.424-3.480
Audit-issue relevant questionaudit issue summaryBF10.6340.6440.6340.642
Audit-issue relevant questionaudit issue summaryBART Score-4.470-4.485-4.524-4.456
Audit-issue relevant questionaudit issue describeBF1 0.6960.6740.6550.792
Audit-issue relevant questionaudit issue describeBART Score-4.048-3.827-3.996-3.044
Audit-issue relevant questionlegal recommendationROUGE-10.2470.2680.2750.530
Audit-issue relevant questionlegal recommendationROUGE-20.0610.0630.0830.386
Audit-issue relevant questionlegal recommendationROUGE-L0.1500.1520.1510.442
Audit-issue relevant questionlegal recommendationBF1 0.6540.6650.6770.785
Audit-issue relevant questionlegal recommendationBART Score-4.799-4.192-3.661-3.406
Other-audit relevant questionaudit procedures and materialBF10.670.6820.6940.746
Other-audit relevant questionaudit procedures and materialBART Score-5.127-4.681-5.166-4.514
Other-audit relevant questionaudit items and objectivesBF10.7230.6970.6340.907
Other-audit relevant questionaudit items and objectivesBART Score-3.794-3.650-4.069-1.587
Other-audit relevant questionother questionBF10.7040.6630.6350.900
Other-audit relevant questionother questionBART Score-3.284-3.171-2.985-1.202
Risk/problem analysisRisk/problem analysisBF10.670.6780.6670.84
Risk/problem analysisRisk/problem analysisBART Score-4.854-3.61-3.291-3.031
Audit case/report generationAudit case/report generationBF10.6580.6680.6700.684
Audit case/report generationAudit case/report generationBART Score-5.584-5.003-4.782-5.011

GPT_Q&A

Construct a Q&A session on legal and regulatory content through GPT4.0
The gpt4_law_result.xlsx in the directory/AuditWen/GPT_Q&A/data displays regulatory content and content generated by GPT4.

Quick Start

Directory Structure

---/src/ evaluate related packages
----/finetune/ Qwen's finetune Project -- Instruction fine-tuning
----/PIXIU/ PIXIU Project -- NLP Task Inference and Evaluation
----/qa_eval/ Q&A Task Reasoning Reasoning and Evaluation
-----/quick_interference.py/ Immediate inference code
-----/interence.py/ task-based inference code
-----/evaluation.py/ evaluation code
---/pics/ Related pictures
---/GPT_Q&A/
----/code/ GPT4 generates the code for the Q&A
----/data/ partial data
---/corpus/
----/benchmark datatset/ Test set for various tasks
----/result/ Inference results of various task test sets on various pedestals
----/Raw structured data/ Raw Structured data
----/train/ Training instruction set

Inference Model

To reason with AuditWen, you simply enter a few lines of code, as shown below. Remember to pass the correct model name or path, such as "/model/AuditWen". However, make sure you are using the latest code. (This project also provides quick_interference.py with proxy code located in the directory /AuditWen/src/qa_eval)

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation import GenerationConfig

# Model names: "/model/AuditWen"
tokenizer = AutoTokenizer.from_pretrained( "/model/AuditWen", trust_remote_code=True)

# use auto mode, automatically select precision based on the device.
model = AutoModelForCausalLM.from_pretrained(
    " /model/AuditWen",
    device_map="auto",
    trust_remote_code=True
).eval()
#You can specify different generation length, top p and other related superparameters
model.generation_config = GenerationConfig.from_pretrained(" /model/AuditWen",, trust_remote_code=True, )  

# 1st dialogue turn
response, history = model.chat(tokenizer, "请问什么是审计范围?", history=None)
print(response)
#审计范围是指审计机构和审计人员在一定的审计目的和审计计划指导下,为完成审计任务所进行的审查所有事项。
#它包括审计对象、审计期间、以及对这些审计对象各个方面所进行的审查程度。

# 2nd dialogue turn
response, history = model.chat(tokenizer, "请问什么是财务报表审计?", history=history)
print(response)
#财务报表审计是指注册会计师对被审计单位编制的财务报表的真实性、合法性、完整性作出审计结论,提出审计意见,形成审计报告的一项审计业务。
#财务报表审计是注册会计师接受委托,按照独立审计准则的要求,对企事业单位的财务报表进行审査,并据此发表审计意见,出具审计报告。所发行的审计报告,为报表使用者做出正确决策提供可靠的参考资料

Fine tuning

Model fine-tuning related content reference https://github.com/QwenLM/Qwen
To prepare the training data, you need to put all the samples into a list and save them to a json file. Each sample is a dictionary, consisting of an id and a list of conversations. Here is a list of simple examples with 1 sample:

[
  {
    "id": "identity_0",
    "conversations": [
      {
        "from": "user",
        "value": "请问审计事项'工程设计审计'的审计类型是什么?"
      },
      {
        "from": "assistant",
        "value": "工程设计审计的审计类型是工程项目竣工决算审计。"
      }
    ]
  }
]

In addition, this project also provides a training set containing 2000 entries located in the directory/AuditWen/corpus for users to refer to.
After the data is ready, you can use the shell script provided in the directory/AuditWen/src/finetune/Qwen main/finetune to run finetuning. Please remember to specify the path to the data file. For detailed usage, please refer to the introduction of the Qwen project.

Evaluation-PIXIU

The NLP tasks, namely NER, RE, and NL tasks, are evaluated based on PIXIU. This project has optimized the evaluation method to ensure the accuracy of the evaluation results.

Environmental preparation

cd PIXIU
pip install -r requirements.txt
cd PIXIU/src/financial-evaluation
pip install -e .[multilingual]

Data path setting

In the init.py file under path \PIXIU\src\tasks, set the name of the task and the corresponding method of data processing,Taking "flare_zh_auditner": flare.AuditNER, "as an example, the method for auditing the data loading and processing of the named entity identification task is AuditNER under flare.py.Next, the parameter DATASET_PATH in the AuditNER method is set to the data set path.

Evaluation

To evaluate a model hosted on the HuggingFace Hub (for instance, AuditWen), use this command:

python eval.py \
    --model
    "hf-causal-vllm"
    --model_args
    "pretrained=/model/AuditWen,tokenizer=/model/AuditWen,trust_remote_code=True"
    --tasks
    "flare_zh_auditner"

Commercial APIs:

export OPENAI_API_SECRET_KEY=YOUR_KEY_HERE
python eval.py \
    --model gpt-4 \
    --tasks "flare_zh_auditner"

Evaluation-QA

Model inference is run inference.py under the qa_eval directory, while content evaluation is run evaluation.py under the qa_eval directory

Inference

Reasoning data in the form of a visible directory/AuditWen corpus/benchmark datatset q&a type task under json files in the directory.

Evaluation

The evaluation method of Q&A tasks is optimized based on the evaluation method of PIXIU Q&A tasks. rouge_chinese is used for evaluation, and the word segmentation "Audit Word segmentation.txt" located in the directory /AuditWen/src/qa_eval/src is loaded for evaluation.Loading through jieba's load_userdict method.The evaluation of bart and bert is also replaced with the Chinese version, and the evaluation effect is somewhat improved compared with PIXIU.
This project provides download links of bart and bert models, users can download to the local, and set the bart path in the corresponding place of the code. Due to the project being deployed Autodl platform, Bert model file location for/root/cache/huggingface/hub/models - Bert - base - Chinese/snapshots/main.
Note: Since the lm_eval and bart_score packages used in the evaluation.py code are all self-contained packages of the project, you need to manually add the package path in the interpreter to ensure the normal operation of the code.

Model download

Qwen-7B-chat:https://huggingface.co/Qwen/Qwen-7B-Chat
ChatGLM3-6B:https://huggingface.co/THUDM/chatglm3-6b
bart-base-chinese:https://huggingface.co/fnlp/bart-base-chinese
bert-base-chinese:https://huggingface.co/google-bert/bert-base-chinese
AuditWen:https://huggingface.co/HooRin/AuditWen

Citation

If you use AuditWen in your work, please cite our paper.

@misc{2024AuditWen,
      title={AuditWen:An Open-source Large Language Model for Audit }, 
      author={Jiajia Huang, Haoran Zhu, Chao Xu, Tianming Zhan, Qianqian Xie, Jimin Huang},
      year={2024},
      booktitle = {China National Conference on Chinese Computational Linguistics},
      pages = {505–521},
      url = {https://aclanthology.org/2024.emnlp-main.28},<
      Cite = {Huang J, Zhu H, Xu C, et al. AuditWen: An Open-Source Large Language Model for Audit[C]//China National Conference on Chinese Computational Linguistics. Singapore: Springer Nature Singapore, 2024: 505-521.}
}

Thanks

This project is based on the secondary development of existing open-source projects. We would like to express our gratitude to the relevant projects and R&D personnel.
1.https://github.com/The-FinAI/PIXIU
2.https://github.com/QwenLM/Qwen

Contact

E-mail:

Contributors

HooRin

78 commits

HooRin/AuditWen

An Open-source Large Language Model for Audit

Python

29

78 commits

updated Apr 27, 2025

See the code

README

AuditWen

An Open-source Large Language Model for Audit

Introduction

The first Chinese open source audit model is based on Qwen-7B-chat and fine-tunes a large amount of supervisory audit related data. The model has a wide range of audit knowledge and intelligent analysis capabilities, aiming to provide comprehensive and effective problem analysis and audit foundation recommendations for the audit field.In the future, we will closely follow the update of qwen version and launch qwen 2.5 version. Stay tuned.

Explain

  1. This project is still constantly iterating and updating. Considering the wide coverage of the audit field and the serious shortage of domain dataset resources, we have only released fine-tuning models on the audit laws, regulations, and qualitative question and answer datasets;
  2. The data and models provided in this project are for scientific research purposes only and are strictly prohibited from being used for commercial purposes;

Application Scenarios of LLM in Audit Domain

Audit issue summary and Laws Recommendation

The primary task of audit is to identify any potential audit issues within a project and determine which laws and regulations can serve as the audit basis. From this perspective, auditors are seeking LLMs to assist in summarizing audit issues based on audit working papers and recommending suitable laws and regulations as both qualitative and punishment basis. The primary challenge in the application is that an internal auditor may have a divergent qualitative basis for an audit issue compared to a social auditor based on the case description in the audit working paper. For example, an internal auditor may use items from enterprise internal control manual as qualitative basis without any penalty provision, while a social auditor may refer to items in Accounting Law and Criminal Law for punishment. To address this challenge, we propose an audit issue schema that summarizes audit issue from case description and aligns them with the clauses of laws and regulations simultaneously。We hope to bridge a gap between the clause of laws and regulations and the audit issue:

Qualitative basis of audit problem and recommended model of punishment basis

Description of the image

Audit Relevant Question and Answer

The secondary task of LLM used in audit is to answer question related to audit, such as questions list in Table 1. These questions pertain to defining an audit concept, understanding the specifics of a particular clause of a law, determining the methods for investigating and verifying audit issues, and identifying the necessary data to be collected. These diverse questions prompt us to gather relevant audit documents pertaining to audit cases, audit criteria, audit guidelines, and so on. When assessing the quality of answers generated by LLM, it is crucial to minimize the occurrence of hallucination responses and ensure the retrieval of original text based on existing system documents and other relevant content:

Examples of possible QA proposed by auditor
QueryAnswer
What internal control information does the company need to disclose? (公司需要披露哪些内部控制信息?)The Company shall fully disclose any internal control information that has a significant impact on investors' investment decisions.(凡对投资者投资决策有重大影响的内部控制信息,公司均应充分披露。)
What are the responsibilities of the audit institution under the Internal Audit Regulations? (内部审计条例规定的审计机关的职责有哪些?)According to Article 23 of Chapter 5 of the Internal Audit Regulations of XX Province, the responsibilities of audit institutions include the following:… (根据XX省内部审计条例第五章第二十三条,审计机关的职责包含以下几项:...)
What methods should be adopted in the audit of significant secured loans to identify and conduct detailed investigation? (重大担保借款审计中需要采取哪些方法来识别并展开详细调查?)Review meeting minutes and materials, documents, contract approval documents, etc., review decision-making process, guarantee scope, scale, etc. (调阅会议纪要及上会材料、文书、合同审批文件等,审核决策流程、担保范围、规模等。)
What key information should be collected when conducting a construction project performance audit? (在进行建设项目绩效审计时,应该收集哪些关键资料?)When conducting a construction project performance audit, key data include: approved project proposals and feasibility study reports,… (在进行建设项目绩效审计时,关键资料包括:已获批准的项目建议书和可行性研究报告,...)

Audit assistant

Further derive requirement of LLM applied in audit domain is LLM can act as an intelligent assistant and help auditor to extract specified phrase from audit document, do accounting relevant numerical calculation, generate an outline for an audit report and further fill content based on the given audit working papers. The possible case questions are list in Table 2. Audit assistant usually need to execute fine-grained NLP task step by step, such as information extraction, multi-documents summarization and document generation. Additionally, audit assistants must achieve collaborative work between humans and machines with the guidance of human-provided knowledge:

The potential tasks that may be assigned to an audit intelligent assistant.
IdQuery
Q1Please extract entity about the audited organization from the following documents. (请从下面文档中抽取出被审计单位信息。)
Q2Please judge whether Company A is losing money according to the following statement.(请根据下面的报表判断A公司是否亏损?)
Q3Please write a business leader economic responsibility audit report template. (请撰写出一个企业领导人经济责任审计报告模板。)
Q4Based on the uploaded audit draft and the generated audit report template, please write the audit process and method of XX leader's accountability audit. (基于上传的审计底稿和生成的审计报告模板,请撰写XX领导人经责审计的审计过程与方法。)
Q5Based on the uploaded audit ledger list, audit ledgers belonging to the same audit issue are merged into the same document and output. (基于上传的审计台账列表,将属于同一审计问题的审计台账归并到同一文档中并输出。)

Modality and Prompts

On the basis of collecting and organizing structured data for various audit tasks, write instruction data. Taking audit procedures as an example, the table below shows some structured data:

Raw structured data
审计类型审计事项审计程序
公共工程审计工程项目内部控制审计关于工程项目内部控制审计程序,中天恒3C框架研制的工程项目内部控制审计一般程序包括工程项目内部控制有效性调查、初步评价、风险评估、控制测试、评价缺陷、审计评价、形成意见等...
公共工程审计工程项目投资决策审计工程项目投资决策审计程序:·收集工程项目投资决策相关法律法规。·收集工程项目投资决策相关材料。·调查了解工程项目投资决策情况。·查证核实工程项目投资决策情况(对专业技术文件可委托专业中介机构进行审核,并出具专业审核意见)...
公共工程审计工程项目征地拆迁审计征地拆迁除要满足一般的审计程序之外,需要特殊考虑的审计程序或工作主要有:...

Next, construct the corresponding instructions through the following scheme:
Question:在[审计类型]中,[审计事项]的审计程序是什么?
Answer:[审计程序]
(For more types of tasks, refer to the file Raw structured data.xlsx in the directory/corpus/Raw structured data)
Based on the above template, the converted instruction data is as follows:

Instruction data set presentation
QueryAnswer
在公共工程审计中,工程项目内部控制审计的审计程序是什么?关于工程项目内部控制审计程序,中天恒3C框架研制的工程项目内部控制审计一般程序包括工程项目内部控制有效性调查、初步评价、风险评估、控制测试、评价缺陷、审计评价、形成意见等...
在公共工程审计中,工程项目投资决策审计的审计程序是什么?工程项目投资决策审计程序:·收集工程项目投资决策相关法律法规。·收集工程项目投资决策相关材料。·调查了解工程项目投资决策情况。·查证核实工程项目投资决策情况(对专业技术文件可委托专业中介机构进行审核,并出具专业审核意见)...
在公共工程审计中,工程项目征地拆迁审计的审计程序是什么?征地拆迁除要满足一般的审计程序之外,需要特殊考虑的审计程序或工作主要有:...

The table below summarizes the different tasks, template and examples of an instruction data:

Examples of the instruction data used in LLM tuning dataset
Task nameTemplateExamples of an instruction data
Audit NERT (1)"query": 文本: 通过对证券公司和国有企业审计,…。","在上面的文本中,请完成命名实体识别任务,即识别代表审计疑点('auditissue')、机构('ORG')、审计法律法规('auditlbasis')三类实体类型的实体名称,答案应遵循格式"实体名称, 实体类型"。"answer": "证券公司, ORG","label": ["O", "O", "O", "B-ORG", "I-ORG", "I-ORG", "I-ORG", "",…]
Relation ClassificationT (1)"query":文本:将进口料件表体、报关单表头与加工贸易禁止类商品目录通过商品编号进行关联,筛选出涉及禁止类商品的加工贸易手册。实体对:禁止类商品-加工贸易禁止类商品目录", 根据提供的审计内容和实体对,从['审计问题', '审计事项', '审计依据', '审计方法', '审计机构','审计成果','被审计单位','涉及的行业或领域']中选择能准确表示该实体对关系的选项。请直接回答,如有不确定情况可回答unknown。"answer": 审计依据, "choices": ["unknown", "审计问题", "审计事项", "审计依据", "审计方法", "审计机构", "审计成果", "被审计单位", "涉及的行业或领域"], "gold": 3.
Definition of audit entityT (2)"query": 请问什么是营业外收入?, "answer": 该科目核算的是企业发生的与其生产经营无直接关系的各项收入,包括固定资产盘盈、处置固定资产净收益….。
Audit-legal relevant quesitonT (2)"query": 如果某公司违反了中华人民共和国证券法第九十条关于征集股东权利的规定,将受到何种法律后果?"answer":根据中华人民共和国证券法第一百九十九条,该公司将被责令改正并给予警告…。
Audit-issue relevant questionT(2)"query":请问项目单位挤占挪用社会福利基金的表现形式是什么样的?"answer": 项目单位挤占挪用社会福利基金的表现形式:社会福利基金用于投资办企业…。
Other-audit relevant questionT(2)"query": 请问资源环保审计包括的审计内容是什么?,"answer": 资源环保审计包括的审计内容是土地资源资产,…。
Risk/problem analysisT (2)"query": 在国有企业经济责任审计,资产审计可能存在哪些审计风险?"answer": 资产审计可能存在如下风险点:(一)客户管理效率低,没有全面调研客户资质、信用状况并动态跟踪,没有对客户分类,并采取不同的销售政策。…。

Tasks

The details of our evaluation datasets. "Annotation" denotes the construction manner of the instruction data from raw data source.
LevelTask nameSub-task nameTrainValidationTestAnnotation
Sentence levelAudit NERAudit NER409110221424human annotation
Sentence levelRelation ClassificationRelation Classification817232117human annotation
Sentence levelPhrase classificationaudit entity classification--1578human annotation
Sentence levelPhrase classificationaudit-issue phrase classification1210344166human annotation
Sentence levelPhrase classificationlegal name classification1463418218human annotation
Paragraph LevelDefinition of audit entityDefinition of audit entity1756500190Extract from raw text
Paragraph LevelAudit-legal relevant questionAudit-legal relevant question15774112505Generated by GPT-4
Paragraph LevelAudit-problem relevant questionaudit issue summary2537136Extract from raw text
Paragraph LevelAudit-problem relevant questionaudit issue describe2025629Extract from raw text
Paragraph LevelAudit-problem relevant questionlegal recommendation1567445224Extract from raw text
Paragraph LevelOther-audit relevant questionaudit procedures and material67119096Extract from raw text
Paragraph LevelOther-audit relevant questionaudit type and objectives60917187Extract from raw text
Paragraph LevelOther-audit relevant questionother question903257129Converted from audit knowledge graph
Documents LevelAudit item/risk/problem analysisAudit item/risk/problem analysis54415177Extract from raw text
Documents LevelAudit case/report generationAudit case/report generation48116Extract from raw text
Total2990839804941

The overall performance of different LLMs on audit evaluation benchmark, * denotes 5-shot evaluation for the task.

Task nameSub-task nameMetricQwen-7B-chatChatGLM3-6BGPT-4AuditWen
NERNERentity_F10.140*0.015*0.108*0.535*
Relation ClassificationRelation Classificationaccuracy--/0.085*0.376/0.342*0.402/0.624*0.615/0.188*
Relation ClassificationRelation ClassificationF1--/0.037*0.243/0.373*0.432/0.649*0.744/0.220*
Relation ClassificationRelation Classificationmissing0.410/0.000.008/0.0000.000/0.0000.350/0.274
Phrase classificationaudit entity classification*accuracy0.716/0.763*0.493/0.5400.679/0.810*0.601/0.720*
Phrase classificationaudit entity classification*F10.710/0.734*0.583/0.612*0.697/0.816*0.612/0.716*
Phrase classificationaudit entity classification*missing0.042/0.000.146//0.0000.023/0.0000.077/0.000*
Phrase classificationaudit-issue phrase classificationaccuracy--/0.399*0.254/0.353*0.464/0.543*0.437/0.601*
Phrase classificationaudit-issue phrase classificationF1--/0.347*0.193/0.252*0.484/0.557*0.428/0.0.595*
Phrase classificationaudit-issue phrase classificationmissing0.751/0.0000.078/0.0580.000/0.0000.085/0.037
Phrase classificationlegal name classificationaccuracy--/0.146*0.394/0.468*0.637/0.647*0.752/0.431*
Phrase classificationlegal name classificationF1--/0.075*0.388/0.428*0.623/0.639*0.774/0.405*
Phrase classificationlegal name classificationmissing0.766/0.1650.000/0.0000.004/0.0000.050/0.037
Definition of audit entityDefinition of audit entityROUGE-10.2450.220.2020.298
Definition of audit entityDefinition of audit entityROUGE-20.0530.0370.0370.121
Definition of audit entityDefinition of audit entityROUGE-L0.1780.1560.1210.237
Definition of audit entityDefinition of audit entityBF10.6780.6700.6620.702
Definition of audit entityDefinition of audit entityBART Score-4.527-4.535-4.391-4.175
Audit-legal relevant questionAudit-legal relevant questionBF10.6960.6710.6650.723
Audit-legal relevant questionAudit-legal relevant questionBART Score-3.659-3.356-3.424-3.480
Audit-issue relevant questionaudit issue summaryBF10.6340.6440.6340.642
Audit-issue relevant questionaudit issue summaryBART Score-4.470-4.485-4.524-4.456
Audit-issue relevant questionaudit issue describeBF1 0.6960.6740.6550.792
Audit-issue relevant questionaudit issue describeBART Score-4.048-3.827-3.996-3.044
Audit-issue relevant questionlegal recommendationROUGE-10.2470.2680.2750.530
Audit-issue relevant questionlegal recommendationROUGE-20.0610.0630.0830.386
Audit-issue relevant questionlegal recommendationROUGE-L0.1500.1520.1510.442
Audit-issue relevant questionlegal recommendationBF1 0.6540.6650.6770.785
Audit-issue relevant questionlegal recommendationBART Score-4.799-4.192-3.661-3.406
Other-audit relevant questionaudit procedures and materialBF10.670.6820.6940.746
Other-audit relevant questionaudit procedures and materialBART Score-5.127-4.681-5.166-4.514
Other-audit relevant questionaudit items and objectivesBF10.7230.6970.6340.907
Other-audit relevant questionaudit items and objectivesBART Score-3.794-3.650-4.069-1.587
Other-audit relevant questionother questionBF10.7040.6630.6350.900
Other-audit relevant questionother questionBART Score-3.284-3.171-2.985-1.202
Risk/problem analysisRisk/problem analysisBF10.670.6780.6670.84
Risk/problem analysisRisk/problem analysisBART Score-4.854-3.61-3.291-3.031
Audit case/report generationAudit case/report generationBF10.6580.6680.6700.684
Audit case/report generationAudit case/report generationBART Score-5.584-5.003-4.782-5.011

GPT_Q&A

Construct a Q&A session on legal and regulatory content through GPT4.0
The gpt4_law_result.xlsx in the directory/AuditWen/GPT_Q&A/data displays regulatory content and content generated by GPT4.

Quick Start

Directory Structure

---/src/ evaluate related packages
----/finetune/ Qwen's finetune Project -- Instruction fine-tuning
----/PIXIU/ PIXIU Project -- NLP Task Inference and Evaluation
----/qa_eval/ Q&A Task Reasoning Reasoning and Evaluation
-----/quick_interference.py/ Immediate inference code
-----/interence.py/ task-based inference code
-----/evaluation.py/ evaluation code
---/pics/ Related pictures
---/GPT_Q&A/
----/code/ GPT4 generates the code for the Q&A
----/data/ partial data
---/corpus/
----/benchmark datatset/ Test set for various tasks
----/result/ Inference results of various task test sets on various pedestals
----/Raw structured data/ Raw Structured data
----/train/ Training instruction set

Inference Model

To reason with AuditWen, you simply enter a few lines of code, as shown below. Remember to pass the correct model name or path, such as "/model/AuditWen". However, make sure you are using the latest code. (This project also provides quick_interference.py with proxy code located in the directory /AuditWen/src/qa_eval)

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation import GenerationConfig

# Model names: "/model/AuditWen"
tokenizer = AutoTokenizer.from_pretrained( "/model/AuditWen", trust_remote_code=True)

# use auto mode, automatically select precision based on the device.
model = AutoModelForCausalLM.from_pretrained(
    " /model/AuditWen",
    device_map="auto",
    trust_remote_code=True
).eval()
#You can specify different generation length, top p and other related superparameters
model.generation_config = GenerationConfig.from_pretrained(" /model/AuditWen",, trust_remote_code=True, )  

# 1st dialogue turn
response, history = model.chat(tokenizer, "请问什么是审计范围?", history=None)
print(response)
#审计范围是指审计机构和审计人员在一定的审计目的和审计计划指导下,为完成审计任务所进行的审查所有事项。
#它包括审计对象、审计期间、以及对这些审计对象各个方面所进行的审查程度。

# 2nd dialogue turn
response, history = model.chat(tokenizer, "请问什么是财务报表审计?", history=history)
print(response)
#财务报表审计是指注册会计师对被审计单位编制的财务报表的真实性、合法性、完整性作出审计结论,提出审计意见,形成审计报告的一项审计业务。
#财务报表审计是注册会计师接受委托,按照独立审计准则的要求,对企事业单位的财务报表进行审査,并据此发表审计意见,出具审计报告。所发行的审计报告,为报表使用者做出正确决策提供可靠的参考资料

Fine tuning

Model fine-tuning related content reference https://github.com/QwenLM/Qwen
To prepare the training data, you need to put all the samples into a list and save them to a json file. Each sample is a dictionary, consisting of an id and a list of conversations. Here is a list of simple examples with 1 sample:

[
  {
    "id": "identity_0",
    "conversations": [
      {
        "from": "user",
        "value": "请问审计事项'工程设计审计'的审计类型是什么?"
      },
      {
        "from": "assistant",
        "value": "工程设计审计的审计类型是工程项目竣工决算审计。"
      }
    ]
  }
]

In addition, this project also provides a training set containing 2000 entries located in the directory/AuditWen/corpus for users to refer to.
After the data is ready, you can use the shell script provided in the directory/AuditWen/src/finetune/Qwen main/finetune to run finetuning. Please remember to specify the path to the data file. For detailed usage, please refer to the introduction of the Qwen project.

Evaluation-PIXIU

The NLP tasks, namely NER, RE, and NL tasks, are evaluated based on PIXIU. This project has optimized the evaluation method to ensure the accuracy of the evaluation results.

Environmental preparation

cd PIXIU
pip install -r requirements.txt
cd PIXIU/src/financial-evaluation
pip install -e .[multilingual]

Data path setting

In the init.py file under path \PIXIU\src\tasks, set the name of the task and the corresponding method of data processing,Taking "flare_zh_auditner": flare.AuditNER, "as an example, the method for auditing the data loading and processing of the named entity identification task is AuditNER under flare.py.Next, the parameter DATASET_PATH in the AuditNER method is set to the data set path.

Evaluation

To evaluate a model hosted on the HuggingFace Hub (for instance, AuditWen), use this command:

python eval.py \
    --model
    "hf-causal-vllm"
    --model_args
    "pretrained=/model/AuditWen,tokenizer=/model/AuditWen,trust_remote_code=True"
    --tasks
    "flare_zh_auditner"

Commercial APIs:

export OPENAI_API_SECRET_KEY=YOUR_KEY_HERE
python eval.py \
    --model gpt-4 \
    --tasks "flare_zh_auditner"

Evaluation-QA

Model inference is run inference.py under the qa_eval directory, while content evaluation is run evaluation.py under the qa_eval directory

Inference

Reasoning data in the form of a visible directory/AuditWen corpus/benchmark datatset q&a type task under json files in the directory.

Evaluation

The evaluation method of Q&A tasks is optimized based on the evaluation method of PIXIU Q&A tasks. rouge_chinese is used for evaluation, and the word segmentation "Audit Word segmentation.txt" located in the directory /AuditWen/src/qa_eval/src is loaded for evaluation.Loading through jieba's load_userdict method.The evaluation of bart and bert is also replaced with the Chinese version, and the evaluation effect is somewhat improved compared with PIXIU.
This project provides download links of bart and bert models, users can download to the local, and set the bart path in the corresponding place of the code. Due to the project being deployed Autodl platform, Bert model file location for/root/cache/huggingface/hub/models - Bert - base - Chinese/snapshots/main.
Note: Since the lm_eval and bart_score packages used in the evaluation.py code are all self-contained packages of the project, you need to manually add the package path in the interpreter to ensure the normal operation of the code.

Model download

Qwen-7B-chat:https://huggingface.co/Qwen/Qwen-7B-Chat
ChatGLM3-6B:https://huggingface.co/THUDM/chatglm3-6b
bart-base-chinese:https://huggingface.co/fnlp/bart-base-chinese
bert-base-chinese:https://huggingface.co/google-bert/bert-base-chinese
AuditWen:https://huggingface.co/HooRin/AuditWen

Citation

If you use AuditWen in your work, please cite our paper.

@misc{2024AuditWen,
      title={AuditWen:An Open-source Large Language Model for Audit }, 
      author={Jiajia Huang, Haoran Zhu, Chao Xu, Tianming Zhan, Qianqian Xie, Jimin Huang},
      year={2024},
      booktitle = {China National Conference on Chinese Computational Linguistics},
      pages = {505–521},
      url = {https://aclanthology.org/2024.emnlp-main.28},<
      Cite = {Huang J, Zhu H, Xu C, et al. AuditWen: An Open-Source Large Language Model for Audit[C]//China National Conference on Chinese Computational Linguistics. Singapore: Springer Nature Singapore, 2024: 505-521.}
}

Thanks

This project is based on the secondary development of existing open-source projects. We would like to express our gratitude to the relevant projects and R&D personnel.
1.https://github.com/The-FinAI/PIXIU
2.https://github.com/QwenLM/Qwen

Contact

E-mail:

Contributors

HooRin

78 commits

Languages

Python

83.4%

Perl

12.1%

Jupyter Notebook

3.4%