liveBook · Manning

Qwen

As explained in Building Specialized AI Systems

Qwen2.5-7B-Instruct is an instruction-tuned large language model in the Qwen2.5 family with approximately seven billion parameters.

Qwen2.5-7B-Instruct is an instruction-tuned, approximately seven-billion-parameter model selected for financial analyst-report summarization. Its financial pretraining supports financial conventions, key metrics, and analyst writing patterns, while its size enables practical fine-tuning on standard GPU infrastructure. section 2.5.1

Qwen is selected when the adaptation task benefits from:

  • Existing understanding of financial terminology, including P/E ratios, EBITDA, and guidance revisions. section 2.5.1
  • Instruction-following and summarization capabilities that support controlled output formats and styles. section 2.5.1
  • Efficient adaptation through LoRA applied to relevant projection layers rather than full model training. section 2.5.3

Fine-tuning formats each report and verified summary as a consistent input-target pair. A custom prompt template can be replaced by tokenizer.apply_chat_template() when preserving the model's original chat format is preferable. Training then uses configured sequence length, batching, learning rate, accumulation, and convergence settings. section 2.5.3

Financial report summarization

Provide an analyst report as input and train Qwen to produce its verified summary as the target response, using a consistent instruction, input, and response template. section 2.5.3

Listing 2.28 Loading the base model
from unsloth import FastLanguageModel
 
model, tokenizer = FastLanguageModel.from_pretrained(
    model_name="Qwen/Qwen2.5-7B-Instruct",
    max_seq_length=2048,  #A
    dtype=None,
    load_in_4bit=True,
)

Shows the practical loading configuration for Qwen2.5-7B-Instruct, including sequence length and four-bit loading. section 2.5.3

How Building Specialized AI Systems covers it

How deep it goes
Explains selection rationale and a LoRA-based training workflow, but defers detailed model architecture and evaluation.
Examples
Uses analyst reports, verified summaries, prompt-target pairs, and Qwen loading and training configurations.
What it assumes
Assumes prepared report-summary data and basic training configuration, while teaching model loading, prompt formatting, and LoRA preparation.
What you can do after
Build it from scratch by loading Qwen, applying LoRA, formatting report-summary pairs, and starting supervised training.
How it connects
Connects foundation models, instruction tuning, fine-tuning, LoRA, supervised fine-tuning, and summarization.

Also explained in

Compare how 2 books explain Qwen →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Specialized AI Systems. The section links point to the parts of the book it draws on.