InternScience/Agents-K1
- License
- apache-2.0
- Size
- not mirrored yet
No official torrent yet — requesting it tells the flock what to host next. You cannot seed a catalog-only page.
Cataloged from InternScience/Agents-K1
All models by InternScience →No official torrent yet — requesting it tells the flock what to host next. You cannot seed a catalog-only page.
Cataloged from InternScience/Agents-K1
All models by InternScience →Knowledge extraction model in Agents-K1 is a 4B-parameter language model fine-tuned from
Qwen/Qwen3-4B-Instruct-2507
with GRPO (Group Relative Policy Optimization) on the information-extraction
corpus, targeting Named Entity Recognition (NER) and Relation Extraction (RE)
in English scientific and general-domain text.
The model produces structured JSON extractions with explicit step-by-step reasoning, enabling its use as a building block in downstream knowledge-graph construction, citation linking, and multi-hop QA pipelines.
<think>…</think><answer>…</answer> schema, making
reasoning auditable and JSON parsing reliable.Designed as an extraction backbone for:
Not intended for general-purpose chat — it has been specialized for structured extraction.
The model uses the same chat template as Qwen3-4B-Instruct and expects a
schema-driven user prompt. The reply will contain a <think> block followed by
an <answer> block with a JSON object.
For RE, replace the user template with Relation types to extract: [...]
and a relation-extraction instruction; the output schema is a JSON dict mapping
relation types to lists of {head, tail} pairs.
Training data comes from IEPile, restricted to:
70% of samples have non-empty gold labels; 30% are empty-label cases (to prevent the model from defaulting to non-empty outputs).
0.1 · 𝟙[has <think>] + 0.1 · 𝟙[has <answer>]0.1 · 𝟙[valid JSON dict] (or 0.05 for non-dict valid JSON)0.7 · F1(pred, gold) — entity-set F1 for NER, triple-set F1 for REReported numbers are micro-F1 on each benchmark's official test split, using the same prompt template as training. Gains are base → Agents-K1 (GRPO).
All 10/10 benchmarks improve, including the 5 CrossNER domains that are not in the training mix — evidence of generalization rather than mere fitting to in-distribution sources.
Released under the Apache-2.0 license, following the upstream Qwen3-4B-Instruct-2507 license. Users must also comply with the licenses of the IEPile component datasets when using this model in derivative works.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "InternScience/Agents-K1"tok = AutoTokenizer.from_pretrained(model_id)model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="bfloat16", device_map="auto")
system = ( "You are an expert in information extraction. Given a task instruction " "with schema definitions and input text, extract the required information.\n\n" "You should think step by step about the extraction task, then provide " "your answer in JSON format.\n\n" "Format your response as:\n" "<think>\nYour step-by-step reasoning...\n</think>\n" "<answer>\nYour JSON extraction result here\n</answer>")
user = ( "You are an expert in named entity recognition. Please extract entities " "that match the schema definition from the input. Return an empty list if " "the entity type does not exist. Please respond in the format of a JSON " "dictionary.\n\n" 'Entity types to extract: ["person", "organization", "location"]\n\n' "Input text: Marie Curie worked at the University of Paris.\n\n" "Please think step by step and respond in the following format:\n" "<think>\nYour reasoning process...\n</think>\n" "<answer>\nYour JSON extraction result\n</answer>")
messages = [{"role": "system", "content": system}, {"role": "user", "content": user}]inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)out = model.generate(inputs, max_new_tokens=512, do_sample=False)print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))