Large language models often face a three-way trade-off among detection accuracy, inference latency, and deployment cost when used in real-world safety-sensitive applications. This paper introduces Prefix Probing, a black-box harmful content detection method that compares the conditional log-probabilities of "agreement/execution" versus "refusal/safety" opening prefixes and leverages prefix caching to reduce detection overhead to near first-token latency. During inference, the method requires only a single log-probability computation over the probe prefixes to produce a harmfulness score and apply a threshold, without invoking any additional models or multi-stage inference. To further enhance the discriminative power of the prefixes, we design an efficient prefix construction algorithm that automatically discovers highly informative prefixes, substantially improving detection performance. Extensive experiments demonstrate that Prefix Probing achieves detection effectiveness comparable to mainstream external safety models while incurring only minimal computational cost and requiring no extra model deployment, highlighting its strong practicality and efficiency.
Large language model agents can automate data science workflows, but cloud-centric deployment exposes sensitive context and edge-only deployment limits analytical capability. We present FinDS-Agent, a cloud–edge framework that keeps raw records and program execution at the trusted edge while providing a policy-screened, sanitized context to support cloud planning. FinDS-Agent integrates a Three-Stage Cascaded Privacy Gate (TCPG), a Multi-Dimensional Joint Router (MJR), contract-guided ToolGraph planning, edge-side verification, and bounded repair. On 222 DataSciBench tasks over three runs, FinDS-Agent achieved a 69.93% completion rate and 57.06% success rate, improving over Edge-Only by 9.50 and 5.71 percentage points while invoking the cloud for 32.27% of eligible task-runs. On FinDS-Privacy-Bench, TCPG increased sensitive-field recall from 58.20% to 98.10%; no payload-leakage event was observed in the full set (0/200; Wilson 95% CI: 0–1.8845%) or blind split (0/100; 0–3.6993%) under the specified audit and threat model. External evaluation gave pass rates of 33.2%, 53.1%, and 62.3% for Edge-Only, FinDS-Agent, and Cloud-Only on DS-1000. These empirical results support selective cloud planning while delimiting statistical, privacy, and transfer claims.