YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)

NSW-1: General Purpose Language Model

Introduction

NSW-1 is a transformer-based causal language model developed by Opentrouter-ai, designed for efficient training and inference on consumer-grade hardware. The model specializes in three core domains: financial analysis, general-purpose natural language understanding, and content safety classification. With approximately 1.2 billion parameters, NSW-1 is optimized specifically for Intel Core Ultra 7 processors, leveraging Intel Extension for PyTorch to deliver high-performance CPU-based inference.

Model Architecture

NSW-1 employs a decoder-only transformer architecture with the following specifications:

  • Hidden Size: 2048
  • Attention Heads: 16
  • Layers: 24
  • Vocabulary Size: 50,257
  • Context Length: 4096 tokens
  • Parameter Count: Approximately 1.2B

The model uses SiLU activation functions, RMSNorm for layer normalization, and rotary position embeddings (RoPE) for improved positional encoding.

Capabilities

Financial Analysis

Trained on financial documents, market reports, and economic literature, NSW-1 can assist with market analysis, risk assessment, financial summarization, and economic trend interpretation.

General Purpose Tasks

The model handles diverse natural language processing tasks including question answering, text generation, summarization, translation, and reasoning across multiple domains.

Safety Classification

Built-in content moderation capabilities enable toxicity detection, bias assessment, and content appropriateness evaluation for production applications.

System Requirements

Minimum Configuration:

  • Processor: Intel Core Ultra 7 or equivalent x86-64 CPU
  • Memory: 16GB RAM
  • Storage: 10GB available space
  • Operating System: Linux, Windows, or macOS

Recommended Configuration:

  • Processor: Intel Core Ultra 7 165H or higher
  • Memory: 32GB RAM
  • Storage: 20GB SSD
  • Operating System: Linux (Ubuntu 20.04+)

Installation

Install the required dependencies using pip:

pip install -r requirements.txt

For optimal performance on Intel processors, ensure Intel Extension for PyTorch is properly installed:

pip install intel-extension-for-pytorch

Usage

Basic Inference

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_name = "Opentrouter-ai/NSW-1"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

prompt = "Explain the relationship between inflation and interest rates:"
inputs = tokenizer(prompt, return_tensors="pt")

with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_length=200,
        temperature=0.7,
        top_p=0.9
    )

response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)

Intel Optimization

import intel_extension_for_pytorch as ipex

model = AutoModelForCausalLM.from_pretrained(model_name)
model = ipex.optimize(model, dtype=torch.float32)
model.eval()

API Server

Deploy the model as a REST API service:

python inference_server.py

The server exposes endpoints at http://localhost:8000:

  • /generate - General text generation
  • /finance-analysis - Financial domain queries
  • /safety-check - Content safety evaluation
  • /health - Service health status

Training

Data Preparation

Organize your training data in text format:

data/
β”œβ”€β”€ train.txt
└── val.txt

Training Execution

python train.py \
    --config config.yaml \
    --data_path ./data \
    --output_dir ./output \
    --epochs 3

Configuration

Training parameters can be adjusted in config.yaml. Key settings include learning rate, batch size, gradient accumulation steps, and hardware-specific optimizations for Intel processors.

Performance Considerations

The model is optimized for CPU inference through several mechanisms:

  • Intel Extension for PyTorch integration
  • Thread affinity optimization
  • Gradient checkpointing for memory efficiency
  • FP32 precision for CPU compatibility

Expected inference speed on Intel Core Ultra 7: 15-25 tokens per second depending on configuration and prompt complexity.

Limitations

  • The model is trained primarily on English language data
  • Financial outputs are for informational purposes only and do not constitute professional financial advice
  • Knowledge cutoff date: January 2024
  • May occasionally produce factually incorrect or biased outputs
  • Requires human verification for critical applications

Ethical Considerations

NSW-1 incorporates content filtering and bias mitigation strategies, but users should implement additional safeguards when deploying in production environments. The model should not be used for automated decision-making in high-stakes scenarios without human oversight.

License

This model is released under the Apache License 2.0. See LICENSE file for full terms.

Citation

@misc{nsw1_2024,
  author = {Opentrouter-ai},
  title = {NSW-1: A General Purpose Language Model},
  year = {2024},
  publisher = {HuggingFace},
  howpublished = {\url{https://huggingface.co/Opentrouter-ai/NSW-1}}
}

Support

For technical issues, feature requests, or questions, please open an issue in the model repository or contact the development team through the HuggingFace model page.

Downloads last month
57
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support