Phi 3 Mini 4k Instruct Graph
Phi-3-mini-4k-instruct-graph是微软Phi-3-mini-4k-instruct的微调版本,专门用于从通用文本数据中进行实体关系提取,旨在在生成实体关系图方面达到与GPT-4相当的质量和准确性。
下载量 524
发布时间 : 7/20/2024
模型简介
该模型专为从通用文本数据中生成表示实体关系的结构化JSON数据而设计,可用于增强信息检索、探索时间关系和进行趋势分析。
模型特点
高质量实体关系提取
在生成实体关系图方面达到与GPT-4相当的质量和准确性。
高效处理
在大规模处理文本数据时提高效率,适用于高吞吐量应用。
结构化输出
生成表示实体关系的结构化JSON数据,便于后续处理和分析。
模型能力
实体识别
关系提取
结构化JSON生成
使用案例
信息检索
增强文本数据库
通过提取实体和关系,增强各种文本数据库中的信息检索能力。
趋势分析
高级预测建模
对各种文本来源进行趋势分析,支持高级预测建模。
内容分析
内容聚合平台
适用于需要高吞吐量处理大量文本数据的应用,如内容聚合平台。
🚀 Phi-3-mini-4k-instruct-graph模型卡片
本模型是微软Phi-3-mini-4k-instruct的微调版本,专门用于从通用文本数据中进行实体关系提取。它旨在在生成实体关系图方面达到与GPT - 4相当的质量和准确性,同时在大规模处理时提高效率。
🚀 快速开始
以下代码片段展示了如何在GPU上快速运行该模型:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
torch.random.manual_seed(0)
model = AutoModelForCausalLM.from_pretrained(
"EmergentMethods/Phi-3-mini-4k-instruct-graph",
device_map="cuda",
torch_dtype="auto",
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained("EmergentMethods/Phi-3-mini-4k-instruct-graph")
messages = [
{"role": "system", "content": """
A chat between a curious user and an artificial intelligence Assistant. The Assistant is an expert at identifying entities and relationships in text. The Assistant responds in JSON output only.
The User provides text in the format:
-------Text begin-------
<User provided text>
-------Text end-------
The Assistant follows the following steps before replying to the User:
1. **identify the most important entities** The Assistant identifies the most important entities in the text. These entities are listed in the JSON output under the key "nodes", they follow the structure of a list of dictionaries where each dict is:
"nodes":[{"id": <entity N>, "type": <type>, "detailed_type": <detailed type>}, ...]
where "type": <type> is a broad categorization of the entity. "detailed type": <detailed_type> is a very descriptive categorization of the entity.
2. **determine relationships** The Assistant uses the text between -------Text begin------- and -------Text end------- to determine the relationships between the entities identified in the "nodes" list defined above. These relationships are called "edges" and they follow the structure of:
"edges":[{"from": <entity 1>, "to": <entity 2>, "label": <relationship>}, ...]
The <entity N> must correspond to the "id" of an entity in the "nodes" list.
The Assistant never repeats the same node twice. The Assistant never repeats the same edge twice.
The Assistant responds to the User in JSON only, according to the following JSON schema:
{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"detailed_type":{"type":"string"}},"required":["id","type","detailed_type"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"label":{"type":"string"}},"required":["from","to","label"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false}
"""},
{"role": "user", "content": """
-------Text begin-------
OpenAI is an American artificial intelligence (AI) research organization founded in December 2015 and headquartered in San Francisco, California. Its mission is to develop "safe and beneficial" artificial general intelligence, which it defines as "highly autonomous systems that outperform humans at most economically valuable work".[4] As a leading organization in the ongoing AI boom,[5] OpenAI is known for the GPT family of large language models, the DALL-E series of text-to-image models, and a text-to-video model named Sora.[6][7] Its release of ChatGPT in November 2022 has been credited with catalyzing widespread interest in generative AI.
-------Text end-------
"""}
]
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
)
generation_args = {
"max_new_tokens": 500,
"return_full_text": False,
"temperature": 0.0,
"do_sample": False,
}
output = pipe(messages, **generation_args)
print(output[0]['generated_text'])
# Output:
# {
# "nodes": [
# {
# "id": "OpenAI",
# "type": "organization",
# "detailed_type": "ai research organization"
# },
# {
# "id": "GPT family",
# "type": "technology",
# "detailed_type": "large language models"
# },
# {
# "id": "DALL-E series",
# "type": "technology",
# "detailed_type": "text-to-image models"
# },
# {
# "id": "Sora",
# "type": "technology",
# "detailed_type": "text-to-video model"
# },
# {
# "id": "ChatGPT",
# "type": "technology",
# "detailed_type": "generative ai"
# },
# {
# "id": "San Francisco",
# "type": "location",
# "detailed_type": "city"
# },
# {
# "id": "California",
# "type": "location",
# "detailed_type": "state"
# },
# {
# "id": "December 2015",
# "type": "date",
# "detailed_type": "foundation date"
# },
# {
# "id": "November 2022",
# "type": "date",
# "detailed_type": "release date"
# }
# ],
# "edges": [
# {
# "from": "OpenAI",
# "to": "San Francisco",
# "label": "headquartered in"
# },
# {
# "from": "San Francisco",
# "to": "California",
# "label": "located in"
# },
# {
# "from": "OpenAI",
# "to": "December 2015",
# "label": "founded in"
# },
# {
# "from": "OpenAI",
# "to": "GPT family",
# "label": "developed"
# },
# {
# "from": "OpenAI",
# "to": "DALL-E series",
# "label": "developed"
# },
# {
# "from": "OpenAI",
# "to": "Sora",
# "label": "developed"
# },
# {
# "from": "OpenAI",
# "to": "ChatGPT",
# "label": "released"
# },
# {
# "from": "ChatGPT",
# "to": "November 2022",
# "label": "released in"
# }
# ]
# }
✨ 主要特性
- 本模型专为从通用文本数据中生成表示实体关系的结构化JSON数据而设计。
- 可用于增强各种文本数据库中的信息检索。
- 有助于探索不同类型文档中的时间关系和演变叙事。
- 可用于对各种文本来源进行趋势分析的高级预测建模。
- 特别适用于需要高吞吐量处理大量文本数据的应用,如内容聚合平台、研究数据库和综合文本分析系统。
📚 详细文档
模型详情
- 开发者:Emergent Methods
- 资助方:Emergent Methods
- 共享方:Emergent Methods
- 模型类型:microsoft/phi - 3 - mini - 4k - instruct(微调版)
- 语言:英语
- 许可证:知识共享署名-非商业性使用-相同方式共享4.0许可协议
- 微调基础模型:[microsoft/phi - 3 - mini - 4k - instruct](https://huggingface.co/microsoft/phi - 3 - mini - 4k - instruct)
更多信息,请查看我们的博客文章: 📰 博客
用途
本模型旨在生成表示通用文本数据中实体关系的结构化JSON数据,可用于以下方面:
- 增强各种文本数据库中的信息检索。
- 探索不同类型文档中的时间关系和演变叙事。
- 对各种文本来源进行趋势分析的高级预测建模。
该模型特别适用于需要高吞吐量处理大量文本数据的应用,如内容聚合平台、研究数据库和综合文本分析系统。
偏差、风险和局限性
尽管数据集的目标是减少偏差并提高多样性,但它仍然偏向于西方语言和国家。这一局限性源于Llama2在翻译和摘要生成方面的能力。此外,由于使用Llama2对开放网络文章进行摘要,Llama2训练数据中的任何偏差也会存在于该数据集中。同样,微软Phi - 3中存在的任何偏差也会出现在当前数据集中。
训练详情
- 训练数据:来自AskNews的7000多篇故事和更新,经过精心策划以避免主题重叠。
- 训练过程:使用Transformers库、SFTTrainer、PEFT和QLoRA进行微调。
评估结果
与GPT - 4o(基准真相)、Claude Sonnet 3.5和基础Phi - 3模型相比:
指标 | Phi - 3微调版 | Claude Sonnet 3.5 | Phi - 3(基础版) |
---|---|---|---|
节点相似度 | 0.78 | 0.64 | 0.64 |
边相似度 | 0.49 | 0.41 | 0.30 |
JSON一致性 | 0.99 | 0.97 | 0.96 |
JSON相似度 | 0.75 | 0.67 | 0.63 |
环境影响
- 硬件类型:1x A100 SXM
- 使用时长:3小时
- 碳排放:0.44千克(根据机器学习影响计算器)
伦理考量
用户应注意,本模型专为从通用文本数据中进行实体关系提取而设计,未经进一步微调可能不适用于其他领域。在将模型输出用于可能影响决策或公共信息传播的应用时,应进行审查和验证。
📄 许可证
本模型使用的许可证为知识共享署名-非商业性使用-相同方式共享4.0许可协议(Creative Commons Attribution Non Commercial Share Alike 4.0)。
Rebel Large
REBEL是一种基于BART的序列到序列模型,用于端到端关系抽取,支持200多种不同关系类型。
知识图谱
Transformers 英语

R
Babelscape
37.57k
219
Nel Mgenre Multilingual
基于mGENRE的多语言生成式实体检索模型,针对历史文本优化,支持100+种语言,特别适配法语、德语和英语的历史文档实体链接。
知识图谱
Transformers 支持多种语言

N
impresso-project
17.13k
2
Biomednlp KRISSBERT PubMed UMLS EL
MIT
KRISSBERT是一个基于知识增强自监督学习的生物医学实体链接模型,通过利用无标注文本和领域知识训练上下文编码器,有效解决实体名称多样性变异和歧义性问题。
知识图谱
Transformers 英语

B
microsoft
4,643
29
Coder Eng
Apache-2.0
CODER是一种知识增强型跨语言医学术语嵌入模型,专注于医学术语规范化任务。
知识图谱
Transformers 英语

C
GanjinZero
4,298
4
Umlsbert ENG
Apache-2.0
CODER是一个基于知识注入的跨语言医学术语嵌入模型,专注于医学术语标准化任务。
知识图谱
Transformers 英语

U
GanjinZero
3,400
13
Text2cypher Gemma 2 9b It Finetuned 2024v1
Apache-2.0
该模型是基于google/gemma-2-9b-it微调的Text2Cypher模型,能够将自然语言问题转换为Neo4j图数据库的Cypher查询语句。
知识图谱
Safetensors 英语
T
neo4j
2,093
22
Triplex
Triplex是SciPhi.AI基于Phi3-3.8B微调的模型,专为从非结构化数据构建知识图谱设计,可将知识图谱创建成本降低98%。
知识图谱
T
SciPhi
1,808
278
Genre Linking Blink
GENRE是一种基于序列到序列方法的实体检索系统,采用微调后的BART架构,通过受约束的束搜索技术生成唯一实体名称。
知识图谱 英语
G
facebook
671
10
Text To Cypher Gemma 3 4B Instruct 2025.04.0
Gemma 3.4B IT 是一个基于文本到文本生成的大语言模型,专门用于将自然语言转换为Cypher查询语言。
知识图谱
Safetensors
T
neo4j
596
2
Mrebel Large
REDFM是REBEL的多语言版本,用于多语言关系抽取任务,支持18种语言的关系三元组提取。
知识图谱
Transformers 支持多种语言

M
Babelscape
573
71
精选推荐AI模型
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers 支持多种语言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers 英语

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统 中文
R
uer
2,694
98