NLP Text Classification --- Full Analysis & Manuscript Generation
Table of Contents
Open-source skill. Read reference/specs/output-variation-protocol.md
before every generation --- apply all variation layers for natural, diverse output.
Scope Boundary
Use this skill when:
vera-ai-nlp-reviewing has already established a credible baseline and the user wants a fuller model battery.
- The task is supervised text classification, optionally with a small set of numeric side features.
Do not use this skill when:
- The task is generation, retrieval, summarization, sequence labeling, or prompt-only classification.
- The desired method is not in the shipped model list below.
- The available hardware cannot support anything beyond CPU smoke testing and the user expects transformer-scale benchmarking.
Workflow
Continues from where vera-ai-nlp-reviewing stopped (PART 0-2 done).
| Step |
Responsibility |
Executor |
Document |
Input |
Output |
| Additional ML models |
Run Additional Models |
Main Agent |
workflow/step04-run-additional-models.md |
Prior step output |
PART 3 code + prose |
| Subgroup |
Analyze Subgroups |
Main Agent |
workflow/step05-analyze-subgroups.md |
Prior step output |
PART 4 code + prose |
| Deep learning |
Fit Advanced Models |
Main Agent |
workflow/step06-fit-advanced-models.md |
Prior step output |
PART 5 code + prose |
| Comparison |
Compare Models |
Main Agent |
workflow/step07-compare-models.md |
Prior step output |
PART 6 code + prose |
| Manuscript |
Generate Manuscript |
Main Agent |
workflow/step08-generate-manuscript.md |
Prior step output |
methods.md + results.md |
Additional Inputs
Collect if not already provided:
- Target discipline (for reporting conventions)
- Target journal or style (ACL, EMNLP, NeurIPS, etc.)
- Research question / hypothesis
- Subgroup variable or text property for stratification
Output Structure
output/
├── methods.md
├── results.md
├── tables/ ← Markdown + CSV per table
├── figures/ ← PNGs, 300 DPI
├── references.bib
└── code.py ← Style-varied
Key References (read before generation)
| File |
Purpose |
reference/specs/output-variation-protocol.md |
Output quality variation layers |
reference/specs/code-style-variation.md |
Seven-dimension code style diversity |
reference/patterns/sentence-bank.md |
4-6 phrasings per result type |
reference/rules/reporting-standards.md |
Hard rules for ML/DL reporting |
Reporting Standards
Same as vera-ai-nlp-reviewing, plus:
- All models: report F1 (weighted) and AUC (macro) with bootstrapped 95% CIs
- Deep learning: report training epochs, best epoch, learning rate, batch size
- ALBERT: report pre-trained model name, whether base was frozen
- Feature importance: unified 0-100 scale across ML and DL models
- Model comparison: frame as convergent findings, not horse race
- Tree-based with small N: frame as "exploratory"; never claim generalizability
Method Status
| Status |
Methods |
| Implemented in this skill |
SVM, Random Forest, LightGBM, GRU, TextCNN, ALBERT |
| Implemented optional variants |
Text + extra-feature fusion where the corresponding *_extra.py module exists |
| Not shipped in the open-source build |
BERT, RoBERTa, DeBERTa, SetFit, prompt-only classifiers, few-shot API-based methods |
Configuration Defaults
Pipeline constants live in config/default.json. Read it before generation. Adds to the testing-skill config:
ml_models.* — SVM/RF/LightGBM hyperparameter grids
deep_models.* — GRU/TextCNN/ALBERT hyperparameter grids, epochs, batch size, learning rate
gpu.{required_for, fallback_models} — e.g., ALBERT requires GPU; falls back to GRU+TextCNN if unavailable (see GPU Availability section below)
feature_importance.scale (0, 100) — unified scale across model families
subgroup.{min_size, interaction_alpha} — subgroup-analysis gating
To override: create config/local.json.
Why These Defaults
- ALBERT is the shipped transformer because it is materially lighter than full BERT-style baselines while still exercising a modern contextual encoder path.
- GRU + TextCNN are the CPU fallback because they preserve two complementary inductive biases, sequential recurrence and local n-gram filters, without pretending a transformer run happened.
- Tree-based models on sparse text remain marked "exploratory" at small N because they are useful robustness checks, not generally the most defensible primary NLP model.
GPU Availability
Check at workflow step 06 (advanced models) start. Implementation pattern:
import torch
GPU_AVAILABLE = torch.cuda.is_available()
MODELS_TO_FIT = ["GRU", "TextCNN"] + (["ALBERT"] if GPU_AVAILABLE else [])
if not GPU_AVAILABLE:
print("NOTE: CUDA not available; falling back to GRU + TextCNN. ALBERT skipped.")
Do NOT silently proceed without a model — the fallback must always include at least GRU + TextCNN on CPU.
Minimal Smoke Test
- Smoke-test prompt: "Continue from
vera-ai-nlp-reviewing on a 4-class 20 Newsgroups subset. Fit the additional ML models and the CPU-safe deep models, then produce the manuscript-ready artifacts."
- CPU pass condition: SVM, Random Forest, LightGBM, GRU, and TextCNN run; ALBERT may be skipped if CUDA is unavailable, but the fallback decision must be logged.
- Expected artifacts:
methods.md, results.md, tables/, figures/, references.bib, and one consolidated code.py.
Cross-Skill Interface
Method Unit Contract:
├── code_python → .py script (style-varied)
├── methods_md → methods.md (varied structure)
├── results_md → results.md (varied phrasing)
├── tables/ → Markdown + CSV
├── figures/ → PNGs 300 DPI (varied layout)
├── references_bib → .bib with cited references
└── comparison → cross-method narrative (in results.md)
1---2name: vera-ai-nlp-generating3description: Server-side extension that completes the full analysis pipeline for NLP text classification after vera-ai-nlp-reviewing has run. Adds SVM, Random Forest, LightGBM classifiers with TF-IDF and optional extra features, subgroup analysis by metadata or text properties, deep learning models (GRU, TextCNN, ALBERT with optional tabular fusion and hyperparameter search), cross-method comparison with unified feature importance on a 0-100 scale, and manuscript-ready methods.md and results.md. Applies output variation and code style diversity for natural, non-repetitive output. Open-source skill. Triggered after vera-ai-nlp-reviewing completes and its PART 0–2 artifacts are present (see ../../CROSS-SKILL-INTERFACE.md). If invoked directly without those artifacts, halts and prompts the user to run testing first or supply equivalent PART 0–2 code.4---56# NLP Text Classification --- Full Analysis & Manuscript Generation78## Table of Contents910- [Scope Boundary](#scope-boundary)11- [Workflow](#workflow)12- [Additional Inputs](#additional-inputs)13- [Output Structure](#output-structure)14- [Key References (read before generation)](#key-references-read-before-generation)15- [Reporting Standards](#reporting-standards)16- [Method Status](#method-status)17- [Configuration Defaults](#configuration-defaults)18- [Why These Defaults](#why-these-defaults)19- [GPU Availability](#gpu-availability)20- [Minimal Smoke Test](#minimal-smoke-test)21- [Cross-Skill Interface](#cross-skill-interface)222324Open-source skill. Read `reference/specs/output-variation-protocol.md`25before every generation --- apply all variation layers for natural, diverse output.2627## Scope Boundary2829Use this skill when:30- `vera-ai-nlp-reviewing` has already established a credible baseline and the user wants a fuller model battery.31- The task is supervised text classification, optionally with a small set of numeric side features.3233Do not use this skill when:34- The task is generation, retrieval, summarization, sequence labeling, or prompt-only classification.35- The desired method is not in the shipped model list below.36- The available hardware cannot support anything beyond CPU smoke testing and the user expects transformer-scale benchmarking.3738## Workflow3940Continues from where vera-ai-nlp-reviewing stopped (PART 0-2 done).4142| Step | Responsibility | Executor | Document | Input | Output |43|---|---|---|---|---|---|44| Additional ML models | Run Additional Models | Main Agent | `workflow/step04-run-additional-models.md` | Prior step output | PART 3 code + prose |45| Subgroup | Analyze Subgroups | Main Agent | `workflow/step05-analyze-subgroups.md` | Prior step output | PART 4 code + prose |46| Deep learning | Fit Advanced Models | Main Agent | `workflow/step06-fit-advanced-models.md` | Prior step output | PART 5 code + prose |47| Comparison | Compare Models | Main Agent | `workflow/step07-compare-models.md` | Prior step output | PART 6 code + prose |48| Manuscript | Generate Manuscript | Main Agent | `workflow/step08-generate-manuscript.md` | Prior step output | methods.md + results.md |4950## Additional Inputs5152Collect if not already provided:53- Target discipline (for reporting conventions)54- Target journal or style (ACL, EMNLP, NeurIPS, etc.)55- Research question / hypothesis56- Subgroup variable or text property for stratification5758## Output Structure5960```61output/62├── methods.md63├── results.md64├── tables/ ← Markdown + CSV per table65├── figures/ ← PNGs, 300 DPI66├── references.bib67└── code.py ← Style-varied68```6970## Key References (read before generation)7172| File | Purpose |73|---|---|74| `reference/specs/output-variation-protocol.md` | Output quality variation layers |75| `reference/specs/code-style-variation.md` | Seven-dimension code style diversity |76| `reference/patterns/sentence-bank.md` | 4-6 phrasings per result type |77| `reference/rules/reporting-standards.md` | Hard rules for ML/DL reporting |7879## Reporting Standards8081Same as vera-ai-nlp-reviewing, plus:82- All models: report F1 (weighted) and AUC (macro) with bootstrapped 95% CIs83- Deep learning: report training epochs, best epoch, learning rate, batch size84- ALBERT: report pre-trained model name, whether base was frozen85- Feature importance: unified 0-100 scale across ML and DL models86- Model comparison: frame as convergent findings, not horse race87- Tree-based with small N: frame as "exploratory"; never claim generalizability8889## Method Status9091| Status | Methods |92|---|---|93| Implemented in this skill | SVM, Random Forest, LightGBM, GRU, TextCNN, ALBERT |94| Implemented optional variants | Text + extra-feature fusion where the corresponding `*_extra.py` module exists |95| Not shipped in the open-source build | BERT, RoBERTa, DeBERTa, SetFit, prompt-only classifiers, few-shot API-based methods |9697## Configuration Defaults9899Pipeline constants live in `config/default.json`. Read it before generation. Adds to the testing-skill config:100101- `ml_models.*` — SVM/RF/LightGBM hyperparameter grids102- `deep_models.*` — GRU/TextCNN/ALBERT hyperparameter grids, epochs, batch size, learning rate103- `gpu.{required_for, fallback_models}` — e.g., ALBERT requires GPU; falls back to GRU+TextCNN if unavailable (see GPU Availability section below)104- `feature_importance.scale` (0, 100) — unified scale across model families105- `subgroup.{min_size, interaction_alpha}` — subgroup-analysis gating106107To override: create `config/local.json`.108109## Why These Defaults110111- ALBERT is the shipped transformer because it is materially lighter than full BERT-style baselines while still exercising a modern contextual encoder path.112- GRU + TextCNN are the CPU fallback because they preserve two complementary inductive biases, sequential recurrence and local n-gram filters, without pretending a transformer run happened.113- Tree-based models on sparse text remain marked "exploratory" at small N because they are useful robustness checks, not generally the most defensible primary NLP model.114115## GPU Availability116117Check at workflow step 06 (advanced models) start. Implementation pattern:118119```python120import torch121GPU_AVAILABLE = torch.cuda.is_available()122MODELS_TO_FIT = ["GRU", "TextCNN"] + (["ALBERT"] if GPU_AVAILABLE else [])123if not GPU_AVAILABLE:124 print("NOTE: CUDA not available; falling back to GRU + TextCNN. ALBERT skipped.")125```126127Do NOT silently proceed without a model — the fallback must always include at least GRU + TextCNN on CPU.128129## Minimal Smoke Test130131- Smoke-test prompt: "Continue from `vera-ai-nlp-reviewing` on a 4-class 20 Newsgroups subset. Fit the additional ML models and the CPU-safe deep models, then produce the manuscript-ready artifacts."132- CPU pass condition: SVM, Random Forest, LightGBM, GRU, and TextCNN run; ALBERT may be skipped if CUDA is unavailable, but the fallback decision must be logged.133- Expected artifacts: `methods.md`, `results.md`, `tables/`, `figures/`, `references.bib`, and one consolidated `code.py`.134135## Cross-Skill Interface136137```138Method Unit Contract:139├── code_python → .py script (style-varied)140├── methods_md → methods.md (varied structure)141├── results_md → results.md (varied phrasing)142├── tables/ → Markdown + CSV143├── figures/ → PNGs 300 DPI (varied layout)144├── references_bib → .bib with cited references145└── comparison → cross-method narrative (in results.md)146```