Skip to content

Home

Lophius logo
Go deep.

Lophius is a workbench for language model research.

It gives you the convenience of GUIs when you want it,
and the raw power of Python when you need it.


Run this in your Jupyter Jupyter or Google Colab Colab notebook:

%pip install lophius
import lophius
lophius.init()
model = lophius.load("Qwen/Qwen3.5-4B")

# Displaying the model object brings up the GUI in the cell output!
# Different object types have different GUIs.
model

Screenshot Screenshot

  See the Tutorial


Features

  • Load multiple models simultaneously, to compare and perform batch operations on them
  • View model statistics, architecture, and edit model configuration with live reload
  • View tokenizer information, edit chat template, view and search vocabulary, and edit tokenizer configuration with live reload
  • Direct links to source code for any module
  • Chat with one or multiple loaded models whenever you want
  • Load and manage prompt datasets graphically
  • Batch inference with automatic optimal batch size determination for your system
  • Load and splice missing data streams into output objects with the click of a button
  • Custom LogitsProcessor for memory-efficient logit data capture
  • View logits, probabilities, and entropy for any token position
  • Visualize attention scores for any layer and attention head
  • Visualize first-token hidden states in 2D or 3D, using the dimensionality-reduction method of your choice (PCA, t-SNE, UMAP, or PaCMAP)
  • Easily access raw Transformers/PyTorch objects when needed
  • Fully documented, 100% type-annotated API

Potential future features

  • Quantized model loading with bitsandbytes
  • Visualization of non-standard attention mechanisms
  • Load and use sparse autoencoders
  • Load, fit, and use Jacobian lenses
  • Multimodal inference
  • Obtain input/output residuals at any module position, not just after each layer

Supported models

Lophius implements sophisticated heuristics to access model internals uniformly across different model architectures. It is expected to work with the vast majority of model families supported by Transformers. The following models have been tested manually and found to work:

  • Gemma 4 Dense, MoE, and PLE (Gemma4ForConditionalGeneration)
  • Gemma 3n (Gemma3nForConditionalGeneration) (requires installing the timm package)
  • Gemma 3 (Gemma3ForConditionalGeneration)
  • Gemma 2 (Gemma2ForCausalLM)
  • DeepSeek V4 (DeepseekV4ForCausalLM)
  • Inkling (InklingForConditionalGeneration)
  • Hy3 (HYV3ForCausalLM)
  • GLM-5.1 and GLM-5.2 (GlmMoeDsaForCausalLM)
  • GLM-4.7-Flash (Glm4MoeLiteForCausalLM)
  • Qwen3.5 and Qwen3.6 Dense (Qwen3_5ForConditionalGeneration)
  • Qwen3.5 and Qwen3.6 MoE (Qwen3_5MoeForConditionalGeneration)
  • MiniMax-M2.7 (MiniMaxM2ForCausalLM)
  • Mistral Small 4 (Mistral3ForConditionalGeneration)
  • GPT-OSS (GptOssForCausalLM)
  • Phi-4 (Phi3ForCausalLM)