Web Analytics

FAC-Synthesis

⭐ 97 stars Dutch by Zhongzhi660

🌐 Taal

Less is Enough: Het Syntheseren van Diverse Data in de Feature Space van LLMs

Dit is de officiële implementatie van het artikel: Less is Enough: Synthesizing Diverse Data in Feature Space of LLMs.


Kerninzicht

Werk slimmer, niet harder.

In de post-trainingsfase van LLMs is het effectiever om nauwkeurig de werkelijk ontbrekende sleutelkenmerken te identificeren en te synthetiseren, in plaats van blindelings enorme hoeveelheden oppervlakkig diverse teksten toe te voegen. Met slechts een klein aantal gerichte synthetische samples kunnen we significante lacunes vullen in de Feature Activation Coverage (FAC), wat leidt tot duidelijke prestatieverbeteringen bij downstream taken.

Waarom is dit inzicht eenvoudig maar krachtig?

Traditionele datasynthese richt zich op hoeveelheid en oppervlakkige diversiteit (vocabulaire, zinspatronen, topicverdeling), maar dit zijn vaak slechts zwakke indicatoren. Wat de prestaties van een model bij downstream taken werkelijk bepaalt, is de dekking van de sleutelkenmerken die door de doeltaak vereist zijn.

Ons werk onthult:

Figuur 1: De Efficiency Frontier van instructievolgende datasets. Onze voorgestelde methode behaalt een Win Rate op AlpacaEval 2.0 vergelijkbaar met MAGPIE, terwijl slechts 2K synthetische samples worden gebruikt (vs. 300K voor MAGPIE).


Aan de slag

Installatie

git clone https://github.com/Zhongzhi660/FAC-Synthesis.git
cd FAC-Synthesis
pip install -r requirements.txt


Repository Structure

FAC-Synthesis/
├── LICENSE
├── README.md
├── requirements.txt
│
├── sae_pretrain/                 # SAE pretraining
│   ├── datasets/                 # pretraining corpora (constructed from public sources)
│   └── outputs/                  # SAE pre-trained weights
│
├── sae_feature_analysis/         # SAE feature analysis pipeline
│   ├── interpret_features/       # feature interpretation (span collection + annotation)
│   ├── identify_task_relevant_features/   # task-relevant feature identification
│   └── identify_missing_features/         # missing-feature discovery (coverage gap)
│
├── fac_synthesis/                # FAC synthesis pipeline
│   ├── step1_contrastive_pair_construction/      # Step-1: contrastive pair construction
│   └── step2_feature_covered_sample_synthesis/   # Step-2: feature-covered synthesis
│
└── training_scripts/             # Downstream training / evaluation scripts
    ├── toxicity_detection/
    ├── reward_modeling/
    ├── instruction_following/
    └── behavior_steering/

Pre-training Sparse Autoencoders

De meeste scripts voor SAE-pretraining bevinden zich in sae_pretrain/. We bieden vooraf getrainde SAE-checkpoints aan op Hugging Face: Om SAEs te pretrainen, voer de volgende commando's uit:

# Step-1: Collect hidden activations from the backbone LLM (e.g., layer 16)
python create_actvs_uni.py 0 0 1 meta-llama/Llama-3.1-8B-Instruct 16

Step-2: Train SAEs on the target layer (e.g., layer 16)

python train_SAEs.py 0 16 meta-llama/Llama-3.1-8B-Instruct /sae_input/prompt_actvs_l16

Analyse van de kenmerken van SAE

Kenmerkenanalysetscripts bevinden zich in sae_feature_analysis/. Om activatiespannen te groeperen en menselijk leesbare kenmerkinterpretaties te genereren, voer uit:

# Step-1: Group extracted activation spans
python groupby_textspans.py /xxx/threshold_0.0

Step-2: Annotate feature explanations based on grouped spans

python annotate_explanations.py /xxx/threshold_0.0.tsv

Step-3: Identify task-relevant features from the explanations

python annotate_toxicity.py /xxx/threshold_0.0_explained.tsv

Step-4: Identify missing features via FAC analysis

python identify_fac.py anchor_features.tsv (complete) task_features.tsv (currently available)

Door dekking gestuurde gegevenssynthese

Scripts voor door dekking gestuurde synthese zijn te vinden in fac_synthesis/. Om synthetische queries te genereren, voer uit

# Step-1 (1): Contrastive Pair Construction
python generate_data_llama_r1.py \
  --features xxx.tsv \
  --out xxx \
  --temperature 0.8

Step-1 (2): Feature-Covered Sample Synthesis

python analyze_step1_synthetic_data.py python merge_step1_failed_cases.py

Step-2: Feature-Covered Sample Synthesis

python generate_data_llama_r2.py \ --features xxx.tsv \ --out xxx \ --temperature 0.8


Dankbetuigingen

In de evaluatiefase zijn onze downstream trainings- en test-scripts aangepast van de volgende open-source repositories:

Referentie

Als u dit werk nuttig vindt voor uw onderzoek, citeer dan ons artikel 🤩:

@article{li2026less,
  title={Less is Enough: Synthesizing Diverse Data in Feature Space of LLMs},
  author={Li, Zhongzhi and Wu, Xuansheng and Li, Yijiang and Hu, Lijie and Liu, Ninghao},
  journal={arXiv preprint arXiv:2602.10388},
  year={2026}
}

--- Tranlated By Open Ai Tx | Last indexed: 2026-05-27 ---